Differential Expression Analysis. Compute gene-level fold changes and (adjusted) p-values between cell clusters of an expression matrix.

dea(
  m,
  group,
  group2 = NULL,
  lfc = log2(2L),
  p = 0.01,
  pmethod = "BH",
  alternative = c("greater", "less", "two-sided"),
  arrange.by = c("lfc", "p", "none"),
  return.val = c("lfc", "df", "gene", "p"),
  center.rows = TRUE,
  center.rows.by.sample = FALSE,
  samples = split_by_sample_names(colnames(m)),
  verbose = FALSE
)

Arguments

m

numeric matrix. The matrix should not contain NA values.

group

the group to be tested. It should be a character vector or a two-level factor in which the first corresponds to the group.

group2

the group to test against. It should be a character vector or a two-level factor in which the first corresponds to the group and the second to group2.

lfc

log2-fold change cutoff; numeric value or NULL. Default: log2(2)

p

(adjusted) p-value cutoff; numeric value between 0 and 1 or NULL. Default: 0.05

pmethod

correction method for multiple testing or 'none' if not desired. See stats::p.adjust.methods for options. Default: 'BH'

arrange.by

arrange genes by decreasing 'lfc', increasing 'p' or 'none. Default: 'lfc'

return.val

'lfc', 'df', 'gene' or 'p'. Default: 'lfc'

center.rows

should the matrix rows be centered around 0? If TRUE and group2 was provided, centering is performed after the matrix has been subset to include only group and group2 columns. Default: TRUE

center.rows.by.sample

center rows within subsets of columns corresponding to samples where list of samples' cell ids are provided in <samples>. If TRUE and group2 was provided, centering is performed before the matrix has been subsetted for group and group2 cells only. Default: FALSE

samples

list of character vectors corresponding to cell ids of the different samples. Not all cells in <m> need be represented in <samples but be aware that missing cell ids will be removed from the matrix.

two.way

should the reverse dea test be performed too? i.e. group becomes group2 and vice versa. Default: FALSE

Value

a numeric vector of gene fold changes or p-values, a character vector of gene names or the full dataframe.