This helper functions performs the differential expression analysis with
DESeq2::DESeq()
for a given AnyHermesData input and design
matrix.
h_diff_expr_deseq2(object, design, ...)
(HermesData
)
input.
(matrix
)
design matrix.
additional arguments internally passed to DESeq2::DESeq()
(fitType
, sfType
,
minReplicatesForReplace
, useT
, minmu
).
A data frame with columns log2_fc
(estimated log2 fold change),
stat
(Wald statistic), p_val
(raw p-value), adj_p_pval
(Benjamini-Hochberg adjusted p-value).
Love MI, Huber W, Anders S (2014). “Moderated estimation of fold change and dispersion for RNA-seq data with DESeq2.” Genome Biology, 15(12), 550. doi: 10.1186/s13059-014-0550-8 .
object <- hermes_data
# Create the design matrix corresponding to the factor of interest.
design <- model.matrix(~SEX, colData(object))
# Then perform the `DESeq2` differential expression analysis.
result <- h_diff_expr_deseq2(object, design)
head(result)
#> log2_fc stat p_val adj_p_val
#> GeneID:9834 5.859486 5.440035 5.327024e-08 0.0001852739
#> GeneID:221188 3.450713 4.805489 1.543734e-06 0.0026845539
#> GeneID:151242 -4.316426 -4.707534 2.507316e-06 0.0029068155
#> GeneID:9002 2.324969 4.390859 1.129039e-05 0.0097580091
#> GeneID:64344 -2.880611 -4.343419 1.402819e-05 0.0097580091
#> GeneID:4359 2.914210 4.206676 2.591542e-05 0.0113396717
# Change of the `fitType` can be required in some cases.
result2 <- h_diff_expr_deseq2(object, design, fitType = "local")
head(result2)
#> log2_fc stat p_val adj_p_val
#> GeneID:9834 5.8595097 5.436419 5.436203e-08 0.0001605311
#> GeneID:221188 3.4507368 4.796226 1.616827e-06 0.0023872456
#> GeneID:151242 -4.3163441 -4.693049 2.691627e-06 0.0026494579
#> GeneID:9002 2.3249808 4.379230 1.190996e-05 0.0073970422
#> GeneID:64344 -2.8805945 -4.368250 1.252462e-05 0.0073970422
#> GeneID:51575 -0.7889652 -4.255997 2.081193e-05 0.0076822022