期刊:Nature Computational Science (2026-07-30) ·
DOI:10.1038/s43588-026-01016-7 ·
开源许可:MIT (allowed)
上游仓库:https://github.com/TerminatorJ/Spatialformer @ b3f57ea858ac
# 1. 解压并自动构建隔离环境 + 运行真实数据自测
unzip spatialformer-mcp.zip && cd spatialformer-mcp
bash install.sh
.venv/bin/python selftest.py
# 2. 接入 Claude Code / Antigravity / Cursor (Stdio MCP)
claude mcp add spatialformer -- "$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
tokenize_spatial_cells
MCP Verified ✓
Tokenize single-cell or paired-cell spatial transcriptomics AnnData into ranked SpatialFormer gene token batches.
{"n_cells": 120, "n_samples": 120, "vocab_size": 6065, "matched_genes": 77, "mean_seq_len": 22.49, "max_seq_len": 37, "n_batches": 8, "mode": "single"}extract_spatial_embeddings
MCP Verified ✓
Extract single-cell SpatialFormer embeddings (X_SpaF), UMAP visualization, and cell-type/batch integration metrics.
{"n_cells": 120, "embed_dim": 32, "method": "gene", "celltype_silhouette": -0.0264, "batch_silhouette": 0.087}annotate_cell_types
MCP Verified ✓
Train and evaluate SpatialFormer's downstream SimpleMLP cell-type classifier on X_SpaF embeddings.
{"n_train": 90, "n_test": 30, "n_classes": 4, "test_accuracy": 0.8333, "weighted_precision": 0.828, "weighted_recall": 0.8333, "weighted_f1": 0.8289, "final_train_loss": 0.3304}predict_cell_colocalization
MCP Verified ✓
Predict pairwise cell-cell spatial colocalization probabilities and pair embeddings using SpatialFormer.
{"n_pairs": 40, "mean_pos_prob": 0.5369, "predicted_positive_fraction": 0.625, "reverse_check": false, "accuracy": 0.575, "roc_auc": 0.6525}compute_subcellular_gene_graph
MCP Verified ✓
Construct subcellular spatial transcript KD-tree/Louvain graphs and gene-gene co-occurrence matrices with optional coordinate perturbation.
{"cell_id": "TILD117LF_aaaaigjn-1", "n_transcripts": 439, "n_unique_genes": 61, "n_cooccurring_pairs": 251, "mean_gene_degree": 8.23, "perturbation_jaccard": 0.9269}

