Spatial transcriptomics adds a crucial dimension to single-cell analysis: location. Hereβs how to get started.
What is Spatial Transcriptomics?
Unlike scRNA-seq, spatial methods preserve tissue architecture. You can see:
β Where cells are located
β How they interact with neighbors
β Tissue-level organization
The Basic Workflow
1. Load Your Data
import scanpy as sc
import squidpy as sq
adata = sq.read.visium('path/to/data/')
2. Quality Control
sc.pp.calculate_qc_metrics(adata, inplace=True)
sc.pl.spatial(adata, color='total_counts')
3. Preprocessing
Same as scRNA-seq:
sc.pp.normalize_total(adata)
sc.pp.log1p(adata)
sc.pp.highly_variable_genes(adata)
4. Spatial Analysis
This is where it gets interesting:
# Neighborhood enrichment
sq.gr.spatial_neighbors(adata)
sq.gr.nhood_enrichment(adata, cluster_key='cluster')
# Spatial autocorrelation
sq.gr.spatial_autocorr(adata, genes=['gene1', 'gene2'])
Key Concepts
β Neighborhood enrichment β Which cell types cluster together?
β Spatial autocorrelation β Is gene expression spatially organized?
β Ligand-receptor analysis β Cell-cell communication in space
Spatial transcriptomics is the future. Have you tried it? Share your experience in the comments!
Comments
Leave a comment using your GitHub account. Your feedback is appreciated!