DE_timecourse.Rd
Run spline models and test for DE of contrasts.
# S4 method for Moanin DE_timecourse(object, contrasts, center = FALSE, use_voom_weights = TRUE)
object | An object of class |
---|---|
contrasts | Contrasts, either provided as a vector of strings, or a
matrix of contrasts coefficients obtained using
|
center | boolean, whether to center the data matrix |
use_voom_weights | boolean, optional, default: TRUE. Whether to use voom weights. See details. |
A data.frame
with two columns for each of the contrasts given
in contrasts
, corresponding to the raw p-value of the contrast for
that gene (_pval
) and the adjusted p-value (_qval
). The
adjusted p-values are FDR-adjusted based on the Benjamini-Hochberg method,
as implemented in p.adjust
. The adjustment is done
across all p-values for all contrasts calculated.
The implementation of the spline fit and the calculation of p-values
was based on code from edge
, and expanded to enable
handling of comparisons of groups via contrasts.#' @seealso
makeContrasts
, create_moanin_model
,
DE_timepoints
, edge
If use_voom_weights=TRUE
, then before fitting splines to each gene,
voom weights are calculated from assay(object)
:
y <- edgeR::DGEList(counts=assay(object)) y <- edgeR::calcNormFactors(y, method="upperquartile") v <- limma::voom(y, contrasts, plot=FALSE) weights <- limma::lmFit(v)
These weights are given to the lm.fit
which fits the spline coefficients.
This workflow assumes that the input to the Moanin
object were counts.
If the user set log_transform=TRUE
in the creation of the
Moanin
object, the splines will be fit to the log of the input data,
and not directly to the input data. This is independent of whether the user
chooses use_voom_weights
.
data(exampleData) moanin <- create_moanin_model(data=testData, meta=testMeta) deTimecourse=DE_timecourse(moanin, contrasts="K-C", use_voom_weights=FALSE) head(deTimecourse)#> K-C_pval K-C_qval #> NM_009912 4.202051e-16 3.334961e-15 #> NM_008725 2.235850e-01 2.393844e-01 #> NM_007473 4.941392e-01 5.136583e-01 #> ENSMUST00000094955 1.242532e-17 1.242532e-16 #> NM_001042489 3.261235e-04 5.328816e-04 #> NM_008159 2.885140e-15 2.090681e-14