Methods Reference¶
All 20 ChatSpatial tools with parameters and options.
Quick Reference¶
Category |
Tools |
|---|---|
Data |
|
Spatial |
|
Cells |
|
Genes |
|
Dynamics |
|
Multi-sample |
|
Output |
|
Data Management¶
load_data¶
Load spatial transcriptomics data.
Parameter |
Type |
Description |
|---|---|---|
|
str |
Path to file or folder |
|
str |
|
|
str |
Optional dataset name |
Supported formats: H5AD, 10X Visium folders, H5, MTX
preprocess_data¶
Normalize, filter, and prepare data.
Parameter |
Default |
Description |
|---|---|---|
|
|
|
|
2000 |
Highly variable genes |
|
30 |
Principal components |
|
15 |
Neighbor graph |
|
1.0 |
Leiden clustering |
|
3 |
Min cells per gene |
|
30 |
Min genes per cell |
|
20.0 |
Max mitochondrial % |
|
False |
Scale to unit variance before PCA |
Advanced options:
Parameter |
Default |
Description |
|---|---|---|
|
False |
Enable doublet detection (for single-cell resolution data) |
|
None |
Target counts per cell (None=median, 1e4=Visium, 1e6=MERFISH) |
|
True |
Exclude mito genes from HVG |
|
|
Batch column for batch-aware normalization |
compute_embeddings¶
Compute dimensionality reduction and clustering.
Parameter |
Default |
Description |
|---|---|---|
|
True |
Compute PCA |
|
True |
Compute UMAP |
|
True |
Leiden clustering |
|
True |
Spatial graph |
|
30 |
Principal components |
|
1.0 |
Clustering resolution |
|
False |
Recompute if exists |
export_data / reload_data¶
Export dataset for external scripts, reload after modifications.
Parameter |
Default |
Description |
|---|---|---|
|
required |
Dataset ID |
|
auto |
Custom path (default: |
Spatial Analysis¶
analyze_spatial_statistics¶
Analyze spatial patterns and autocorrelation.
Parameter |
Default |
Description |
|---|---|---|
|
|
See types below |
|
None |
Required for group-based analyses |
|
None |
Specific genes to analyze |
|
20 |
Top HVGs to analyze (if genes not specified) |
|
8 |
Spatial neighbors |
Analysis types:
Type |
Category |
Requires cluster_key |
|---|---|---|
|
Gene |
No |
|
Gene |
No |
|
Gene |
No |
|
Gene |
No |
|
Gene |
No |
|
Group |
Yes |
|
Group |
Yes |
|
Group |
Yes |
|
Group |
Yes |
|
Network |
Optional |
find_spatial_genes¶
Identify spatially variable genes.
Parameter |
Default |
Description |
|---|---|---|
|
|
|
|
None |
Top genes to return (None = all significant) |
identify_spatial_domains¶
Find tissue domains and spatial niches.
Parameter |
Default |
Description |
|---|---|---|
|
|
|
|
7 |
Expected number of domains |
|
0.5 |
Clustering resolution |
Cell Analysis¶
annotate_cell_types¶
Assign cell types.
Parameter |
Default |
Description |
|---|---|---|
|
|
See methods below |
|
None |
Reference dataset (for transfer methods) |
|
None |
Cell type column in reference |
|
None |
Marker dict (for CellAssign) |
Methods:
Method |
Requires Reference |
Notes |
|---|---|---|
|
Yes |
Spatial mapping |
|
Yes |
Deep learning transfer |
|
No |
Marker-based |
|
No |
Automatic (R) |
|
No |
Reference-based (R) |
|
No |
LLM-based |
deconvolve_data¶
Estimate cell type proportions per spot.
Parameter |
Default |
Description |
|---|---|---|
|
|
See methods below |
|
required |
Reference dataset |
|
required |
Cell type column in reference |
Methods:
Method |
Speed |
GPU |
Notes |
|---|---|---|---|
|
Fast |
No |
Default, recommended |
|
Slow |
Yes |
High accuracy |
|
Fast |
No |
R-based |
|
Medium |
Yes |
scvi-tools |
|
Slow |
Yes |
Alternative DL |
|
Medium |
Yes |
Spatial mapping |
|
Fast |
No |
R-based |
|
Fast |
No |
R-based, imputation |
analyze_cell_communication¶
Analyze ligand-receptor interactions.
Parameter |
Default |
Description |
|---|---|---|
|
|
|
|
required |
|
|
required |
Cell type column |
|
|
LR database ( |
Gene Analysis¶
find_markers¶
Find differentially expressed genes.
Parameter |
Default |
Description |
|---|---|---|
|
required |
Grouping column |
|
None |
First group (None = each vs rest) |
|
None |
Second group |
|
|
|
|
50 |
Top genes per group |
compare_conditions¶
Compare experimental conditions (pseudobulk DESeq2).
Parameter |
Default |
Description |
|---|---|---|
|
required |
Condition column |
|
required |
Treatment group |
|
required |
Control group |
|
required |
Sample/patient column |
|
None |
Stratify by cell type |
|
50 |
Top DEGs |
analyze_enrichment¶
Gene set enrichment analysis.
Parameter |
Default |
Description |
|---|---|---|
|
required |
|
|
|
|
|
|
See databases below |
Databases: GO_Biological_Process, GO_Molecular_Function, KEGG_Pathways, Reactome_Pathways, MSigDB_Hallmark
Dynamics¶
analyze_velocity_data¶
RNA velocity analysis.
Parameter |
Default |
Description |
|---|---|---|
|
|
|
|
|
|
Requires: spliced and unspliced layers
analyze_trajectory_data¶
Trajectory and pseudotime inference.
Parameter |
Default |
Description |
|---|---|---|
|
|
|
|
None |
Starting cells |
Note: CellRank requires velocity data
analyze_cnv¶
Copy number variation detection.
Parameter |
Default |
Description |
|---|---|---|
|
|
|
|
required |
Cell type column |
|
required |
Normal cell types |
Multi-Sample¶
integrate_samples¶
Batch integration.
Parameter |
Default |
Description |
|---|---|---|
|
required |
List of dataset IDs |
|
|
|
|
|
Batch column |
register_spatial_data¶
Align spatial sections.
Parameter |
Default |
Description |
|---|---|---|
|
required |
Source dataset |
|
required |
Target dataset |
|
|
|
Visualization¶
visualize_data¶
Create all plot types.
Parameter |
Default |
Description |
|---|---|---|
|
|
See types below |
|
None |
Visualization variant |
|
None |
Gene(s) or column to show |
|
|
|
|
None |
Grouping column |
|
|
Color scheme |
|
300 |
Resolution |
|
|
|
Plot types and subtypes:
Type |
Subtypes |
Use |
|---|---|---|
|
— |
Gene/metadata on spatial or UMAP |
|
|
Aggregated expression |
|
|
Cell proportions |
|
|
LR interactions |
|
— |
Spatial LR pairs |
|
|
Pseudotime |
|
|
RNA velocity |
|
|
Spatial stats |
|
|
Pathway results |
|
|
CNV results |
|
|
Integration QC |
GPU Acceleration¶
Set use_gpu=True for these methods:
Category |
Methods |
|---|---|
Preprocessing |
scVI normalization |
Annotation |
Tangram, scANVI |
Deconvolution |
Cell2location, DestVI, Stereoscope, Tangram |
Domains |
STAGATE, GraphST |
Velocity |
VeloVI |
Integration |
scVI |
CNV |
inferCNVpy |
Next Steps¶
Examples — See methods in action
Concepts — When to use which method
Troubleshooting — Common issues and fixes