Paper2MCP v2 Verified Deliverable

SMART: spatial multi-omic aggregation using graph neural networks and metric learning

期刊:Nature Communications (2026-03-27) · DOI:10.1038/s41467-026-70821-5 · 开源许可:GPL-3.0

上游仓库:https://github.com/Xubin-s-Lab/SMART-main @ b534965ce056

Pytest: passedMCP Stdio Selftest: passedRelocated Fresh Install: passed

一、一键安装与 MCP 接入

# 1. 解压并构建隔离环境(含 R 的 mclust)+ 运行真实数据自测
unzip smart-mcp.zip && cd smart-mcp
bash install.sh
.venv/bin/python selftest.py

# 2. 接入 Claude Code / Antigravity / Cursor (Stdio MCP)
claude mcp add smart -- "$PWD/.venv/bin/python" "$PWD/server.py"

二、参考流程实测数据(上游仓库真实代码,教程 2 工作流)

数据10x Visium 人淋巴结 D1(RNA + 蛋白),Zenodo 10.5281/zenodo.17093158
规模3359 个 spot,31 种蛋白,11 类人工注释
设备CPU only,torch 2.15.0+cu132
训练上限 300 epoch,仓库早停于第 89 个 epoch,耗时 15.4 秒
SMART + mclust(k=7)ARI = 0.2763,NMI = 0.3814
对照:仅 RNA-PCA + mclust(k=7)ARI = 0.2369
损失(首 → 末 epoch)总 6.712 → 5.180;三元组 0.5158 → 0.0004
三元组数量RNA 2042,蛋白 3180

说明:SMART 融合 RNA 与蛋白后 ARI 比仅用 RNA 提高,但在这张切片上幅度有限,未做调参。教程 2 使用 A1 切片,本次为 D1,数值不可直接与论文最佳结果比较。仓库 smart.utils.clustering 的 kmeans/gmm 分支在当前 numpy 下会抛 TypeError,工具包已绕过,未修改上游代码。

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

preprocess_multiomics_dataMCP Verified ✓

Prepare spatial RNA + protein data for SMART: HVG selection, normalisation, CLR for protein, PCA of both modalities and a spatial KNN graph.

Selftest Summary: Prepared 3359 spots: RNA PCA 30d from 1000 genes, protein PCA 30d from 31 proteins, spatial KNN graph k=6 (20154 edges).
Metrics: {"n_spots": 3359, "n_genes_used": 1000, "n_proteins": 31, "rna_pcs": 30, "adt_pcs": 30, "n_edges": 20154, "mean_neighbors_per_spot": 6.0}
train_smart_embeddingMCP Verified ✓

Train the SMART graph autoencoder with triplet metric learning and return the shared multi-omic embedding.

Selftest Summary: Trained SMART for 30/30 epochs (early stopping is part of the repository's train_SMART); total loss 4.595 -> 3.412; embedding 3359x64.
Metrics: {"epochs_run": 30, "epochs_requested": 30, "total_loss_first": 4.594939231872559, "total_loss_last": 3.412400484085083, "reconstruction_loss_last": 3.3936171531677246, "triplet_loss_last": 0.018783297389745712, "n_triplets_rna": 1350, "n_triplets_adt": 3180, "embedding_shape": [3359, 64]}
cluster_spatial_domainsMCP Verified ✓

Cluster the SMART embedding into spatial domains (mclust by default) and score ARI/NMI against an optional annotation.

Selftest Summary: Clustered 3359 spots into 7 spatial domains with mclust. Against 'manual-anno': ARI=0.279, NMI=0.378.
Metrics: {"method": "mclust", "n_clusters_requested": 7, "n_clusters_found": 7, "n_spots": 3359, "ari": 0.27866275072049124, "nmi": 0.3775188161556066, "n_annotated_spots": 3359}
plot_spatial_domainsMCP Verified ✓

Plot SMART domains on tissue coordinates next to the manual annotation and a UMAP of the embedding.

Selftest Summary: Plotted 2 spatial panel(s) and a UMAP panel.
Metrics: {"n_panels": 3, "n_spots": 3359, "n_domains": 7}

四、实测复现结果图展示

smart_domains_vs_annotation.png
smart_training_loss.png
smart_annotation_vs_cluster.png