Skip to contents

Find genes whose expression differs between topics or programs, given count data and memberships that sum to one per sample. Needs the optional fastTopics package. Delegates to fastTopics::de_analysis(), which fits one Poisson model per feature with the supplied memberships held fixed, then summarizes log2 fold changes by MCMC. Counts and memberships are validated before the native call; nothing is normalized here.

Usage

test_gom_de(
  counts,
  memberships,
  sample_side,
  seed,
  shrink_method = c("ash", "none"),
  lfc_stat = "le",
  pseudocount = 0.01,
  fit_method = "scd",
  control = list(),
  keep_native = FALSE
)

Arguments

counts

Named count matrix or double sparse Matrix: finite, nonnegative, integer-valued, with a positive library size for every sample.

memberships

Named numeric matrix of topic or program memberships for the same samples: finite, nonnegative, at least two columns, and every row summing to one within 1e-8. EBMF activities are not memberships; normalize them yourself only if that is scientifically justified.

sample_side

"rows" or "columns" of counts. Memberships always have samples in rows.

seed

Nonnegative integer. Required; the MCMC uses R's random numbers. The caller's random number state is restored afterwards.

shrink_method

"ash" (default) or "none", as in the native function.

lfc_stat

"le" (least-extreme, default), "vsnull", or one membership column name, as in the native function.

pseudocount

Positive pseudocount added before log fold changes (native default).

fit_method

Native Poisson fitting method, e.g. "scd" (native default).

control

Named native control settings from fastTopics::de_analysis_control_default(); nc is fixed at 1.

keep_native

Retain the native result (default FALSE).

Value

A list with a long $statistics table (feature, factor, log2_fc, lower, upper, z, neg_log10_p, lfsr, svalue), $analysis_metadata, and the $native result when requested.

Details

Statistics are conditional on the fixed memberships, so membership uncertainty is ignored. lower/upper are highest-posterior-density intervals at control$conf.level (native default 0.68), not 95% equal-tail intervals. With ash shrinkage neg_log10_p is unavailable; without it lfsr and svalue are unavailable. Native MCMC warnings, such as zero acceptance rates, are kept in analysis_metadata$warnings. No calibration claim is made for small inputs.

See also

factor_features() for descriptive rankings without count data

Author

Mikhael Manurung (adapter). fastTopics: Peter Carbonetto, Kevin Luo, Kushal Dey and Matthew Stephens, with contributors listed in its DESCRIPTION. No engine source is copied.

Examples

if (FALSE) { # \dontrun{
de <- test_gom_de(counts, memberships, "rows", seed = 1)
subset(de$statistics, lfsr < 0.01)
} # }