scatrans.differential_expression#
- scatrans.differential_expression(adata_input, groupby='condition', target_group=None, reference_group=None, subset_col=None, subset_values=None, de_method='t-test_overestim_var', pseudobulk_de_backend='pydeseq2', pydeseq2_min_counts=10, use_pseudobulk=False, sample_col=None, min_cells=10, min_counts=1000, pb_x_layer='X', pb_use_total_for_x=True, de_preprocess='auto', min_total_counts=50, strict_pydeseq2_counts=True, use_mixed_model=False, use_delta_variance_pval=False, delta_var_pval_cutoff=0.05, mixed_model_pval='wald', paired_replicates=False, use_memento_de=False, memento_capture_rate=0.07, memento_num_boot=5000, memento_n_cpus=-1, n_jobs=-1, gene_type_filter=None, counts=None, copy_input=True)[source]#
Standalone differential expression (DE) using the same flexible backends as scATrans (scanpy methods, PyDESeq2 pseudobulk, mixed linear models, and Memento – the Cell 2024 method-of-moments framework).
This function does not require spliced/unspliced (velocity) layers. It is intended for users who want high-quality DE (especially via Memento), followed by scATrans’ downstream tools:
candidates = scat.filter_active_genes(de_results, pval_cutoff=0.05, logfc_cutoff=0.3) # upregulated # down or both directions: # down_cands = scat.filter_active_genes(de_results, pval_cutoff=0.05, logfc_cutoff=0.3, logfc_direction=”down”) # For enrichment, pass adata= (if store_raw_counts was used) so it uses # the preserved full measured gene set as universe, not just current HVGs. enrich = scat.run_enrichment(candidates.index.tolist(), …, adata=adata) scat.pl.volcano_plot(de_results, …) scat.pl.enrich_dotplot(enrich, …)
All DE-related options from active_score are supported here (pseudobulk, mixed models, Memento, etc.), except permutation-based FDR (use
active_score(..., use_permutation=True)when velocity layers are available). For a minimal-parameter entry point seeactive_score_simpleorrun_default_pipeline.- copy_inputbool, default True
Same semantics as
active_score(): one combined obs-filter copy when True; zeroAnnData.copy()calls when False and no obs filtering is needed.
- Returns:
results_df is sorted by p_adj (ascending; most significant first) and contains at minimum: logFC, p_val, p_adj, and (when use_memento_de) the native memento_de_* / memento_dv_* columns.
adata.var is updated with the same columns for convenience.
Metadata is stored under adata.uns[“scatrans”].
- Return type:
(adata_with_results, results_df)
- Parameters:
adata_input (Any)
groupby (str)
target_group (str | None)
reference_group (str | None)
subset_col (str | None)
de_method (str)
pseudobulk_de_backend (str)
pydeseq2_min_counts (int)
use_pseudobulk (bool)
sample_col (str | None)
min_cells (int)
min_counts (int)
pb_x_layer (str)
pb_use_total_for_x (bool)
de_preprocess (str)
min_total_counts (int)
strict_pydeseq2_counts (bool)
use_mixed_model (bool)
use_delta_variance_pval (bool)
delta_var_pval_cutoff (float)
mixed_model_pval (str)
paired_replicates (bool)
use_memento_de (bool)
memento_capture_rate (float)
memento_num_boot (int)
memento_n_cpus (int)
n_jobs (int)
gene_type_filter (str | None)
counts (str | ndarray | spmatrix | DataFrame | AnnData | None)
copy_input (bool)