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

Spatial Domain Detection - Usage Guide

Overview

This skill identifies spatial domains -- contiguous tissue regions of homogeneous expression such as cortical layers, tumor core, or stromal bands -- by combining transcriptional similarity with spatial proximity. It draws the line between a domain (a region containing many cell types), a cell type (one cell's identity), and a niche (the local cell-type composition), then guides choosing a domain method by tissue geometry, tuning the spatial-weight knob to avoid over-smoothing, and choosing the number of domains k as a biological decision.

Prerequisites

pip install squidpy scanpy scikit-learn
# optional domain methods:
pip install banksy_py            # neighbor-augmented features
pip install STAGATE_pyG          # graph attention autoencoder (or the TF build)
# BayesSpace / BASS / Banksy are R/Bioconductor:
# BiocManager::install(c('BayesSpace', 'Banksy'))

Quick Start

Tell your AI agent what you want to do: - "Identify spatial domains in my Visium section" - "Segment my tissue into regions, not cell types" - "My domains came out as smooth blobs -- fix the over-smoothing" - "Pick the number of domains and show me the k+-1 sensitivity"

Example Prompts

Domain vs Niche vs Cell Type

"Is this a domain question or a niche question? I want to know which tissue region each spot belongs to."

"Separate the cortical layers in my DLPFC section into spatially coherent regions."

Method Choice by Geometry

"Which domain method fits continuous laminar cortex versus a high-resolution Xenium tumor section?"

"My tumor nests are scattered, not contiguous -- which method or parameter handles non-contiguous domains?"

Tuning the Spatial-Weight Knob

"My domains are salt-and-pepper -- raise the spatial weight."

"My regions merged into blobs and the boundaries disappeared -- lower the over-smoothing."

"Sweep the BANKSY lambda and show me where the boundaries are sharpest."

Choosing k

"Set the number of domains for my section and report sensitivity to k plus or minus one."

"Run BayesSpace with q=7 for cortex and import the labels."

What the Agent Will Do

  1. Establish whether the question is a domain (region), a niche (co-occurring types), or a cell type, and route accordingly.
  2. Build a spatial neighbor graph appropriate to the platform (hex grid for Visium, kNN/Delaunay for imaging).
  3. Run an expression-only baseline to show the salt-and-pepper failure a domain method corrects.
  4. Run a neighbor-augmented or graph-based domain method, exposing the spatial-weight knob.
  5. Sweep the spatial weight and inspect boundaries against histology to find the over-smoothing edge.
  6. Choose k biologically and report k+-1 sensitivity.
  7. Name domains from markers (for ranking/labeling, not inference) and validate against known architecture.

Tips