LFQData R6 class
LFQData R6 class
Other LFQData:
LFQDataAggregator
,
LFQDataPlotter
,
LFQDataStats
,
LFQDataSummariser
,
LFQDataToSummarizedExperiment()
,
LFQDataWriter
config
AnalysisConfiguration
data
data.frame or tibble matching AnalysisConfiguration.
is_pep
todo
prefix
e.g. "peptide_", "protein_", "compound_"
new()
initialize
LFQData$new(data, config, is_pep = TRUE, prefix = "ms_", setup = FALSE)
data
data.frame
config
configuration
is_pep
todo
prefix
will be use as output prefix
setup
is data setup needed, default = FALSE, if TRUE, calls setup_analysis
on data first.
remove_small_intensities()
some software is reporting NA's as 0, you must remove it from your data
filter_proteins_by_peptide_count()
remove proteins with less than X peptides
omit_NA()
Omit NA from intensities per hierarchy (e.g. protein or peptide), idea is to use it for normalization For instance if a peptide has a missing value in more then nrNA of the samples within a condition it will be removed
complete_cases()
some software is reporting NA's as 0, you must remove it from your data
to_wide()
converts the data to wide
LFQData$to_wide(as.matrix = FALSE, value = c("response", "nr_children"))
summarize_hierarchy()
e.g. number of peptides per protein etc
get_Stats()
Get LFQDataStats
. For more details see LFQDataStats
.
LFQData$get_Stats(stats = c("everything", "interaction", "all"))
filter_difference()
get difference of self with other if other is subset of self
istar <- sim_lfq_data_peptide_config()
#> creating sampleName from fileName column
#> Warning: no nr_children column specified in the data, adding column nr_children and setting to 1.
#> completing cases
#LFQData$debug("omit_NA")
lfqdata <- LFQData$new(istar$data, istar$config)
lfqdata$filter_proteins_by_peptide_count()
#> removing proteins with less than: 2 peptpides
#> Column added : nr_peptide_Id_IN_protein_Id
tmp <- lfqdata$to_wide()
testthat::expect_equal(nrow(tmp$data) , nrow(tmp$rowdata))
testthat::expect_equal(ncol(tmp$data) , nrow(tmp$annotation) + ncol(tmp$rowdata))
stopifnot("data.frame" %in% class(tmp$data))
tmp <- lfqdata$to_wide(as.matrix = TRUE)
stopifnot("matrix" %in% class(tmp$data))
stopifnot(lfqdata$is_transformed()==FALSE)
lfqdata$summarize_hierarchy()
#> # A tibble: 6 × 3
#> protein_Id isotopeLabel_n peptide_Id_n
#> <chr> <int> <int>
#> 1 0EfVhX~0087 1 3
#> 2 BEJI92~5282 1 2
#> 3 Fl4JiV~8625 1 4
#> 4 HvIpHG~9079 1 2
#> 5 JcKVfU~9653 1 7
#> 6 SGIVBl~5782 1 6
# filter for missing values
f1 <- lfqdata$omit_NA(nrNA = 0)
#> [1] "group_"
#> completing cases
#> Joining with `by = join_by(protein_Id, peptide_Id)`
stopifnot(f1$hierarchy_counts() <= lfqdata$hierarchy_counts())
f2 <- lfqdata$omit_NA(factorDepth = 0)
#> NULL
#> completing cases
#> Joining with `by = join_by(protein_Id, peptide_Id)`
stopifnot(f2$hierarchy_counts() <= lfqdata$hierarchy_counts())
lfqdata$response()
#> [1] "abundance"
lfqdata$rename_response("peptide.intensity")
lfqdata$response()
#> [1] "peptide.intensity"
stopifnot("LFQData" %in% class(lfqdata$get_copy()))
stopifnot("LFQDataTransformer" %in% class(lfqdata$get_Transformer()))
stopifnot("LFQDataStats" %in% class(lfqdata$get_Stats()))
#> [1] "group_"
#> completing cases
#> NULL
#> completing cases
stopifnot("LFQDataSummariser" %in% class(lfqdata$get_Summariser()))
stopifnot("LFQDataPlotter" %in% class(lfqdata$get_Plotter()))
stopifnot("LFQDataWriter" %in% class(lfqdata$get_Writer()))
stopifnot("LFQDataAggregator" %in% class(lfqdata$get_Aggregator()))
lfqdata2 <- lfqdata$get_copy()
lfqdata2$data <- lfqdata2$data[1:100,]
res <- lfqdata$filter_difference(lfqdata2)
stopifnot(nrow(res$data) == nrow(lfqdata$data) - 100)
tmp <- lfqdata$get_sample(5, seed = 4)
#> Sampling 5protein_Id
#> Joining with `by = join_by(protein_Id)`
stopifnot(nrow(tmp$hierarchy()) == 5)
lw <- lfqdata$get_Writer()
stopifnot(names(lw$get_wide()) %in% c("data", "annotation"))
stopifnot("data.frame" %in% class(lw$get_long()))