Paper2MCP v2 Verified Deliverable

Weighted sliced inverse regression for scalable supervised dimensionality reduction of spatial transcriptomics data.

期刊:Nature Communications (2026-09-03) · DOI:10.1038/s41467-026-76871-z · 开源许可:none (restricted)

上游仓库:https://github.com/SydneyBioX/wSIR_2024 @ 9542f056761a

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

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

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

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

tune_wsir_params MCP Verified ✓

Grid-search wSIR spatial weighting (alpha) and tiling (slices) hyperparameters using repeated train/test spatial distance correlation.

Selftest Summary: Grid search over 4 (alpha, slices) pairs on 450 cells x 120 genes: optimal alpha=4.0, slices=3 (DC=0.24).
Metrics: {"best_alpha": 4.0, "best_slices": 3, "best_metric_value": 0.24, "sir_baseline_metric": 0.2247, "metric_name": "DC", "n_cells": 450, "n_genes": 120, "n_combinations": 4}
fit_wsir_embedding MCP Verified ✓

Fit Weighted Sliced Inverse Regression (wSIR) on single- or multi-sample spatial transcriptomics data.

Selftest Summary: Fitted wSIR (alpha=4.0, slices=6) on 450 cells x 120 genes: retained estd=15 directions (95.1% variance), in-sample DC=0.4749.
Metrics: {"n_cells": 450, "n_genes": 120, "estd": 15, "alpha": 4.0, "slices": 6, "var_threshold": 0.95, "variance_explained_ratio": 0.9512, "dc_vs_coords": 0.4749, "cd_vs_coords": 0.28, "top_eigenvalues": [0.0083, 0.0057, 0.0022]}
project_and_transfer MCP Verified ✓

Project unseen single-cell or spatial expression data into a fitted wSIR latent space and transfer cell-type labels via KNN.

Selftest Summary: Projected 350 query cells using 120 shared genes into 15 wSIR dimensions (DC=0.3885, KNN_acc=0.5143).
Metrics: {"n_query_cells": 350, "n_common_genes": 120, "n_dims_used": 15, "dc_vs_coords": 0.3885, "cd_vs_coords": 0.2391, "knn_accuracy": 0.5143, "n_predicted_classes": 15}
analyze_wsir_genes_umap MCP Verified ✓

Rank top spatially loaded genes per wSIR direction and visualize gene expression on wSIR UMAP.

Selftest Summary: Extracted 16 unique top spatially loaded genes across 2 wSIR directions (top dir1: Hoxa1, Pitx1, Otx2) and computed 2D UMAP on 450 cells.
Metrics: {"n_cells": 450, "n_genes": 120, "estd": 15, "n_top_gene_entries": 16, "n_unique_top_genes": 16, "top_genes_dir1": ["Hoxa1", "Pitx1", "Otx2", "Bmp4", "Setd1b"]}

三、实测复现结果图展示

wsir_param_tuning.png
wsir_spatial_directions.png
wsir_umap_genes.png