User API#
Import scviva-tools as:
import scviva
Models#
scVIVA: variational auto-encoder with niche decoders for ST:cite:p: |
|
Multi-resolution deconvolution of Spatial Transcriptomics data (DestVI) [Lopez et al., 2022]. |
|
ResolVI addresses noise and bias in single-cell resolved spatial transcriptomics data. |
|
Joint VAE for imputing missing genes in spatial data [Lopez et al., 2019]. |
External models#
Diagonal Multi-Modal Integration Variational Inference (DIAGVI) model. |
|
Reimplementation of Stereoscope for the scRNA-seq component [Andersson et al., 2020]. |
|
Reimplementation of Stereoscope for the spatial component [Andersson et al., 2020]. |
|
Torch reimplementation of Tangram [Biancalani et al., 2021]. |
Tools#
Downstream spatial metabolic cell-cell communication analysis. |
|
Unsupervised transcriptome analysis and gene-signature scoring. |
Analysis accessors#
HarremanAnalysis and VisionAnalysis group lower-level functions under accessors
(ha.hs, ha.vs, ha.tl, ha.pl and va.tl). Each accessor method takes the same
arguments as the function it forwards to, with adata defaulting to the analysis
object’s AnnData.
Hotspot analysis methods accessible as |
|
VISION signature analysis methods accessible as |
|
Tool methods accessible as |
|
Plotting methods accessible as |
|
Lower-level VISION tool functions accessible as |
Harreman functions#
Hotspot (hs)
Compute gene-level spatial autocorrelation using spatial weights and centered expression. |
|
Computes pairwise local correlation between selected genes using a spatial weight matrix. |
|
Perform hierarchical clustering on gene-gene local correlation Z-scores to assign gene modules. |
|
Calculate module scores for gene modules across cells. |
|
Calculate super-module scores for gene super-modules across cells. |
|
Identify the top-scoring module (or super-module) for each cell. |
|
Load the list of metabolic genes for a given species. |
|
Integrate VISION signature scoring with Hotspot module assignments. |
Cell-cell communication tools (tl)
Computes the spatial proximity graph. |
|
Applies multi-step gene filtering to an AnnData object. |
|
Identify biologically plausible gene pairs. |
|
Compute spatially informed cell-type-agnostic CCC scores. |
|
Compute cell type-aware cell-cell communication scores. |
|
Compute interacting cell scores for gene pairs and metabolites. |
|
Compute cell-type-aware interacting cell scores for gene pairs and metabolites. |
|
Select significant gene pairs or metabolite-mediated interactions. |
|
Compute correlations between interacting cell scores and module scores. |
Preprocessing (pp)
Extract the metabolite transporter or ligand-receptor (LR) database from .csv files. |
|
Set up deconvolution AnnData. |
|
Load an AnnData object from disk and restore Harreman-specific metadata. |
|
Save an AnnData object to disk with Harreman-compatible preprocessing. |
Datasets (ds)
Load the mouse colon 10x Visium dataset (Parigi et al.). |
|
Load the human lung Slide-seq dataset (Liu et al.). |
VISION functions#
Results and data containers
Typed view over the |
|
Sparse expression matrix with pre-computed normalisation parameters. |
Preprocessing
Apply one or more gene filters sequentially and return a boolean gene mask. |
|
Select overdispersed genes via within-bin Fano factor filtering. |
|
Remove genes with zero variance across cells. |
|
Keep genes expressed (count > 0) in at least threshold cells. |
|
Log2-transform then normalise X using the chosen method. |
|
Log2-transform then build a sparse-preserving |
|
Sparse-preserving log2(x + 1) transform. |
Latent space and projections
Filter genes, log-transform, and compute PCA; store result in |
|
PCA via randomized truncated SVD with gene-mean centering. |
|
PCA with permutation significance test for automatic PC selection. |
|
ICA 2D projection via sklearn FastICA. |
|
ISOMap 2D projection via sklearn. |
|
RBF-kernel PCA 2D projection. |
|
t-SNE 2D projection via sklearn. |
|
UMAP 2D projection via scanpy. |
|
Generate 2D visualisation projections and store in |
Neighbor graphs
Find K nearest neighbors for every point in data. |
|
Build an exponential-kernel KNN weight matrix from a latent space. |
|
Compute VISION exponential KNN weights and store in |
|
Build exponential-kernel KNN weights from a phylogenetic tree. |
|
Compute tree-based KNN weights and store in |
|
Build LCA-based uniform KNN weights from a phylogenetic tree. |
|
Compute LCA-based tree KNN weights and store in |
Micro-clustering
Partition cells into micro-clusters (supercells) via Louvain + K-means. |
|
Average expression within each micro-cluster via sparse matrix multiply. |
|
Pool |
|
Build a pooled metadata table for micro-clusters. |
|
Pool |
Signatures
Compute signature scores from .gmt/.txt files or dictionaries. |
|
Auto-split bidirectional signatures into |
|
Compute Geary's C spatial/graph autocorrelation for all signatures. |
|
Compute per-cell signature scores. |
|
Compute Geary's C (numerical) / Cramer's V (categorical) for obs metadata. |
Phylogeny
Cluster cells by their position in a phylogenetic tree. |
|
Compute per-cell Fitch-Hartigan parsimony plasticity scores. |
Differential expression
Rank genes for characterizing groups. |
Plotting#
Plot a hierarchical-clustered heatmap of pairwise correlation Z-scores. |
|
Plot the average pairwise correlation Z-scores between modules. |
|
Plot correlations between module scores across cells. |
|
Plot spatial maps of interacting cell scores for selected gene pairs or metabolites. |
|
Plot cell-type–specific interacting cell scores across spatial coordinates. |
|
Plot interaction-module correlation heatmap. |
|
Plot vision autocorrelation results. |
|
Plot vision differential expression results. |
|
Plot signature scores on spatial coordinates for selection. |
|
Plot histogram of signature scores for selection vs remainder. |
|
Plot spatial map of cell type proportion(s). |
|
Plot the results of the niche differential expression analysis. |
|
Plot a histogram of the number of non-zero entries per row of a sparse matrix. |
Settings#
Config manager for scviva. |