期刊:Nature Biomedical Engineering (2026-10-14) ·
DOI:10.1038/s41551-026-01800-w ·
开源许可:MIT (allowed)
上游仓库:https://github.com/li-xinqi/spatialzoomer @ efafa22114e3
# 1. 解压并自动构建隔离环境 + 运行真实数据自测
unzip spatialzoomer-mcp.zip && cd spatialzoomer-mcp
bash install.sh
.venv/bin/python selftest.py
# 2. 接入 Claude Code / Antigravity / Cursor (Stdio MCP)
claude mcp add spatialzoomer -- "$PWD/.venv/bin/python" "$PWD/server.py"
# 3. 或启动远程 Streamable HTTP MCP 服务端供团队/网页直接调用
.venv/bin/python server.py --transport http --host 0.0.0.0 --port 8000
preprocess_spatial_data
MCP Verified ✓
Normalize + log1p a single-cell-resolved spatial AnnData with SpatialZoomer's Preprocess and compute the NMF embedding (obsm['X_nmf']) used by the multi-scale analysis.
{"n_cells": 2400, "n_genes": 120, "n_components": 10, "nmf_nonzero_fraction": 0.8833, "median_counts_per_cell": 95.0}run_multiscale_analysis
MCP Verified ✓
Run SpatialZoomer multi-scale analysis: spatial KNN graph, heat-kernel spectral graph filter bank over a scale grid, typical-scale selection by dynamic programming, and two-step k-means + Leiden clustering per typical scale.
{"n_cells": 2400, "n_scales": 58, "typical_scales": [0.01, 1.1, 3.5, 6.0, 8.5, 13.0, 25.0, 40.0], "cluster_columns": ["leiden_Raw_res1.0", "leiden_scale0.01_res1.0", "leiden_scale1.1_res1.0", "leiden_scale3.5_res1.0", "leiden_scale6.0_res1.0", "leiden_scale8.5_res1.0", "leiden_scale13.0_res1.0", "leiden_scale25.0_res1.0", "leiden_scale40.0_res1.0"], "n_clusters_per_column": {"leiden_Raw_res1.0": 7, "leiden_scale0.01_res1.0": 9, "leiden_scale1.1_res1.0": 12, "leiden_scale3.5_res1.0": 12, "leiden_scale6.0_res1.0": 5, "leiden_scale8.5_res1.0": 4, "leiden_scale13.0_res1.0": 4, "leiden_scale25.0_res1.0": 4, "leiden_scale40.0_res1.0": 6}, "resolution": 1.0}evaluate_scale_clusters
MCP Verified ✓
Score each scale's clustering against a reference annotation (ARI, NMI) and report spatial coherence of the labels.
{"reference_key": "domain", "n_cluster_columns": 9, "best_column": "leiden_scale8.5_res1.0", "best_ARI": 0.9834, "best_NMI": 0.9709, "best_spatial_coherence": 0.9753, "scores": {"leiden_Raw_res1.0": 0.3291, "leiden_scale0.01_res1.0": 0.3895, "leiden_scale1.1_res1.0": 0.4882, "leiden_scale3.5_res1.0": 0.5217, "leiden_scale6.0_res1.0": 0.9399, "leiden_scale8.5_res1.0": 0.9834, "leiden_scale13.0_res1.0": 0.9737, "leiden_scale25.0_res1.0": 0.9703, "leiden_scale40.0_res1.0": 0.8135}, "raw_ARI": 0.3291, "raw_spatial_coherence": 0.3566}plot_scale_spatial_maps
MCP Verified ✓
Plot spatial maps of the raw and per-typical-scale clusterings side by side.
{"n_panels": 4, "panels": ["leiden_Raw_res1.0", "leiden_scale3.5_res1.0", "leiden_scale8.5_res1.0", "leiden_scale40.0_res1.0"], "n_cells": 2400}
