Differential expression testing is performed with "variancePartition::dream()" to increase power and decrease false positives for repeated measure designs. The `primary_variable` is modeled as a fixed effect. If you wish to test an interaction term, `primary_variable` can take multiple variable names.

differential_expression(
  filtered_counts,
  cqn_counts,
  md,
  primary_variable,
  biomart_results,
  p_value_threshold,
  fold_change_threshold,
  random_effect = NULL,
  model_variables = NULL,
  exclude_variables = NULL,
  cores = NULL,
  is_num = NULL,
  num_var = NULL,
  cont = NULL
)

Arguments

filtered_counts

A counts data frame with genes removed that have low expression.

cqn_counts

A counts data frame normalized by CQN.

md

A data frame with sample identifiers in a column and relevant experimental covariates.

primary_variable

Vector of variables that will be collapsed into a single fixed effect interaction term.

biomart_results

Output of "sageseqr::get_biomart()". Gene Ids are stored as rownames.

p_value_threshold

Numeric. P-values are adjusted by Benjamini and Hochberg (BH) false discovery rate (FDR). Significant genes are those with an adjusted p-value greater than this threshold.

fold_change_threshold

Numeric. Significant genes are those with a fold-change greater than this threshold.

random_effect

A vector of variables to consider as random effects instead of fixed effects.

model_variables

Optional. Vector of variables to include in the linear (mixed) model. If not supplied, the model will include all variables in md.

exclude_variables

Vector of variables to exclude from testing.

cores

An integer of cores to specify in the parallel backend (eg. 4).

is_num

Is there a numerical covariate to use as an interaction with the primary variable(s). default= NULL

num_var

A numerical metadata column to use in an inaction with the primary variable(s). default= NULL

cont

Optional. A list specifying contrasts of the primary variable(s) to consider for differential sequencing results if using factor(s) as your primary variable. If not specified all combinations will be tested. If specified this will speed up the pipeline. Specify the contrast with the factor values involved in the contrast separated by a hyphen. (eg for diagnosis, "primary_variable = c(\"AD-CT\")" where AD is the value in diagnosis column for cases and CT is the value for controls. For multi-level contrasts, eg. "primary_variable = c(\"diagnosis\", \"Sex\")" would have contrasts specified as; cont= c(\"ZZ_F-CT_F\", \"ZZ_M-CT_M\") to look at cases vs controls in females and cases vs controls in males independently. While the order before or after the hyphen doesn't matter, the order of values before/after the underscore does matter. The value order must be the same as the "primary:} specification. eg. \code{"primary_variable = c(\"diagnosis\",\"sex\") must be \"CT_M-ZZ_M\" while "primary_variable = c(\"sex\",\"diagnosis\")" must be \"M_CT-M_ZZ\" (default= NULL)

Value

A named list with "variancePartition::voomWithDreamWeights()" normalized counts, contrasts from "variancePartition::getContrasts()", linear mixed model fits from "variancePartition::dream()", differential expression results from "limma::topTable()" and gene feature-specific metadata, the response variable, the model formula fit to compute differential expression results. The list names are: "list(voom_object, contrasts_to_plot, fits, differential_expression, primary_variable, formula)"