Skip to contents

test_diff performs a differential enrichment/expression test based on protein/peptide-wise linear models and empirical Bayes statistics using limma. False Discovery Rates are estimated using "Strimmer's qvalue", "Benjamini-Hochberg fdr" or "Storey's qvalue".

Usage

test_diff(
  se,
  type = c("all", "control", "manual"),
  control = NULL,
  test = NULL,
  design_formula = formula(~0 + condition),
  fdr.type = c("Strimmer's qvalue(t)", "Strimmer's qvalue(p)", "BH", "Storey's qvalue")
)

Arguments

se

SummarizedExperiment, Proteomics data from quantity table (output from make_se(), make_se_parse()), or from re-aggregate peptide quantity from aggregateFeatures() ). For proteomics data directly from quantity table, it is adviced to first remove low quanlity and undesired rows by filter_se(), and missing values are imputed by impute(). Normalization is recommended in both workflow.

type

"control", "all" or "manual", The type of contrasts that will be tested. This can be all possible pairwise comparisons ("all"), limited to the comparisons versus the control ("control"), or manually defined contrasts ("manual").

control

Character(1), The condition to which contrasts are generated if type = "control" (a control condition would be most appropriate).

test

Character, The contrasts that will be tested if type = "manual". These should be formatted as "conditionA_vs_conditionB" or c("conditionA_vs_conditionC", "conditionB_vs_conditionC").

design_formula

Formula, Used to create the design matrix.

fdr.type

Character(1), the method to control false discovery rate, one of "Strimmer's qvalue(t)","Strimmer's qvalue(p)","BH","Storey's qvalue". "Strimmer's qvalue" calculate fdr vis fdrtool() using t-statistic or p values from limma. "BH" calculate fdr vis p.adjust() using "BH" method . "Storey's qvalue" calculate fdr vis stats::qvalue().

Value

A SummarizedExperiment object or a DEGdata containing diff, test result from limma and fdr estimates of differential expression.

Examples

# Load example
data(Silicosis_pg)
data <- Silicosis_pg
data_unique <- make_unique(data, "Gene.names", "Protein.IDs", delim = ";")

# Make SummarizedExperiment
ecols <- grep("LFQ.", colnames(data_unique))


## Load experiement design
data(Silicosis_ExpDesign)
exp_design <- Silicosis_ExpDesign
se <- make_se(data_unique, ecols, exp_design)

# Filter and normalize
filt <- filter_se(se, thr = 0, fraction = 0.4, filter_formula = ~ Reverse != "+" & Potential.contaminant!="+")
#> filter base on missing number is <= 0 in at least one condition.
#> filter base on missing number fraction < 0.4 in each row
#> filter base on giving formula 
norm <- normalize_vsn(filt)
#> vsn2: 8762 x 20 matrix (1 stratum). 
#> Please use 'meanSdPlot' to verify the fit.

# Impute missing values using different functions
imputed <- impute(norm, fun = "MinProb", q = 0.05)
#> Imputing along margin 2 (samples/columns).
#> [1] 0.3026531

# Test for differentially expressed proteins
diff <- test_diff(imputed, "control", "PBS")
#> Tested contrasts: W10_vs_PBS, W2_vs_PBS, W4_vs_PBS, W6_vs_PBS, W9_vs_PBS
#> Strimmer's qvalue(t)
diff <- test_diff(imputed, "manual", test = "PBS_vs_W6")
#> Tested contrasts: PBS_vs_W6
#> Strimmer's qvalue(t)
diff <- test_diff(imputed, "manual", test = "PBS_vs_W6", fdr.type = "Storey's qvalue")
#> Tested contrasts: PBS_vs_W6
#> Storey's qvalue