feat: 支持绑定外部 bt_toxin 数据库 (2025-11-04 更新)

- docker_client.py: run_bttoxin_digger() 新增 bttoxin_db_dir 参数,支持挂载外部数据库
- run_single_fna_pipeline.py: 新增 --bttoxin_db_dir 参数,自动检测 external_dbs/bt_toxin
- README.md: 添加 bttoxin_db 更新说明和 Docker 绑定文档
- external_dbs/bt_toxin: 添加 2025-11-04 版本数据库文件

测试验证: HAN055 样本毒素命名版本号变化 (Cry2Aa9→22, Cry2Ab35→41, Cry1Ia40→42, Vip3Aa7→79)
This commit is contained in:
2026-01-04 14:37:49 +08:00
parent 5883e13c56
commit 1c0e8f90a5
40 changed files with 166422 additions and 194 deletions

View File

@@ -140,6 +140,86 @@ tests/output/
└── BtToxin_Digger.log
```
## bttoxin_db更新
BtToxin_Digger 容器内置的数据库版本较旧2021年8月建议使用官方 GitHub 仓库的最新数据库。
### 数据库目录结构
```
external_dbs/bt_toxin/
├── db/ # BLAST 索引文件(运行时必需)
│ ├── bt_toxin.phr
│ ├── bt_toxin.pin
│ ├── bt_toxin.psq
│ ├── bt_toxin.pdb
│ ├── bt_toxin.pjs
│ ├── bt_toxin.pot
│ ├── bt_toxin.ptf
│ ├── bt_toxin.pto
│ └── old/
└── seq/ # 序列源文件(留档/更新用)
├── bt_toxin20251104.fas
└── ...
```
### 更新步骤
```bash
mkdir -p external_dbs
rm -rf external_dbs/bt_toxin tmp_bttoxin_repo
git clone --filter=blob:none --no-checkout https://github.com/liaochenlanruo/BtToxin_Digger.git tmp_bttoxin_repo
cd tmp_bttoxin_repo
git sparse-checkout init --cone
git sparse-checkout set BTTCMP_db/bt_toxin
git checkout master
# 把目录拷贝到你的项目 external_dbs 下
cd ..
cp -a tmp_bttoxin_repo/BTTCMP_db/bt_toxin external_dbs/bt_toxin
# 清理临时 repo
rm -rf tmp_bttoxin_repo
```
### 验证数据库绑定
```bash
# 检查数据库文件是否完整
ls -lh external_dbs/bt_toxin/db/
# 验证容器能正确访问绑定的数据库
docker run --rm \
-v "$(pwd)/external_dbs/bt_toxin:/usr/local/bin/BTTCMP_db/bt_toxin:ro" \
quay.io/biocontainers/bttoxin_digger:1.0.10--hdfd78af_0 \
bash -lc 'ls -lh /usr/local/bin/BTTCMP_db/bt_toxin/db | head'
```
输出应显示 `.pin/.psq/.phr` 等文件,且时间戳/大小与宿主机一致,说明绑定成功。
### 使用外部数据库运行 Pipeline
脚本会自动检测 `external_dbs/bt_toxin` 目录,若存在则自动绑定:
```bash
# 自动使用 external_dbs/bt_toxin推荐
uv run python scripts/run_single_fna_pipeline.py --fna tests/test_data/HAN055.fna
# 或手动指定数据库路径
uv run python scripts/run_single_fna_pipeline.py \
--fna tests/test_data/HAN055.fna \
--bttoxin_db_dir /path/to/custom/bt_toxin
```
### 注意事项
- **db/ 目录是必需的**:运行时 BLAST 只读取 `db/` 下的索引文件
- **seq/ 目录是可选的**:仅用于留档或重新生成索引
- **绑定模式为只读 (ro)**:防止容器意外修改宿主机数据库
- **不需要重新 index**GitHub 仓库已包含预构建的 BLAST 索引
## License
MIT License