This skill loads spatial transcriptomics data from imaging/in-situ platforms (Xenium, MERSCOPE/MERFISH, CosMx) and sequencing/capture platforms (Visium, Visium HD, Slide-seq/Curio, Stereo-seq) into AnnData or SpatialData objects. It centers on the I/O decision that governs everything downstream: imaging platforms emit two distinct primary objects -- a per-transcript molecule table (the re-segmentable source of truth) and a segmentation-derived per-cell matrix (quality-filtered, inherits all segmentation error) -- while capture platforms emit only a spot/bin matrix with no molecule table. It also covers picking the right reader per platform and keeping coordinate frames (pixel vs micron) registered to histology.
pip install spatialdata spatialdata-io squidpy scanpy anndata
Tell your AI agent what you want to do:
"Load my 10X Visium Space Ranger output and tell me whether the coordinates are in pixels or microns."
"Read my Visium HD bundle at the 8 micron bin and remind me whether bins are single cells."
"Load my Slide-seq / Curio beads; do they have a transcript molecule table?"
"Load my Xenium experiment as a SpatialData object and give me both the molecule table and the cell matrix."
"Read my MERSCOPE output -- I want the per-transcript detections, not just the cell-by-gene matrix."
"Import my CosMx data and check whether a transcript file is present."
"Is the Xenium cell-by-gene matrix the same quality filter as the transcript table?"
"I have Visium spots -- where is the molecule table?"
spatialdata_io.{xenium, merscope, cosmx, visium, visium_hd, curio, stereoseq} or squidpy.read.{visium, vizgen, nanostring}), avoiding the deprecated scanpy.read_visium.squidpy.read provides only visium, vizgen, and nanostring. For Xenium, Slide-seq/Curio, Stereo-seq, and Visium HD, use spatialdata_io.merfish reader -- spatialdata_io.merscope handles MERFISH and MERSCOPE both.tissue_positions.csv gained a header at Space Ranger v2.0 (readers handle both).obsm['spatial'] units are not universal: Visium stores full-res pixels (scale with tissue_hires_scalef), most imaging readers place a micron "global" frame. Check before building a neighbor graph or overlaying transcripts..zarr store is a DIRECTORY -- write it to a scratch path and rm -rf it; never commit it.