Data.frame to SummarizedExperiment object conversion using parsing from column names
make_se_parse.Rd
make_se_parse
creates a SummarizedExperiment object
based on a single data.frame.
Usage
make_se_parse(
proteins_unique,
columns,
mode = c("char", "delim"),
chars = 1,
sep = "_",
remove_prefix = T,
remove_suffix = F,
log2transform = T
)
Arguments
- proteins_unique
Data.frame, Protein table with unique names annotated in the 'name' column (output from
make_unique()
).- columns
Integer vector, Column numbers indicating the columns containing the assay data.
- mode
"char" or "delim", The mode of parsing the column headers. "char" will parse the last number of characters as replicate number and requires the 'chars' parameter. "delim" will parse on the separator and requires the 'sep' parameter.
- chars
Numeric(1), The number of characters to take at the end of the column headers as replicate number (only for mode = "char").
- sep
Character(1), The separator used to parse the column header (only for mode = "delim").
- remove_prefix
Logical(1), whether remove the prefix of expression columns.
- remove_suffix
Logical(1), whether remove the suffix of expression columns.
- log2transform
Logical(1), whether log2 transform the assay, default TRUE.
Examples
# Load example
data(Silicosis_pg)
data <- Silicosis_pg
data_unique <- make_unique(data, "Gene.names", "Protein.IDs", delim = ";")
# Make SummarizedExperiment
columns <- grep("LFQ.", colnames(data_unique))
se <- make_se_parse(data_unique, columns, mode = "char", chars = 1, remove_prefix = TRUE)
colnames(se)
#> [1] "PBS_1" "PBS_2" "PBS_3" "PBS_4" "W10_2" "W10_4" "W2_1" "W2_3" "W2_4"
#> [10] "W2_5" "W4_2" "W4_3" "W4_4" "W4_5" "W6_2" "W6_3" "W6_4" "W6_6"
#> [19] "W9_2" "W9_4"
se <- make_se_parse(data_unique, columns, mode = "delim", remove_prefix = FALSE)
colnames(se)
#> [1] "LFQ.intensity.PBS_1" "LFQ.intensity.PBS_2" "LFQ.intensity.PBS_3"
#> [4] "LFQ.intensity.PBS_4" "LFQ.intensity.W10_2" "LFQ.intensity.W10_4"
#> [7] "LFQ.intensity.W2_1" "LFQ.intensity.W2_3" "LFQ.intensity.W2_4"
#> [10] "LFQ.intensity.W2_5" "LFQ.intensity.W4_2" "LFQ.intensity.W4_3"
#> [13] "LFQ.intensity.W4_4" "LFQ.intensity.W4_5" "LFQ.intensity.W6_2"
#> [16] "LFQ.intensity.W6_3" "LFQ.intensity.W6_4" "LFQ.intensity.W6_6"
#> [19] "LFQ.intensity.W9_2" "LFQ.intensity.W9_4"