API
Import Squidpy as:
import squidpy as sq
Graph
|
Create a graph from spatial coordinates. |
|
Create a graph from spatial coordinates using an explicit builder instance. |
|
Create a k-nearest-neighbor graph from spatial coordinates. |
|
Create a radius-based graph from spatial coordinates. |
|
Create a Delaunay triangulation graph from spatial coordinates. |
|
Create a grid-based graph from spatial coordinates. |
Type variable. |
|
|
Result of spatial_neighbors function. |
|
Mask the graph based on a polygon mask. |
|
Compute neighborhood enrichment by permutation test. |
|
Result of nhood_enrichment function. |
|
Compute co-occurrence probability of clusters. |
|
Compute centrality scores per cluster or cell type. |
|
Compute interaction matrix for clusters. |
|
Calculate various Ripley's statistics for point processes. |
|
Perform the permutation test as described in [Efremova et al., 2020]. |
|
Calculate Global Autocorrelation Statistic (Moran’s I or Geary's C). |
|
Identify spatially variable genes with Sepal. |
|
Calculate niches (spatial clusters) based on a user-defined method in 'flavor'. |
|
Compute spatial niches from local cell-type composition. |
|
Compute spatial niches from UTAG-style feature aggregation. |
|
Compute spatial niches using a CellCharter-style embedding and GMM [Varrone et al., 2023]. |
|
Compute niche assignments using the SpatialLeiden algorithm. |
Image
|
Process an image by applying a transformation. |
|
Segment an image. |
|
Calculate image features for all observations in |
|
Base class for all segmentation models. |
Plotting
|
Plot spatial omics data with data overlayed on top. |
|
Plot spatial omics data with segmentation masks on top. |
|
Plot neighborhood enrichment. |
|
Dot plot of neighborhood enrichment. |
|
Plot centrality scores. |
|
Plot cluster interaction matrix. |
|
Plot the result of a receptor-ligand permutation test. |
|
Plot Ripley's statistics for each cluster. |
|
Plot co-occurrence probability ratio for each cluster. |
|
Create a temporary |
|
Plot a variable using a smooth regression line with increasing distance to an anchor point. |
Reading
|
Read 10x Genomics Visium formatted dataset. |
|
Read Vizgen formatted dataset. |
|
Read Nanostring formatted dataset. |
Tools
|
Divide a tissue slice into regulary shaped spatially contiguous regions (windows). |
|
Build a design matrix consisting of distance measurements to selected anchor point(s) for each observation. |
Datasets
|
Pre-processed subset 4i dataset from Gut et al. |
|
Pre-processed subset IMC dataset from Jackson et al. |
|
Pre-processed subset seqFISH dataset from Lohoff et al. |
|
Pre-processed MERFISH dataset from Moffitt et al. |
|
Pre-processed MIBI-TOF dataset from Hartmann et al. |
|
Pre-processed SlideseqV2 dataset from Stickles et al. |
|
Pre-processed scRNA-seq mouse cortex. |
|
Download Visium datasets from 10x Genomics. |
|
Pre-processed 10x Genomics Visium H&E dataset. |
|
Pre-processed subset 10x Genomics Visium H&E dataset. |
|
Pre-processed 10x Genomics Visium Fluorescent dataset. |
|
Pre-processed subset 10x Genomics Visium Fluorescent dataset. |
|
H&E image from 10x Genomics Visium dataset. |
|
Cropped H&E image from 10x Genomics Visium dataset. |
|
Cropped Fluorescent image from 10x Genomics Visium dataset. |
Extensibility
See the extensibility guide for how to implement a custom graph builder.
|
Base class for spatial graph construction strategies. |
|
CSR-based graph construction strategy. |
Type variable. |
|
|
|
|
|
|
Build a generic k-nearest-neighbor spatial graph. |
|
Build a generic radius-based spatial graph. |
|
Build a generic point-cloud graph from a Delaunay triangulation. |
|
Build a grid-based spatial graph. |
Experimental
Calculate per-cell features from segmentation masks. |
|
|
Score cells for tile-boundary segmentation artifacts. |
|
Assign tile-cut cell pieces to stitch groups. |
|
Materialise a stitched labels element from an assign_stitch_groups result. |
|
Plot labels coloured by their tiling-artifact score. |
|
Fit a stain reference from an image in a |
|
Estimate the white point |
|
A fitted stain reference. |
Types
The public parameter bags, all TypedDicts: pass a plain dict literal or build one with the class. Every key is optional and falls back to the default shown with
it.
Parameter types and their defaults.
- class squidpy.types.FelzenszwalbParams[source]
Size-aware superpixel defaults for felzenszwalb segmentation.
A
TypedDict: pass a plaindictwith any subset of these keys.
- class squidpy.types.MacenkoParams[source]
Tuning knobs for Macenko stain-matrix fitting.
A
TypedDict: pass a plaindictwith any subset of these keys.
- class squidpy.types.ReinhardParams[source]
Tuning knobs for Reinhard stain normalization.
A
TypedDict: pass a plaindictwith any subset of these keys.
- class squidpy.types.VahadaneParams[source]
Tuning knobs for Vahadane (sparse-NMF) stain-matrix fitting.
A
TypedDict: pass a plaindictwith any subset of these keys.- rng: int | integer | Sequence[int] | SeedSequence | Generator | BitGenerator | None
Source of randomness for NMF initialisation tie-breaking;
Nonedraws from OS entropy.Default:
None
- class squidpy.types.WekaParams[source]
Parameters for WEKA-like trainable segmentation.
A
TypedDict: pass a plaindictwith any subset of these keys.- refine_bg_prob_threshold: float
Only drop pixels whose background probability exceeds this.
Default:
0.6
- refine_n_samples_per_class: int
Training samples drawn per class in the refinement step.
Default:
50000
- rng: int | integer | Sequence[int] | SeedSequence | Generator | BitGenerator | None
Source of randomness;
Nonedraws from OS entropy.Default:
None