Skip to contents

Construct experiment design basic on colnames parse

Usage

get_exdesign_parse(
  label,
  mode = c("delim", "char"),
  chars = 1,
  sep = "_",
  remove_prefix = TRUE,
  remove_suffix = FALSE
)

Arguments

label

Characters, label names(column names) of assay

mode

one of "delim", "char"

chars

Integer(1). If mode is "char", how many chars in the end of label are 'replicate'

sep

Character(1). If mode is "sep", how many chars in the end of label are 'replicate'

Value

A data.frame contain four columns: label,ID,condition,replicate

Examples

## Parse on delim
samples = c("Quantity.A_1","Quantity.A_2","Quantity.A_3","Quantity.B_1","Quantity.B_2","Quantity.B_3",
            "Quantity.C_1","Quantity.C_2")
get_exdesign_parse(samples, mode = "delim", sep = "_")
#>   label  ID condition replicate
#> 1   A_1 A_1         A         1
#> 2   A_2 A_2         A         2
#> 3   A_3 A_3         A         3
#> 4   B_1 B_1         B         1
#> 5   B_2 B_2         B         2
#> 6   B_3 B_3         B         3
#> 7   C_1 C_1         C         1
#> 8   C_2 C_2         C         2

## Parse on certain character
samples = c("Quantity.A1","Quantity.A2","Quantity.A3","Quantity.B1","Quantity.B2","Quantity.B3",
            "Quantity.C1","Quantity.C2")
get_exdesign_parse(samples, mode = "char", chars = 1)
#>   label ID condition replicate
#> 1    A1 A1         A         1
#> 2    A2 A2         A         2
#> 3    A3 A3         A         3
#> 4    B1 B1         B         1
#> 5    B2 B2         B         2
#> 6    B3 B3         B         3
#> 7    C1 C1         C         1
#> 8    C2 C2         C         2
# Reserve prefix
get_exdesign_parse(samples, mode = "char", chars = 1, remove_prefix = FALSE)
#>         label          ID  condition replicate
#> 1 Quantity.A1 Quantity.A1 Quantity.A         1
#> 2 Quantity.A2 Quantity.A2 Quantity.A         2
#> 3 Quantity.A3 Quantity.A3 Quantity.A         3
#> 4 Quantity.B1 Quantity.B1 Quantity.B         1
#> 5 Quantity.B2 Quantity.B2 Quantity.B         2
#> 6 Quantity.B3 Quantity.B3 Quantity.B         3
#> 7 Quantity.C1 Quantity.C1 Quantity.C         1
#> 8 Quantity.C2 Quantity.C2 Quantity.C         2