LFQData R6 class
Missing Data Assumptions
The filtering and imputation methods in this package assume that missing values are Missing Completely At Random (MCAR) or Missing At Random (MAR). Abundance-dependent missingness (MNAR), which is common in DDA proteomics, is not modelled. Users should be aware that MNAR can bias fold-change estimates and inflate false discovery rates.
Methods
LFQData$new()
initialize
Usage
LFQData$new(data, config, prefix = "ms_", setup = FALSE)Arguments
datadata.frame
configconfiguration
prefixwill be use as output prefix
setupis data setup needed, default = FALSE, if TRUE, calls
setup_analysison data first.
LFQData$remove_small_intensities()
some software is reporting NA's as 0, you must remove it from your data
LFQData$remove_decoys()
remove decoy / reverse-database entries (rows whose top-level hierarchy id,
e.g. protein_Id, is a decoy). Detection uses the configured
`pattern_decoys` unioned with the built-in defaults (see
is_decoy); decoys are always detectable even when no pattern
is configured. Returns a new decoy-free LFQData (self is not modified).
LFQData$decoy_proportion()
proportion of modelling-level keys (subject_id, e.g. protein or peptide by `hierarchy_depth`) that are decoys — an empirical-FDR / target-decoy QC signal. Decoy status derives from the top-level hierarchy id (protein_Id).
LFQData$data_wide()
converts the data to wide
LFQData$relevant_hierarchy_keys()
return hierarchy column names at current depth (alias for subject_id)
LFQData$get_Stats()
Get LFQDataStats. For more details see LFQDataStats.
Usage
LFQData$get_Stats(stats = c("everything", "interaction", "all"))LFQData$get_Aggregator()
get Aggregator
Examples
istar <- sim_lfq_data_peptide_config()
#> creating sampleName from file_name column
#> completing cases
#> completing cases done
#> setup done
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$data_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$data_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
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()))
stopifnot("LFQDataSummariser" %in% class(lfqdata$get_Summariser()))
stopifnot("LFQDataPlotter" %in% class(lfqdata$get_Plotter()))
stopifnot("AggregateMedpolish" %in% class(lfqdata$get_Aggregator("medpolish")))
#> Warning: You did not transform the intensities. medpolish works best with already variance stabilized intensities. Use LFQData$get_Transformer to transform the data: peptide.intensity
tmp <-lfqdata$get_sample(5, seed = 4)
#> Sampling 5 protein_Id
#> Joining with `by = join_by(protein_Id)`
stopifnot(nrow(tmp$hierarchy()) == 5)