期刊:Nature Biomedical Engineering (2026-10-13) ·
DOI:10.1038/s41551-026-01804-6 ·
开源许可:MIT (allowed)
上游仓库:https://github.com/yaober/SPACER @ d7673b8df8f7
# 1. 解压并自动构建隔离环境 + 运行真实数据自测
unzip spacer-mcp.zip && cd spacer-mcp
bash install.sh
.venv/bin/python selftest.py
# 2. 接入 Claude Code / Antigravity / Cursor (Stdio MCP)
claude mcp add spacer -- "$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
prepare_spatial_bags
MCP Verified ✓
Construct cell-centered multi-instance learning (MIL) spatial neighborhood bags from an .h5ad spatial transcriptomics dataset or CSV manifest using SPACER BagsDataset and preprocess_data.
{"n_batches": 132, "n_bags": 264, "n_positive_bags": 132, "n_negative_bags": 132, "n_genes_selected": 140, "mean_instances_per_bag": 36.34, "engage_cell": "tcell", "mapped_column": "T"}train_spacer_single
MCP Verified ✓
Train the interpretable SPACER MIL model in single-dataset mode (train.py) to learn spatial distance decay, gene weighting, and per-gene SPACER recruitment scores.
{"num_epochs": 5, "final_train_loss": 0.08599, "final_val_loss": 0.13131, "best_val_loss": 0.07295, "final_val_auroc": 0.9975, "learned_a": -1.4163, "learned_b": 1.7962, "learned_alpha": 2.611, "learned_beta": -4.2838, "top_5_genes": ["TAP2", "HLA-C", "IFI6", "HLA-B", "HLA-A"]}train_spacer_joint
MCP Verified ✓
Train SPACER across multiple spatial transcriptomics cohorts in federated joint mode (FedAvg + FedProx) sharing global SPACER gene scores while keeping spatial/expression scalars local.
{"n_clients": 2, "comm_rounds": 3, "local_epochs": 1, "fedprox_mu": 0.01, "top_5_global_genes": ["TAP2", "HLA-B", "HLA-A", "HLA-C", "IFI6"], "max_spacer_score": 0.9917}predict_spatial_recruitment
MCP Verified ✓
Score tumor cell neighborhoods in a spatial .h5ad slide using a trained SPACER MIL checkpoint to predict cell engagement probability and evaluate AUROC if ground-truth labels exist.
{"n_cells_total": 280, "n_cells_scored": 241, "mean_predicted_prob": 0.5611, "median_predicted_prob": 0.9394, "auroc": 0.9868, "accuracy": 0.9129}interpret_spacer_codes
MCP Verified ✓
Extract and visualize interpretable spatial and molecular recruitment codes (per-gene SPACER scores and spatial distance decay kernel) from a trained SPACER MIL checkpoint.
{"a_distance_decay": -1.80777, "effective_decay_rate_exp_a": 0.16402, "half_decay_distance": 4.226, "b_expression_sharpness": 1.21836, "alpha_scale": 3.05418, "beta_bias": -4.61538, "gene_weighting": "softmax", "n_genes_scored": 120, "top_5_genes": ["TAP2", "IFI6", "HLA-C", "ANXA9", "CHD5"], "top_gene_score": 0.9802}

