Paper2MCP v2 Verified Deliverable

SpatialZoomer: multi-scale feature analysis of spatial transcriptomics

期刊:Nature Biomedical Engineering (2026-10-14) · DOI:10.1038/s41551-026-01800-w · 开源许可:MIT (allowed)

上游仓库:https://github.com/li-xinqi/spatialzoomer @ efafa22114e3

Pytest: passed MCP Stdio Selftest: passed Relocated Fresh Install: passed

一、一键安装与 MCP 接入(本地 / 远程统一接口)

# 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

二、已验证科学工具清单(4 个工具)

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.

Selftest Summary: Preprocessed 2400 cells x 120 genes (normalize_total + log1p) and computed a 10-component NMF embedding in obsm['X_nmf'].
Metrics: {"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.

Selftest Summary: Multi-scale analysis over 58 scales on 2400 cells; identified 8 typical scales [0.01, 1.1, 3.5, 6.0, 8.5, 13.0, 25.0, 40.0]; clustered raw signal and each typical scale at resolution 1.0.
Metrics: {"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.

Selftest Summary: Scored 9 clusterings against 'domain'. Best agreement: leiden_scale8.5_res1.0 (ARI=0.9834, NMI=0.9709, spatial coherence=0.9753).
Metrics: {"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.

Selftest Summary: Plotted spatial cluster maps for 4 clusterings: leiden_Raw_res1.0, leiden_scale3.5_res1.0, leiden_scale8.5_res1.0, leiden_scale40.0_res1.0.
Metrics: {"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}

三、实测复现结果图展示

ari_vs_scale.png
spatial_clusters_by_scale.png