R/LFQDataStats.R
LFQDataStats.Rd
Decorates LFQData with methods to compute statistics of interactions
Decorates LFQData with methods to compute statistics of interactions
compute stdv, mean and CV per peptide or protein and condition.
Other LFQData:
LFQData
,
LFQDataAggregator
,
LFQDataPlotter
,
LFQDataSummariser
,
LFQDataToSummarizedExperiment()
,
LFQDataWriter
lfq
LFQData
stat
either CV or sd (if is_transformed)
statsdf
frame with statistics.
new()
create analyse variances and CV
LFQDataStats$new(lfqdata, stats = c("everything", "interaction", "all"))
stats_quantiles()
Determine CV or sd for the quantiles
LFQDataStats$stats_quantiles(probs = c(0.1, 0.25, 0.5, 0.75, 0.9))
density_median()
plot density or ecdf of CV or sd for the 50
LFQDataStats$density_median(ggstat = c("density", "ecdf"))
power_t_test()
compute sample for each protein
LFQDataStats$power_t_test(delta = c(0.59, 1, 2), power = 0.8, sig.level = 0.05)
# study variance of not normalized data
#source("c:/Users/wewol/prog/prolfqua/R/LFQData.R")
runallfuncs <- function(x){
stopifnot("data.frame" %in% class(x$stats()))
stopifnot("data.frame" %in% class(x$stats_wide()))
stopifnot(c("long", "wide") %in% names(x$stats_quantiles()))
stopifnot("ggplot" %in% class(x$density()))
stopifnot("ggplot" %in% class(x$density_median()))
stopifnot("ggplot" %in% class(x$density("ecdf")))
stopifnot("ggplot" %in% class(x$density_median("ecdf")))
stopifnot("ggplot" %in% class(x$violin()))
stopifnot("ggplot" %in% class(x$violin_median()))
stopifnot("ggplot" %in% class(x$stdv_vs_mean(size = 400)))
if(!x$lfq$is_transformed()){
stopifnot(is.null(x$power_t_test()))
stopifnot(is.null(x$power_t_test_quantiles()))
}
}
bb <- prolfqua::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 <- LFQData$new(bb$data, bb$config)
lfqstats <- lfqdata$get_Stats()
#> [1] "group_"
#> completing cases
#> NULL
#> completing cases
stopifnot(ncol(lfqstats$stats_wide()) == 30)
lfqstats$violin()
#> Warning: Removed 2 rows containing non-finite outside the scale range
#> (`stat_ydensity()`).
#> Warning: Removed 2 rows containing non-finite outside the scale range
#> (`stat_summary()`).
runallfuncs(lfqstats)
#> Warning: data is not transformed - aborting
#> Warning: data is not transformed - aborting
x <- lfqstats
#study variance of normalized data
lfqdata <- LFQData$new(bb$data, bb$config)
lfqdata$is_transformed(TRUE)
lfqstats <- lfqdata$get_Stats()
#> [1] "group_"
#> completing cases
#> NULL
#> completing cases
stopifnot(ncol(lfqstats$stats_wide()) == 26)
runallfuncs(lfqstats)
#Slightly different dataset
# estimates statistics for all samples
lfqstats <- lfqdata$get_Stats(stats = "all")
#> NULL
#> completing cases
stopifnot(ncol(lfqstats$stats_wide()) == 8)
runallfuncs(lfqstats)
lfqstats <- lfqdata$get_Stats(stats = "interaction")
#> [1] "group_"
#> completing cases
stopifnot(ncol(lfqstats$stats_wide()) == 20)
runallfuncs(lfqstats)