← Về thư mục
📄 / / profiles / r-and-d / raw_evidence / OpenAI4S / skills / bioskills / bio-spatial-transcriptomics-spatial-data-io / references / usage-guide.md

Spatial Data I/O - Usage Guide

Overview

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.

Prerequisites

pip install spatialdata spatialdata-io squidpy scanpy anndata

Quick Start

Tell your AI agent what you want to do:

Example Prompts

Sequencing / capture platforms

"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?"

Imaging / in-situ platforms

"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."

Reasoning about objects

"Is the Xenium cell-by-gene matrix the same quality filter as the transcript table?"

"I have Visium spots -- where is the molecule table?"

What the Agent Will Do

  1. Determine the platform class (imaging/in-situ vs sequencing/capture), which decides what objects exist and whether a molecule table is present.
  2. Select the matching reader (spatialdata_io.{xenium, merscope, cosmx, visium, visium_hd, curio, stereoseq} or squidpy.read.{visium, vizgen, nanostring}), avoiding the deprecated scanpy.read_visium.
  3. Load into SpatialData (imaging, to retain the molecule table, shapes, and images) or AnnData (spot matrices), and report element names.
  4. Distinguish the per-transcript molecule table from the segmentation-derived, quality-filtered cell matrix, flagging the matrix as provisional.
  5. Confirm the coordinate frame and units before any graph-building or histology overlay.

Tips