API reference#
The public API is grouped by analysis stage. Import functions through
sctk.pp, sctk.tl, sctk.pl, or sctk.r; modules beginning with an
underscore are implementation details and may change.
Preprocessing: sctk.pp#
Function |
Purpose |
|---|---|
|
Annotate mitochondrial genes and calculate standard Scanpy QC columns. |
|
Detect robust MAD-based outliers, optionally within batches or samples. |
|
Build and record a reviewable cell-level QC decision. |
|
Apply QC criteria and return or write the filtered AnnData object. |
|
Normalize and log-transform a source layer into a named output layer. |
|
Run selectable normalization, HVG, scaling, PCA, graph, UMAP, and Leiden stages. |
|
Return packaged human or mouse cell-cycle genes. |
|
Add Scanpy S/G2M scores using a selected expression layer. |
|
Calculate Leiden labels over a resolution grid. |
|
Compare stored clusterings using silhouette scores. |
|
Correct a PCA representation with Harmony. |
|
Train scVI from raw counts and store its latent representation. |
Analysis: sctk.tl#
Function |
Purpose |
|---|---|
|
Intersect a marker dictionary with genes present in AnnData. |
|
Calculate mean-expression or Scanpy gene-set scores. |
|
Produce provisional labels from marker-set scores and an ambiguity margin. |
|
Convert Scanpy ranked-gene results to a tidy table. |
|
Convert ranked-gene results to a group-to-markers mapping. |
|
Calculate group-level mean expression. |
|
Summarize detection rate and expression for one gene by group. |
|
Split cells by detection, median, quantile, Otsu, or GMM threshold. |
|
Label low/high expression tails while leaving middle cells unassigned. |
|
Split sample-level fractions using median, quantile, tertile, or a fixed threshold. |
|
Sum raw counts per biological sample and optional cell group. |
|
Summarize library size, detected genes, cells, and condition replication. |
|
Run a validated PyDESeq2 contrast on pseudobulk counts. |
|
Read a GMT file into a long gene-set network. |
|
Standardize network columns to |
|
Fetch and cache a decoupler/OmniPath resource. |
|
Resolve the local resource cache file. |
|
Run offline hypergeometric over-representation analysis. |
|
Run preranked GSEA for one ranking. |
|
Measure batch mixing and biological-label separation in a representation. |
|
Run LIANA cell–cell communication inference. |
|
Filter, rank, and aggregate LIANA interaction results. |
Plotting: sctk.pl#
Function |
Purpose |
|---|---|
|
Call Scanpy embedding plotting with project defaults. |
|
Plot grouped expression through Scanpy. |
|
Plot category composition within samples or groups. |
|
Plot tidy or AnnData-derived values. |
|
Plot differential-expression effect size and significance. |
|
Plot long enrichment result tables. |
|
Access built-in categorical palettes. |
|
Store or retrieve AnnData category colors. |
Most plotting functions return a Matplotlib axes object. Pass ax= to compose
multi-panel figures and save through its figure:
ax = sctk.pl.volcano(de)
ax.figure.savefig("volcano.pdf", bbox_inches="tight")
Optional R-backed API: sctk.r#
Function |
Purpose |
|---|---|
|
Run scDblFinder and write score/class annotations. |
|
Correct a filtered matrix using SoupX and a raw-droplet matrix. |
|
Run limma-voom, optionally with repeated-sample blocking. |
|
Fail early with the name of a missing R package. |
R and optional Python dependencies are loaded only when the corresponding function is called. See R Environment Guide for setup and validation.
Stability conventions#
Public imports listed above are the supported notebook interface.
Functions generally return result objects; mutation is documented through
inplace,copy, orkey_added.Count-based methods validate integer-like, non-negative input instead of silently rounding normalized values.
Representation keys follow AnnData conventions such as
X_pca_harmonyin.obsmand neighbor graphs in.obsp/.uns.