Decorates LFQData with methods to compute statistics of interactions

Decorates LFQData with methods to compute statistics of interactions

Details

compute stdv, mean and CV per peptide or protein and condition.

Public fields

lfq

LFQData

stat

either CV or sd (if is_transformed)

statsdf

frame with statistics.

Methods


Method new()

create analyse variances and CV

Usage

LFQDataStats$new(lfqdata, stats = c("everything", "interaction", "all"))

Arguments

lfqdata

LFQData object

stats

if interaction - within group stats, if all then overall CV, if pooled - then pooled variance using grouping information (t.b.d.)


Method stats()

access data.frame with statistics

Usage

LFQDataStats$stats()

Returns

data.frame with computed statistics


Method stats_wide()

access data.frame with statistics in wide format

Usage

LFQDataStats$stats_wide()

Returns

data.frame with computed statistics in wide format


Method stats_quantiles()

Determine CV or sd for the quantiles

Usage

LFQDataStats$stats_quantiles(probs = c(0.1, 0.25, 0.5, 0.75, 0.9))

Arguments

probs

for which quantile to determine CV or sd


Method density()

plots density or ecdf

Usage

LFQDataStats$density(ggstat = c("density", "ecdf"))

Arguments

ggstat

either density or ecdf

Returns

ggplot


Method density_median()

plot density or ecdf of CV or sd for the 50

Usage

LFQDataStats$density_median(ggstat = c("density", "ecdf"))

Arguments

ggstat

either density of ecdf

Returns

ggplot


Method violin()

plot violinplot of CV or sd

Usage

LFQDataStats$violin()

Arguments

ggstat

either density of ecdf

Returns

ggplot


Method violin_median()

plot violinplot of CV or sd for the 50

Usage

LFQDataStats$violin_median()

Returns

ggplot


Method stdv_vs_mean()

plot sd vs mean

Usage

LFQDataStats$stdv_vs_mean(size = 200)

Arguments

size

number of points to sample (default 200)

Returns

ggplot


Method power_t_test_quantiles()

compute sample size for entire dataset

Usage

LFQDataStats$power_t_test_quantiles(
  probs = c(0.1, 0.25, 0.5, 0.75, 0.9),
  delta = c(0.59, 1, 2),
  power = 0.8,
  sig.level = 0.05
)

Arguments

probs

quantiles of sd for which sample size should be computed

delta

effect size

power

power of test

sig.level

significance level.


Method power_t_test()

compute sample for each protein

Usage

LFQDataStats$power_t_test(delta = c(0.59, 1, 2), power = 0.8, sig.level = 0.05)

Arguments

delta

effect size

power

power of test

sig.level

significance level.


Method clone()

The objects of this class are cloneable with this method.

Usage

LFQDataStats$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples


# 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)