Grade-of-membership differential expression with fixed memberships
Source:R/gom-de.R
test_gom_de.RdFind 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.
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"ofcounts. 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();ncis 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.
References
https://github.com/stephenslab/fastTopics; https://stephenslab.github.io/fastTopics/reference/de_analysis.html
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)
} # }