期刊:Nature Communications (2026-04-15) ·
DOI:10.1038/s41467-026-71699-z ·
开源许可:none (restricted)
上游仓库:https://github.com/SchapiroLabor/NEP_comparison @ 6dc8c1197ed1
# 1. 解压并自动构建隔离环境 + 运行真实数据自测
unzip cozi-mcp.zip && cd cozi-mcp
bash install.sh
.venv/bin/python selftest.py
# 2. 接入 Claude Code / Antigravity / Cursor (Stdio MCP)
claude mcp add cozi -- "$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
run_cozi_nep
MCP Verified ✓
Run COZI conditional neighbor preference analysis (cozipy run_cozi) on one sample: kNN, radius or Delaunay graph, permutation z-scores and conditional cell ratios for every ordered cell-type pair, plus a z-score heatmap.
{"n_cells": 1793, "n_cell_types": 4, "nbh_def": "knn", "n_permutations": 20, "self_zscore": {"0": -0.967, "1": 5.272, "2": 0.83, "3": 0.829}, "mean_self_zscore": 1.491, "top_enriched_pairs": ["1 to 1: 5.27", "0 to 1: 3.21", "3 to 2: 2.80"], "top_depleted_pairs": ["3 to 1: -1.76", "1 to 3: -1.61", "0 to 0: -0.97"]}compare_neighborhood_definitions
MCP Verified ✓
Run COZI with knn, Delaunay and radius neighborhoods on the same sample and report how well the z-score matrices agree.
{"n_cells": 1793, "n_cell_types": 4, "pairwise_correlation": {"knn vs delaunay": 0.975, "knn vs radius": 0.85, "delaunay vs radius": 0.851}, "mean_self_zscore": {"knn": 1.565, "delaunay": 1.677, "radius": 3.548}}build_nep_feature_table
MCP Verified ✓
Run COZI on every sample of a cohort manifest and assemble the sample-by-cell-type-pair z-score feature table used for cohort classification.
{"n_samples": 24, "groups": ["cross01", "random"], "n_features": 16, "n_permutations": 10, "top_group_differences": ["1_1: 4.44", "0_1: 3.30", "2_2: 2.36"]}evaluate_cohort_discrimination
MCP Verified ✓
Paper benchmark: random forest separates two cohorts from NEP features; reports held-out F1, feature importances and the cosine similarity of importances to a ground-truth adjacency-difference vector.
{"n_samples": 20, "n_features": 16, "positive_group": "cross01", "mean_f1": 0.893, "std_f1": 0.137, "n_repeats": 5, "top_features": ["0_1", "1_1", "2_2", "3_3", "1_3"], "cosine_similarity_importance_vs_truth": 0.927}数据:作者仓库随附的 IST 非对称模拟组织(4 种细胞类型,约 1800 细胞/张)。对照队列 random,对比队列 cross01(强度 0.6)。每组 10 张切片,COZI 使用 cozipy 0.1.4,kNN(k=6)邻域,30 次置换;随后用随机森林(100 棵树,10 次分层随机划分)在留出样本上区分两个队列。
| 0 型细胞丰度 | COZI 特征 F1 | 仅丰度基线 F1 |
|---|---|---|
| 0.05 | 0.449 ± 0.263 | 0.967 ± 0.100 |
| 0.15 | 0.947 ± 0.111 | 1.000 ± 0.000 |
| 0.25 | 0.913 ± 0.137 | 0.440 ± 0.268 |
| 0.45 | 1.000 ± 0.000 | 1.000 ± 0.000 |
丰度 0.25:cross01 队列 1→1 平均 z = 3.87(random 为 0.50),0→1 平均 z = 2.89(random 为 -0.08)。随机森林前两位特征为 1_1 与 0_1;仓库真值向量中差异最大的是 0_1(0.35),1_1 的真值仅为 0.12。重要性与真值的 (cos+1)/2 相似度为 0.903,该写法天然偏高。
如实说明:在 0.05 的稀有丰度下,本次小样本实验里 COZI 特征(0.449)不如仅用丰度的基线(0.967);丰度 0.45 时两者都是 1.0。样本量小,F1 标准差在 0.1 到 0.26 之间,这些数值不构成对论文大规模结论的验证。
说明:作者仓库本体只含 R 比较脚本与模拟数据,未声明开源许可证;COZI 算法实现来自 MIT 许可的 cozipy。工具包仅附带少量模拟样本用于自测。


