API Reference#
Import scATrans as:
import scatrans as scat
Submodules scat.pl (plotting) and scat.qc (quality control) are
intentionally exposed (scanpy-style convention). Other internal modules are
not part of the stable public surface. Functions are grouped by task below;
each group lists its key tunable parameters before the full autosummary
table. See User Guide for narrative usage and
Statistical Guidance & Reporting Checklist for what each result column means.
Core: scoring, filtering, DE#
active_score is the main velocity-aware entry point; differential_expression
is the no-velocity equivalent. Both return the same kind of results table and
feed into the same filter_active_genes / enrichment / plotting tools.
Parameter |
Applies to |
Default |
Options |
|---|---|---|---|
|
both |
|
any |
|
both |
|
must be set explicitly to two values in |
|
both |
|
aggregate to per-replicate pseudobulk before DE (needs |
|
both |
|
|
|
both |
|
any |
|
both |
|
cell-level LMM with sample random intercept; needs ≥4 samples/group |
|
|
|
method-of-moments cell-level DE (raw integer counts required) |
|
|
|
permutation FDR on unspliced excess; |
|
|
|
|
|
|
|
|
|
|
|
|
Always call recommend_workflow(...) (or let active_score_simple /
run_default_pipeline call it for you) before picking these by hand — it
inspects cell/sample counts and suggests a preset.
Identify genes showing higher unspliced (nascent) RNA in the target group relative to reference (positive unspliced excess after reference-gamma correction), combined with upregulation (positive logFC). |
|
Recommended entry point for new users (minimal parameters). |
|
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). |
|
Minimal-parameter differential expression (no velocity layers required). |
|
Analyze the experimental design and provide guidance on suitable analysis choices and expected power/limitations. |
|
High-level recommendation for analysis path based on experimental design. |
|
End-to-end recommended workflow for first-time users. |
|
Apply custom post-filtering to a results DataFrame (from active_score or differential_expression). |
|
Store raw counts and the original spliced/unspliced (or mature/nascent) layers early in the analysis, right after loading and basic QC, but BEFORE HVG selection, normalization, or log1p. |
|
Ensure raw integer counts are available in |
|
Restore raw counts from the stored layer (preferred) or adata.raw back into .X. |
filter_active_genes(results_df, preset=..., logfc_direction=..., return_mask=...)
takes preset="heuristic" (default cutoffs), "pseudobulk" (looser,
post-aggregation), "significant" (replays the built-in strict mask; requires
use_permutation=True upstream), or "permissive"; or pass explicit
*_cutoff kwargs instead of a preset.
Gene features#
Used for optional bias correction inside active_score (length + intron
count regressed out of the raw unspliced-excess delta).
WORKFLOW_PRESETS is a public constant dict (keys such as "explore",
"pseudobulk", "memento") returned by recommend_workflow() and accepted
by active_score_simple / run_default_pipeline. It is not autosummary’d
here because it is data, not a callable.
The generate-gene-features console script maps to
scat.generate_gene_features_main (importable from the top-level package);
programmatic use is via generate_gene_features_from_gtf() below.
Parameter |
Function |
Notes |
|---|---|---|
|
|
|
|
|
supply your own parquet instead of the bundled table |
|
|
build a custom table from a 10x/GENCODE GTF ( |
Add gene features (length, intron number) to adata.var for bias correction. |
|
Generate a gene features parquet (gene_length + intron_number) from a GTF. |
|
List all available gene feature parquet files shipped with the package. |
Functional enrichment#
All ORA-style functions (run_enrichment, run_kegg, run_go) share the
same universe-handling and gene-set-resolution machinery; run_gsea takes a
ranked list instead of a candidate gene list.
Parameter |
Applies to |
Default |
Options |
|---|---|---|---|
|
|
— |
base name (e.g. |
|
all ORA/GSEA functions |
— |
|
|
all ORA/GSEA functions |
|
pass the object you called |
|
all ORA/GSEA functions |
auto-detected |
|
|
|
|
|
|
|
|
|
Hypergeometric over-representation analysis (clusterProfiler-style ORA). |
|
KEGG pathway enrichment (wrapper around run_enrichment). |
|
GO enrichment (BP / CC / MF) wrapper around run_enrichment. |
|
Pre-ranked Gene Set Enrichment Analysis (GSEA) using gseapy.prerank. |
|
Redundancy reduction for enrichment results. |
|
Save enrichment results in formats friendly for manuscripts and supplementary materials. |
|
Expand semicolon-joined Genes column into a long term-gene table. |
|
List gene set files (.gmt and similar) that are bundled inside the package under scatrans/data/. |
|
Run enrichment analysis across multiple named groups/clusters/contrasts (clusterProfiler::compareCluster style). |
|
Extract named gene lists from one or more DE result DataFrames for downstream enrichment. |
|
Combine already-computed per-group enrichment results into a compare-style DataFrame. |
Quality control (scat.qc)#
Calculate the global fraction of unspliced reads across all cells. |
Plotting (scat.pl)#
Every scat.pl.* function accepts ax=/axes= (multi-panel embedding),
save_path= (vector/300 dpi export), show=, and use_style=; most return
(fig, ax).
Parameter |
Applies to |
Notes |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
control auto-labeling; |
|
all |
opt-in publication style (off by default so notebooks are not surprised by global |
Comet plot of log fold change vs. bias-corrected unspliced residual. |
|
2D volcano plot with ggVolcano-inspired flexibility and style options. |
|
3D volcano-style view (logFC, -log10(p_adj), velocity residual). |
|
Diagnostic plot showing the effect of gene length / intron number bias correction on velocity delta (before vs after). |
|
Dotplot for enrichment results (clusterProfiler style). |
|
Barplot wrapper around the dotplot implementation (for API compatibility). |
|
UpSet-style plot for term overlap across clusters/groups (compareCluster style). |
|
Simple multi-group Venn diagram for significant enriched terms across clusters. |
|
Classic GSEA plot: running enrichment score (RES) curve + hits + ranked list. |
|
Horizontal ranked barplot of top active scores (publication-friendly). |
|
Convenience wrapper around scanpy heatmap for the active driver genes. |
|
Quick diagnostic grid of unspliced vs spliced (phase-portrait style) for selected genes. |
|
Visualize per-gene shrinkage strength vs expression depth (empirical Bayes gamma). |
|
Apply a clean, minimal style suitable for scientific publication figures. |
|
Legacy alias for set_style() kept for backward compatibility. |
|
Context manager for temporary style application. |
|
Context manager for batch-saving figures in multi-panel workflows. |
|
Batch-save a mapping of |