Paper2MCP v2 Verified Deliverable

SpaDiff denoises sequence-based spatial transcriptomics via diffusion process

期刊:Cell Reports Methods (2026-07-17) · DOI:10.1016/j.crmeth.2026.101530 · 开源许可:MIT (allowed)

上游仓库:https://github.com/JiazhangCai/SpaDiff @ 0145bdd0278f

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

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

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

# 2. 接入 Claude Code / Antigravity / Cursor (Stdio MCP)
claude mcp add spadiff -- "$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 个工具)

denoise_spatial_counts MCP Verified ✓

Run SpaDiff mass-conserving score-guided reverse diffusion denoising on spatial transcriptomics count matrices (.h5ad or .npz).

Selftest Summary: SpaDiff denoised 600 spots x 18 genes in T=5 steps (0.81s); mass retention=1.000000, max per-gene mass delta=9.1553e-04.
Metrics: {"n_spots": 600, "n_genes": 18, "mass_before": 14754.0, "mass_after": 14753.9970703125, "mass_retention": 0.9999998014309611, "max_gene_mass_delta": 0.00091552734375, "nonzero_before": 8192, "nonzero_after": 10477, "runtime_seconds": 0.8121790059994964}
evaluate_spatial_quality MCP Verified ✓

Quantify spatial autocorrelation (Moran's I via compute_gene_alpha_morans), expression concentration (Gini), regional separability (F-ratio, marker enrichment), and clustering Silhouette/ARI before vs after SpaDiff denoising.

Selftest Summary: Evaluated 18 genes across 600 spots: Moran's I improved on 100.0% (0.378 -> 0.785), Gini improved on 0.0% (0.366 -> 0.277).
Metrics: {"n_spots": 600, "n_genes": 18, "moran_improved_pct": 100.0, "mean_moran_raw": 0.37842828035354614, "mean_moran_denoised": 0.7849109768867493, "gini_improved_pct": 0.0, "mean_gini_raw": 0.3664703315717473, "mean_gini_denoised": 0.27724246034144256, "enrichment_improved_pct": 28.57142857142857, "mean_enrichment_raw": 1.9774119028396044, "mean_enrichment_denoised": 1.770858241255197, "silhouette_raw": 0.13118236843312725, "silhouette_denoised": 0.47431699086485785}
inspect_score_field MCP Verified ✓

Detect tissue boundary and mirror ghost spots, trace the reverse-diffusion trajectory, and plot global and gene-specific KDE score vector fields.

Selftest Summary: Inspected score field on 600 spots (gene=EPCAM): detected 81 boundary spots and 81 ghost spots; global mass entropy shifted from 6.3647 to 6.3571.
Metrics: {"n_spots": 600, "n_boundary_spots": 81, "n_ghost_spots": 81, "mean_global_score_norm": 0.29780787229537964, "initial_mass_entropy": 6.3646934035338445, "final_mass_entropy": 6.357107313641297}
benchmark_spot_swapping MCP Verified ✓

Simulate particle-level spot-swapping contamination (Gaussian, Laplace, or Cauchy kernel), apply SpaDiff denoising, and benchmark expression recovery via per-gene JSD and Pearson correlation.

Selftest Summary: Simulated gaussian spot-swapping (sigma=200 um) on 600 spots x 18 genes: median per-gene JSD reduced from 0.3006 to 0.1320 (56.1% reduction); mean Pearson r improved from 0.1807 to 0.3772; mass retention=1.000000.
Metrics: {"n_spots": 600, "n_genes": 18, "median_jsd_contaminated": 0.3006207148044592, "median_jsd_denoised": 0.13204758433501693, "jsd_reduction_pct": 56.075021503122905, "mean_gene_corr_contaminated": 0.18067391860397097, "mean_gene_corr_denoised": 0.37719703640887947, "mass_retention": 0.9999997352412837}

三、实测复现结果图展示

crc_quality_metrics.png
crc_spatial_denoising.png
score_field_diagnostics.png