This helper functions performs the differential expression analysis with the voom
method from the limma
package (via limma::voom()
, limma::lmFit()
and limma::eBayes()
)
for given counts in a AnyHermesData object and a corresponding design
matrix.
h_diff_expr_voom(object, design, ...)
(AnyHermesData
)
input.
(matrix
)
design matrix.
additional arguments internally passed to limma::eBayes()
(robust
, trend
, proportion
,
winsor.tail.p
, stdev.coef.lim
).
A data frame with columns log2_fc
(estimated log2 fold change),
stat
(moderated t-statistic), p_val
(raw p-value), adj_p_pval
(Benjamini-Hochberg adjusted p-value).
Ritchie ME, Phipson B, Wu D, Hu Y, Law CW, Shi W, Smyth GK (2015). “limma powers differential expression analyses for RNA-sequencing and microarray studies.” Nucleic Acids Research, 43(7), e47. doi: 10.1093/nar/gkv007 .
Law CW, Chen Y, Shi W, Smyth GK (2014). “voom: precision weights unlock linear model analysis tools for RNA-seq read counts.” Genome Biology, 15(2), R29. doi: 10.1186/gb-2014-15-2-r29 .
object <- hermes_data
# Create the design matrix corresponding to the factor of interest.
design <- model.matrix(~SEX, colData(object))
# Then perform the differential expression analysis.
result <- h_diff_expr_voom(object, design)
head(result)
#> log2_fc stat p_val adj_p_val
#> GeneID:8000 -2.3200712 -4.239244 0.0004209192 0.9118348
#> GeneID:51227 -1.0467295 -4.032550 0.0006788432 0.9118348
#> GeneID:344558 1.6896266 3.824046 0.0010993677 0.9118348
#> GeneID:51575 -0.7760844 -3.746293 0.0013155805 0.9118348
#> GeneID:151242 -3.4358998 -3.570103 0.0019741997 0.9118348
#> GeneID:8904 -0.6100354 -3.542864 0.0021017199 0.9118348
# Sometimes we might want to specify method details.
result2 <- h_diff_expr_voom(object, design, trend = TRUE, robust = TRUE)
head(result2)
#> log2_fc stat p_val adj_p_val
#> GeneID:8000 -2.3200712 -3.848050 0.0008857274 0.8995289
#> GeneID:51227 -1.0467295 -3.724654 0.0011933484 0.8995289
#> GeneID:344558 1.6896266 3.684191 0.0013155791 0.8995289
#> GeneID:51575 -0.7760844 -3.498308 0.0020551283 0.8995289
#> GeneID:151242 -3.4358998 -3.441687 0.0023525055 0.8995289
#> GeneID:123036 2.9002547 3.431263 0.0024329189 0.8995289