Before using code patterns, verify installed versions match. If versions differ:
Python: pip show <package> then help(module.function) to check signatures
If code throws ImportError, AttributeError, or TypeError, introspect the installed
package and adapt the example to match the actual API rather than retrying.
Spatial Multi-omics Analysis
"Analyze my high-resolution spatial data" → Process subcellular-resolution spatial platforms (Xenium, MERFISH, Slide-seq, Stereo-seq) including cell segmentation, binning strategies, and multi-modal integration.
Python: spatialdata + squidpy for unified multi-platform analysis
Platform Comparison
Platform
Resolution
Spots/Beads
Coverage
Visium
55 µm
~5,000
Tissue-wide
Visium HD
2 µm
~11M
Subcellular
Slide-seq
10 µm
~100,000
High-density
Stereo-seq
0.5 µm
>200M
Subcellular
MERFISH
Single-molecule
N/A
Targeted genes
Squidpy for High-Resolution Data
Goal: Run standard spatial analyses (autocorrelation, neighborhood enrichment, ligand-receptor) on high-resolution spatial data.
Approach: Adjust neighbor graph density for high-resolution platforms, then apply standard Squidpy workflows.
Goal: Combine spatial gene expression with histological image features for integrated analysis.
Approach: Process and segment tissue images, extract image features, then correlate with gene expression.
# Combine spatial transcriptomics with histology
sq.im.process(adata, layer='image', method='smooth', sigma=2)
sq.im.segment(adata, layer='image', method='watershed', thresh=0.1)
# Extract image features
sq.im.calculate_image_features(
adata, layer='image', features=['texture', 'summary'],
key_added='img_features', n_jobs=4
)
# Correlate image features with gene expression
from scipy.stats import pearsonr
for gene in ['marker1', 'marker2']:
r, p = pearsonr(adata.obs['img_feature'], adata[:, gene].X.flatten())
print(f'{gene}: r={r:.3f}, p={p:.3e}')
Visium HD Specific
# Visium HD produces bin files at multiple resolutions
# Load 8µm binned data (recommended starting point)
adata = sc.read_h5ad('visium_hd_8um.h5ad')
# Downsample to 16µm if needed for initial analysis
# Original 2µm data available for detailed analysis
Quality Metrics
Metric
Visium
High-Resolution
Genes/spot
>2000
>500
UMI/spot
>5000
>1000
Spatial coverage
>80%
>50%
Related Skills
spatial-transcriptomics/spatial-preprocessing - Standard spatial analysis