期刊:Nature Computational Science (2026-05-15) ·
DOI:10.1038/s43588-026-00992-0 ·
开源许可:MIT (allowed)
上游仓库:https://github.com/wwYinYin/HESpotEx @ c3964aac60de
# 1. 解压并自动构建隔离环境 + 运行真实数据自测
unzip hespotex-mcp.zip && cd hespotex-mcp
bash install.sh
.venv/bin/python selftest.py
# 2. 接入 Claude Code / Antigravity / Cursor (Stdio MCP)
claude mcp add hespotex -- "$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
segment_nuclei_and_build_patches
MCP Verified ✓
Segment H&E nuclei via hematoxylin Otsu thresholding (or load precomputed nuclei masks), extract 224x224 spot image patches, compute normalized spot nuclei counts, and build a KNN spatial adjacency matrix via common.dataset.calcADJ.
{"n_spots": 24, "image_height": 244, "image_width": 245, "mask_source": "hematoxylin_otsu", "total_nuclei_labels": 24, "mean_nuclei_per_spot": 2.75, "adj_edges": 96, "patch_tensor_shape": [24, 3, 224, 224]}encode_spatial_expression_gvae
MCP Verified ✓
Select shared highly variable genes with model.preprocess.scanpy_workflow, build spatial KNN graphs with Spatial_Dis_Cal, and train STAGATE Graph Attention Autoencoder (model.exp_module.STAGATE) to produce spatial gene expression embeddings.
{"n_sections": 2, "n_spots_total": 48, "n_hvgs": 50, "latent_dim": 32, "initial_recon_mse": 432.7499, "final_recon_mse": 8.1138}train_hespotex_dual_stream
MCP Verified ✓
Train the HESpotEx dual-stream model (model.models.Image_Model with QuiltNet-B-32 image encoder, latent alignment head, gene head, 4-layer ImageDecoder GCN, and JKNet LSTM) using joint latent PCC alignment and gene expression MSE losses.
{"n_train_spots": 24, "n_val_spots": 24, "n_genes": 50, "latent_dim": 32, "final_train_latent_loss": 0.9971, "final_train_mse": 14.0383, "best_val_pcc_loss": 1.0289, "val_mean_gene_pcc": -0.0289, "val_mean_spot_pcc": 0.1025}predict_and_evaluate_spatial_expression
MCP Verified ✓
Predict spot-level spatial gene expression solely from H&E histology patches, nuclei counts, and spatial spot graphs using a trained HESpotEx Image_Model in inference stage, and evaluate per-gene and per-spot PCC and MSE.
{"n_spots": 24, "n_genes": 50, "n_evaluated_genes": 50, "mean_gene_pcc": -0.0283, "median_gene_pcc": -0.039, "mean_spot_pcc": 0.1685, "mse": 35.2809, "rmse": 5.9398, "top_genes": [["FDCSP", 0.6442], ["CLU", 0.4721], ["MT-ND1", 0.4557]]}

