bio-spatial-transcriptomics-spatial-neighbors

Installation
SKILL.md

Version Compatibility

Reference examples tested with: squidpy 1.4+, scanpy 1.10+, anndata 0.10+, numpy 1.26+

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 Neighbor Graphs

"Build a spatial neighbor graph for my tissue" -> Define which cells or spots count as spatial neighbors, encoded as a sparse weights matrix W over adata.obsm['spatial'].

  • Python: squidpy.gr.spatial_neighbors() -> writes adata.obsp['spatial_connectivities'] and adata.obsp['spatial_distances']

The platform-class fork sets the default geometry. Sequencing/capture data on a fixed lattice (Visium hex, Visium HD grid) has a KNOWN adjacency -> use coord_type='grid'. Imaging/in-situ point clouds (Xenium, MERFISH, CosMx) have irregular cell positions -> use coord_type='generic' with Delaunay or kNN. The first question is always which side of the fork the data is on, because it decides whether "neighbor" is a lattice fact or a modeling choice.

Governing Principle

Installs
4
GitHub Stars
1.2K
First Seen
Jan 24, 2026
bio-spatial-transcriptomics-spatial-neighbors — gptomics/bioskills