Files
PlantAI-dev/docs/validation/2026-07-21-string-ppi-task1-snapshot.md
2026-08-03 18:42:47 +08:00

77 lines
3.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# STRING PPI Task 1:v12.0 快照部署与验证
范围:只部署和验证 STRING v12.0 species snapshot;未连接 backend,未修改 PPI 执行,未重启 Web 或 Celery,也未提交分析任务。
## Gate 1 结论
Gate 1 通过。缺少完整快照的 RED 已被正确复现;现有准备脚本无需修改;官方固定文件已下载,manifest、SHA256、文件大小、树结构和 registry 一致性均已独立验证;完整 snapshot/registry 测试共 19 项通过。
## RED 基线
- `python -m pytest -q tests/unit/test_string_species_snapshot.py`:退出码 0,`9 passed`。说明脚本和 fixture 行为原本正常。
- `python -m pytest -q tests/unit/test_string_species_registry.py::test_full_snapshot_supports_registry_only_species_and_second_non_ft_target`:退出码 1。
- 失败为 `StringSnapshotError: ... data/string/v12.0/source_manifest.json unavailable`,明确是生产快照缺失,不是语法、导入或 fixture 错误。
## 脚本审计
`scripts/prepare_string_species_snapshot.py` 已满足本任务:固定 v12.0 官方 HTTPS URL、临时目录下载与原子替换、严格 TSV/布尔解析、父节点完整性、非 root 环检测、registry/tree STRING 物种一致性、33090/3702 必需节点、SHA256、size、snapshot_id 与 manifest。因此未修改脚本或测试。
## 下载产物
执行:
```bash
/home/xzq/miniconda3/envs/test4py311/bin/python scripts/prepare_string_species_snapshot.py \
--version 12.0 --destination data/string/v12.0
```
退出码:0。来源与产物:
| 文件 | 官方固定 URL | 字节数 | SHA256 |
|---|---|---:|---|
| `species.v12.0.txt` | `https://stringdb-downloads.org/download/species.v12.0.txt` | 1,023,159 | `4bb4c99c14db8d695decadf3b403a5b87ac490b468a842cbc54ec2e412400fec` |
| `species.tree.v12.0.txt` | `https://stringdb-downloads.org/download/species.tree.v12.0.txt` | 97,357,335 | `54cf2e3378cbcabc38e355b044336813b7c0e76292ef34d70f8c8debc2e49ee1` |
`snapshot_id`:`ede47d546d853d0ec30ee75066976a35c08fd2412e6e5fc7866bbd205fc2eeb3`。实际文件的 size 和重新计算的 SHA256 与 `source_manifest.json` 完全一致。
## 全量验证
```bash
/home/xzq/miniconda3/envs/test4py311/bin/python -m pytest -q \
tests/unit/test_string_species_snapshot.py \
tests/unit/test_string_species_registry.py
```
退出码 0:`19 passed in 11.99s`。
全量结构复核:
- registry STRING 物种:12,535;tree 中 `is_STRING_species=t`:12,535;集合一致。
- tree 节点:2,212,178;所有父节点可解析;只有 TaxID 1 的官方 root 自环,未发现非 root 环。
- Viridiplantae 33090 存在,父节点为 2759。
- Arabidopsis thaliana 3702 同时存在于 registry/tree,tree 标记为 STRING species,父节点为 3701。
## Setaria viridis 文件事实
科学名和显式 TaxID 4556 两种查询得到相同结论:
- TaxID 4556 存在于 STRING tree,父节点为 Setaria 4554;
- 4556 不在 `species.v12.0.txt` registry,tree 的 `is_STRING_species=false`;
- 因此不是 v12.0 直接支持物种,选择模式为 `tree_nearest`,需要用户确认;
- 候选 1:Setaria italica 4555,LCA=Setaria 4554,tree distance=2;
- 候选 2:Panicum miliaceum 4540,LCA=Paniceae 147428,distance=6;
- 候选 3:Dichanthelium oligosanthes 888268,LCA=Paniceae 147428,distance=6。
这里的 distance 是 STRING taxonomy tree 的拓扑边数,不是带枝长的分子进化距离。
## 变更边界
新增/部署:
- `data/string/v12.0/species.v12.0.txt`
- `data/string/v12.0/species.tree.v12.0.txt`
- `data/string/v12.0/source_manifest.json`
- 本验证 JSON/MD
未修改:backend、PPI 执行层、resolver 生产接线、Web/Celery 配置和服务状态。