104 lines
3.1 KiB
Markdown
104 lines
3.1 KiB
Markdown
# BtToxin Pipeline
|
||
|
||
Automated Bacillus thuringiensis toxin mining system with CI/CD integration.
|
||
|
||
## Quick Start (单机部署)
|
||
|
||
### uv .venv
|
||
|
||
```bash
|
||
uv venv --managed-python -p 3.12 --seed .venv
|
||
uv pip install backend/requirements.txt
|
||
```
|
||
|
||
### Prerequisites
|
||
|
||
- Docker / Podman
|
||
- Python 3.10+
|
||
- Node.js 18+
|
||
|
||
### Development Setup
|
||
```bash
|
||
# 1. Clone and setup
|
||
git clone <your-repo>
|
||
cd bttoxin-pipeline
|
||
|
||
# 2. 使用 Makefile 初始化与启动(单机)
|
||
make setup
|
||
make start
|
||
|
||
# 3. 初始化数据库(创建表)
|
||
make db-init
|
||
|
||
# 4. 访问服务
|
||
# API: http://localhost:8000/docs
|
||
# Flower: http://localhost:5555
|
||
# Frontend:http://localhost:3000
|
||
|
||
# (可选) 本地开发
|
||
# Backend: uvicorn app.main:app --reload
|
||
# Frontend: npm run dev
|
||
```
|
||
|
||
## Architecture
|
||
|
||
Nginx (Reverse Proxy)
|
||
├── Frontend (Vue 3 Static)
|
||
└── Backend (FastAPI + Swagger)
|
||
├── PostgreSQL (SQLModel via SQLAlchemy)
|
||
├── Redis (Broker/Result)
|
||
├── Celery (Worker/Beat + Flower)
|
||
└── Docker Engine (BtToxin_Digger)
|
||
|
||
## Documentation
|
||
|
||
- API 文档: 浏览器打开 `http://localhost:8000/docs`
|
||
- 单机编排: `docker/docker-compose.yml`(唯一来源)
|
||
- 环境变量示例: `backend/.env.example`
|
||
- 常用命令: `make help`
|
||
|
||
### macOS + Podman 使用注意事项
|
||
|
||
- Podman 在 macOS 上通过虚拟机运行,宿主目录绑定到容器时,写权限可能受限。
|
||
- 我们已在运行逻辑中对 macOS 进行特殊处理:将输入复制到容器内 `/tmp/input`,在 `/tmp` 执行 BtToxin_Digger,结束后把 `Results/` 与关键输出复制回挂载的 `/workspace`(宿主输出目录)。
|
||
- 如仍遇写入问题:
|
||
- 在 Podman Desktop 的虚拟机共享目录中,添加项目路径并开启写权限。
|
||
- 如需,启用 rootful 模式并重启:`podman machine stop && podman machine set --rootful && podman machine start`
|
||
- 手动验证挂载:`podman run --rm -v $(pwd)/tests/output:/workspace:rw alpine sh -lc 'echo ok > /workspace/test.txt && ls -l /workspace'`
|
||
|
||
### 本地离线容器测试(可选)
|
||
|
||
使用 `scripts/test_bttoxin_digger.py` 最小测试:
|
||
|
||
```bash
|
||
uv run python scripts/test_bttoxin_digger.py
|
||
```
|
||
|
||
要求:`tests/test_data` 下存在 `97-27.fna` 与 `C15.fna`,测试成功后在 `tests/output/Results/Toxins` 看到 6 个关键文件。
|
||
|
||
### 单目录方案(跨平台稳定写入)
|
||
|
||
- 运行前,程序会将输入文件复制到宿主输出目录下的 `input_files/` 子目录;容器仅挂载该输出目录(读写)为 `/workspace`。
|
||
- 工具运行时的 `--SeqPath` 指向 `/workspace/input_files`,工作目录也固定在 `/workspace`;所有结果与中间文件都会落在宿主的 `tests/output/` 下。
|
||
|
||
目录示例:
|
||
|
||
```
|
||
tests/output/
|
||
├── input_files/ # 输入文件副本
|
||
│ ├── 97-27.fna
|
||
│ └── C15.fna
|
||
├── Results/ # BtToxin_Digger 输出
|
||
│ └── Toxins/
|
||
│ ├── 97-27.list
|
||
│ ├── 97-27.gbk
|
||
│ └── ...
|
||
├── StatsFiles/ # 统计文件(如有)
|
||
├── All_Toxins.txt
|
||
└── BtToxin_Digger.log
|
||
```
|
||
|
||
## License
|
||
|
||
MIT License
|