Skip to content
Back to skills

Graph Analysis

ASecurity

"Build Squidpy spatial neighbor graphs and run graph/statistical

  • 247 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 9, 2026
datagotestingapibackend

Works with

  • api

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill graph-analysis --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Graph Analysis?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Graph Analysis
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-graph-analysis/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-graph-analysis)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: graph-analysis
description: "Build Squidpy spatial neighbor graphs and run graph/statistical
  analyses on AnnData or SpatialData tables."
disable-model-invocation: true
metadata:
  disco-role: operating
license: BSD 3-Clause
---

# Squidpy Graph Analysis

Use this sub-skill when a task needs `squidpy.gr` graph construction or graph/statistical analysis on an `AnnData` object or a `SpatialData` table: spatial neighbors, custom builders, neighborhood enrichment, co-occurrence, Ripley statistics, spatial autocorrelation, ligand-receptor testing, centrality, interaction matrices, niche labels, Sepal scores, or graph masking.

## Route First

- Need data readers, downloadable examples, Visium/Vizgen/Nanostring layouts, or `.obsm['spatial']` validation? Use `datasets-and-io` first.
- Need plots such as `sq.pl.nhood_enrichment`, `sq.pl.co_occurrence`, `sq.pl.ripley`, `sq.pl.centrality_scores`, `sq.pl.interaction_matrix`, `sq.pl.ligrec`, or graph edges in `spatial_scatter`? Compute here, then route plotting to `visualization` with the result keys.
- Need `squidpy.tl.var_by_distance`, `squidpy.tl.sliding_window`, or `sq.pl.var_by_distance`? Use `tools-workflows`.
- Need stable image processing or experimental SpatialData image tiling/QC? Use `image-analysis` or `experimental-imaging`.

## Fast Workflow

1. Prepare an `AnnData` table with coordinates in `adata.obsm['spatial']` and categorical labels in `adata.obs[cluster_key]`; for `SpatialData`, pass `table_key` to graph/statistical functions and `elements_to_coordinate_systems` when graph coordinates come from shapes or labels.
2. Build a graph with a mode-specific constructor: `sq.gr.spatial_neighbors_knn`, `sq.gr.spatial_neighbors_radius`, `sq.gr.spatial_neighbors_delaunay`, `sq.gr.spatial_neighbors_grid`, or `sq.gr.spatial_neighbors_from_builder`.
3. Avoid new code that depends on deprecated `sq.gr.spatial_neighbors`; keep it only for legacy snippets and prefer explicit mode-specific functions.
4. Confirm graph outputs exist at `adata.obsp['spatial_connectivities']`, `adata.obsp['spatial_distances']`, and `adata.uns['spatial']` unless `key_added` changed the prefix.
5. Run graph statistics with matching `connectivity_key`, `spatial_key`, `cluster_key`, and `table_key` values.
6. Validate outputs before plotting or downstream use.

## What To Read

- `references/graph-workflows.md` for graph construction choices, result keys, analysis ordering, SpatialData table handling, and validation snippets.
- `references/api-reference.md` for focused signatures, preconditions, outputs, and storage locations.
- `references/custom-builders.md` for `GraphBuilder`/`GraphBuilderCSR` contracts, built-in builders, postprocessors, and a custom approximate KNN pattern.
- `references/troubleshooting.md` for categorical labels, connectivity keys, deprecated `spatial_neighbors`, multi-library graphs, SpatialData `table_key`, ligand-receptor schema, optional niche dependencies, permutation cost, and parallel backends.
- `scripts/graph_smoke.py` for a tiny deterministic AnnData graph/statistics smoke that performs no downloads.

Files in this skill

  • SKILL.md3 KB
  • references/api-reference.md10 KB
  • references/custom-builders.md6.1 KB
  • references/graph-workflows.md10.6 KB
  • references/troubleshooting.md8.1 KB
  • scripts/graph_smoke.py3.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.