This skill covers building spatial neighbor graphs for spatial transcriptomics analysis using Squidpy. Neighbor graphs define which spots/cells are considered spatial neighbors for downstream analyses.
pip install squidpy scanpyTell your AI agent what you want to do:
- "Build a spatial neighbor graph"
- "Create a KNN graph with 6 neighbors"
"Build a spatial neighbor graph for my Visium data"
"Create a Delaunay triangulation graph"
"Build a KNN graph with 10 neighbors"
"Connect spots within 100 pixels of each other"
- Extract spatial coordinates
- Build neighbor graph using specified method
- Store connectivities and distances in adata.obsp
- Report graph statistics
- Visium grid - Use
coord_type='grid'andn_ringsfor hexagonal grids - n_neighs - 6 is typical for Visium; adjust for single-cell resolution data
- Delaunay - Creates natural tessellation, good for variable density
- Radius - Use when you want fixed distance threshold