chore: 初始版本提交 - 简化架构 + 轮询改造

- 移除 Motia Streams 实时通信,改用 3 秒轮询
- 简化前端代码,移除冗余组件
- 简化后端架构,准备 FastAPI 重构
- 更新 pixi.toml 环境配置
- 保留 bttoxin_digger_v5_repro 作为参考文档

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
zly
2026-01-13 16:50:09 +08:00
parent 4c9a7d0978
commit fe353fc0bc
134 changed files with 1237947 additions and 2518 deletions

View File

@@ -397,7 +397,7 @@ def compute_similarity_weight(identity: float, coverage: float, hmm: bool) -> fl
def parse_all_toxins(tsv_path: Path) -> pd.DataFrame:
df = pd.read_csv(tsv_path, sep="\t", dtype=str, low_memory=False)
df = pd.read_csv(tsv_path, sep="\t", dtype=str, engine="python")
# Coerce needed fields
for col in ["Identity", "Aln_length", "Hit_length"]:
df[col] = pd.to_numeric(df[col], errors="coerce")
@@ -658,7 +658,13 @@ def main():
d = index.orders_for_name_or_backoff(fam)
return bool(d)
df = df[df.apply(_has_index_orders, axis=1)]
strains = sorted(df["Strain"].astype(str).unique().tolist())
# Handle empty DataFrame - preserve columns and create empty outputs
if df.shape[0] == 0:
print("[Shotter] No hits passed filters, creating empty output files")
strains: List[str] = []
else:
strains = sorted(df["Strain"].astype(str).unique().tolist())
all_hits: List[ToxinHit] = []
all_strain_scores: List[StrainScores] = []

View File

@@ -46,6 +46,8 @@ from pathlib import Path
from typing import Dict, Any, List
# Import PixiRunner and command builders from scripts
# Add scripts directory to path for pixi_runner import
sys.path.insert(0, str(Path(__file__).parent))
from pixi_runner import PixiRunner, build_shotter_command, build_plot_command

44
scripts/start_web.sh Executable file
View File

@@ -0,0 +1,44 @@
#!/bin/bash
# Start both frontend and backend servers
# Usage: ./scripts/start_web.sh [frontend_port] [backend_port]
FRONTEND_PORT=${1:-5173}
BACKEND_PORT=${2:-8000}
echo "=========================================="
echo "BtToxin Pipeline Web Services"
echo "=========================================="
echo "Frontend: http://localhost:${FRONTEND_PORT}"
echo "Backend: http://localhost:${BACKEND_PORT}"
echo "=========================================="
echo ""
echo "Starting services..."
# Create jobs directory if it doesn't exist
mkdir -p jobs
echo "Jobs directory: $(pwd)/jobs"
# Start backend in background
echo "[Backend] Starting FastAPI server on port ${BACKEND_PORT}..."
uvicorn web.backend.main:app --reload --host 0.0.0.0 --port ${BACKEND_PORT} &
BACKEND_PID=$!
# Wait for backend to be ready
sleep 2
# Start frontend
echo "[Frontend] Starting Vite dev server on port ${FRONTEND_PORT}..."
cd frontend && pnpm dev --host --port ${FRONTEND_PORT} &
FRONTEND_PID=$!
echo ""
echo "=========================================="
echo "Services started:"
echo " - Backend (PID: ${BACKEND_PID}) on port ${BACKEND_PORT}"
echo " - Frontend (PID: ${FRONTEND_PID}) on port ${FRONTEND_PORT}"
echo "=========================================="
echo "Press Ctrl+C to stop all services"
echo ""
# Wait for any process to exit
wait