msmu.tl.run_de
Run Differential Expression Analysis (DEA) between two groups in a MuData object.
The analysis reads as four stages: (1) data validation — prepare the inputs once and let the engine mask the usable features; (2) test — the engine-specific statistic; (3) fold change — engine-independent group centres and the log2 fold change; (4) fold-change guidance line.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mdata
|
MuData
|
MuData object containing the data. |
required |
modality
|
str
|
Modality name within the MuData to analyze. |
required |
category
|
str
|
Observation category to define groups. |
required |
ctrl
|
str
|
Name of the control group. |
required |
expr
|
str | None
|
Name of the experimental group. If None, all other groups are used (not supported for stat_method="limma", which needs an explicit group). |
None
|
layer
|
str | None
|
Layer to use for quantification aggregation. If None, the default layer (.X) will be used. Defaults to None. |
None
|
min_pct
|
float
|
Minimum non-missing coverage required in every group (design cell), not in at
least one, applied as a count: a feature needs |
0.0
|
stat_method
|
Literal['welch', 'student', 'wilcoxon', 'limma']
|
Statistical test to use. Defaults to "limma" (empirical-Bayes moderated-t, recommended for the small sample sizes where a permutation null is degenerate). The permutation engines "welch"/"student"/"wilcoxon" always run a label-permutation test. The fold-change central tendency follows the test: welch/student/limma are mean-based, wilcoxon median-based (so significance and effect size stay on the same scale). For wilcoxon the fold change is the median difference, a pragmatic proxy for the Hodges-Lehmann shift the rank-sum statistic localizes. |
'limma'
|
n_resamples
|
int
|
Number of label permutations for the permutation engines (welch/student/ wilcoxon); must be a positive integer (e.g. 1000). Ignored by limma (which does not permute). It is not an on/off switch — for a parametric analysis use stat_method="limma". |
1000
|
log_transformed
|
bool
|
If True, data is assumed to be log-transformed. Defaults to True. |
True
|
interaction
|
str | None
|
limma only — obs column of a second factor. If set, tests the
interaction (difference-in-differences) of |
None
|
interaction_levels
|
list | None
|
limma only — the two |
None
|
covariates
|
list[str] | None
|
limma only — obs columns to adjust for. |
None
|
p_adjust
|
str
|
Multiple-testing correction for the q-value. Default |
'auto'
|
_force_resample
|
bool
|
If True, forces resampling even if the number of resamples exceeds the number of combinations. |
False
|
Returns:
| Type | Description |
|---|---|
DeaResult
|
DeaResult containing DE analysis results. |