Initial commit: BtToxin Pipeline project structure
This commit is contained in:
46
docker/digger/Dockerfile
Normal file
46
docker/digger/Dockerfile
Normal file
@@ -0,0 +1,46 @@
|
||||
# BtToxin_Digger Docker 镜像
|
||||
FROM continuumio/miniconda3:4.10.3
|
||||
|
||||
LABEL maintainer="your-email@example.com" \
|
||||
description="BtToxin_Digger for Pipeline" \
|
||||
version="1.0.10"
|
||||
|
||||
ENV LANG=C.UTF-8 \
|
||||
PATH=/opt/conda/envs/bttoxin/bin:$PATH \
|
||||
CONDA_DEFAULT_ENV=bttoxin \
|
||||
PYTHONUNBUFFERED=1
|
||||
|
||||
# 配置 conda
|
||||
RUN conda config --add channels defaults && \
|
||||
conda config --add channels bioconda && \
|
||||
conda config --add channels conda-forge && \
|
||||
conda config --set channel_priority flexible && \
|
||||
conda install -n base -c conda-forge mamba -y
|
||||
|
||||
# 安装 BtToxin_Digger
|
||||
RUN mamba install -y \
|
||||
python=3.7.10 \
|
||||
perl=5.26.2 && \
|
||||
mamba install -y \
|
||||
bttoxin_digger=1.0.10 && \
|
||||
conda clean -afy
|
||||
|
||||
# 安装额外工具
|
||||
RUN apt-get update && apt-get install -y \
|
||||
curl wget jq git && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 创建工作目录
|
||||
RUN mkdir -p /workspace/input /workspace/output /workspace/logs
|
||||
|
||||
WORKDIR /workspace
|
||||
|
||||
# 复制入口脚本
|
||||
COPY entrypoint.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
|
||||
CMD BtToxin_Digger --version || exit 1
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
CMD ["--help"]
|
||||
84
docker/digger/entrypoint.sh
Executable file
84
docker/digger/entrypoint.sh
Executable file
@@ -0,0 +1,84 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m'
|
||||
|
||||
log_info() {
|
||||
echo -e "${GREEN}[INFO]${NC} $1"
|
||||
}
|
||||
|
||||
log_warn() {
|
||||
echo -e "${YELLOW}[WARN]${NC} $1"
|
||||
}
|
||||
|
||||
log_error() {
|
||||
echo -e "${RED}[ERROR]${NC} $1"
|
||||
}
|
||||
|
||||
init() {
|
||||
log_info "Initializing BtToxin_Digger environment..."
|
||||
|
||||
if ! BtToxin_Digger --version &>/dev/null; then
|
||||
log_error "BtToxin_Digger not found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log_info "BtToxin_Digger $(BtToxin_Digger --version)"
|
||||
log_info "Python $(python --version)"
|
||||
log_info "Perl $(perl --version | head -2 | tail -1)"
|
||||
}
|
||||
|
||||
update_db() {
|
||||
log_info "Updating BtToxin_Digger database..."
|
||||
if BtToxin_Digger --update-db; then
|
||||
log_info "Database updated successfully"
|
||||
else
|
||||
log_warn "Database update failed, using existing database"
|
||||
fi
|
||||
}
|
||||
|
||||
run_analysis() {
|
||||
log_info "Starting toxin mining analysis..."
|
||||
log_info "Input: $INPUT_PATH"
|
||||
log_info "Type: $SEQUENCE_TYPE"
|
||||
log_info "Threads: $THREADS"
|
||||
|
||||
BtToxin_Digger \
|
||||
--SeqPath "$INPUT_PATH" \
|
||||
--SequenceType "$SEQUENCE_TYPE" \
|
||||
--Scaf_suffix "$SCAF_SUFFIX" \
|
||||
--threads "$THREADS" \
|
||||
2>&1 | tee /workspace/logs/digger.log
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
log_info "Analysis completed successfully"
|
||||
else
|
||||
log_error "Analysis failed!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
INPUT_PATH="${INPUT_PATH:-/workspace/input}"
|
||||
SEQUENCE_TYPE="${SEQUENCE_TYPE:-nucl}"
|
||||
SCAF_SUFFIX="${SCAF_SUFFIX:-.fna}"
|
||||
THREADS="${THREADS:-4}"
|
||||
UPDATE_DB="${UPDATE_DB:-false}"
|
||||
|
||||
init
|
||||
|
||||
if [ "$UPDATE_DB" = "true" ]; then
|
||||
update_db
|
||||
fi
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
exec BtToxin_Digger "$@"
|
||||
else
|
||||
run_analysis
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user