diff --git a/SpecImmune/Dockerfile b/SpecImmune/Dockerfile new file mode 100644 index 0000000..e609532 --- /dev/null +++ b/SpecImmune/Dockerfile @@ -0,0 +1,52 @@ +# Use Ubuntu as the base image +FROM ubuntu:latest + +# Install necessary packages and dependencies +RUN apt-get update && apt-get install -y \ + wget \ + software-properties-common \ + curl \ + git \ + unzip \ + build-essential \ + && rm -rf /var/lib/apt/lists/* + +# Set the working directory +WORKDIR /SpecImmune + +# Define SHELL +SHELL ["/bin/bash", "-c"] + +RUN git clone https://github.com/deepomicslab/SpecImmune.git /SpecImmune +RUN cd /SpecImmune; git checkout 96c41fcf7b7b822cc45bd511a7538fc3d879a227 + +# Download and install Miniconda +RUN wget -c https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh \ + && bash /tmp/miniconda.sh -b -p /opt/conda \ + && rm /tmp/miniconda.sh + +# Add Conda to PATH for build steps below +ENV PATH="/opt/conda/bin:/SpecImmune/bin:${PATH}" + +# active conda environment on entry +COPY docker/entrypoint.sh /opt/conda/bin/entrypoint.sh +RUN chmod +x /opt/conda/bin/entrypoint.sh + +RUN conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main +RUN conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r + +# Update Conda +RUN conda update -n base -c defaults conda -y && \ + conda clean --all && \ + conda env create -p /opt/conda/envs/SpecImmune -f /SpecImmune/environment.yml && \ + conda init +RUN echo "conda activate SpecImmune" >> ~/.bashrc + +# Make SpecImmune the default environment for all exec modes +# (including Singularity, which ignores ENTRYPOINT and .bashrc). +# Prepend the env's bin dir to PATH so its python/tools are found first. +ENV PATH="/opt/conda/envs/SpecImmune/bin:${PATH}" \ + CONDA_DEFAULT_ENV="SpecImmune" \ + CONDA_PREFIX="/opt/conda/envs/SpecImmune" + +ENTRYPOINT ["/opt/conda/bin/entrypoint.sh"] diff --git a/SpecImmune/entrypoint.sh b/SpecImmune/entrypoint.sh new file mode 100644 index 0000000..1570ae2 --- /dev/null +++ b/SpecImmune/entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Enable conda for this shell session +. /opt/conda/etc/profile.d/conda.sh +# Activate the specific environment +conda activate SpecImmune +# Execute the command passed to the Docker container (e.g., from CMD) +exec "$@" diff --git a/SpecImmune/readme.md b/SpecImmune/readme.md new file mode 100644 index 0000000..3980706 --- /dev/null +++ b/SpecImmune/readme.md @@ -0,0 +1,80 @@ +# SpecImmune Docker Setup and Testing Guide + +Place both `Dockerfile` and `.dockerignore` in the same directory. + +After completing all make_db operations, move the hg38 files into the `/db` directory. The directory structure should be: +``` +db/ +├── CYP +├── hg38/ +│ ├── hg38_no_alt.fa +│ ├── hg38_no_alt.fa.amb +│ ├── hg38_no_alt.fa.ann +│ ├── hg38_no_alt.fa.bwt +│ ├── hg38_no_alt.fa.fai +│ ├── hg38_no_alt.fa.pac +│ └── hg38_no_alt.fa.sa +├── HLA +├── HLA_CDS +├── IG_TR +├── KIR +``` +Once the above steps are completed, build the Docker image: +``` +docker build -t specimmune:v1.0.0 . +``` +Docker Test Cases +Display the program help documentation: +``` +docker run --rm specimmune:v1.0.1 +``` +Define directories: +``` +dir_db=${specimmune_installed_dir}/db/ +dir_test=${specimmune_installed_dir}/test +dir_db: The database directory that includes hg38 +dir_test: The test directory containing test data +``` +Example paths: +``` +dir_db=/data10/zq123/SpecImmune/db/ +dir_test=/data10/zq123/SpecImmune/test +``` +Run Test Cases: + +Test Case 1: HLA +``` +docker run --rm -v $dir_db:/SpecImmune/db -v $dir_test:/SpecImmune/test \ +specimmune:v1.0.0 --db /SpecImmune/db -r /SpecImmune/test/HLA/test_HLA_lite.fastq.gz \ +-j 15 -i HLA -n test_HLA -o /SpecImmune/test/test_20250204 \ +--align_method_1 minimap2 -y pacbio +``` +Test Case 2: KIR +``` +docker run --rm -v $dir_db:/SpecImmune/db -v $dir_test:/SpecImmune/test \ +specimmune:v1.0.0 --db /SpecImmune/db/ -r /SpecImmune/test/KIR/KIR_dp50_acc98_1.fastq.gz \ +-j 15 -i KIR -n test_new_KIR -o /SpecImmune/test/test_20250204 \ +--hete_p 0.2 --align_method_1 minimap2 -y pacbio +``` +Test Case 3: IG_TR +``` +docker run --rm -v $dir_db:/SpecImmune/db -v $dir_test:/SpecImmune/test \ +specimmune:v1.0.0 --db /SpecImmune/db/ -r /SpecImmune/test/IG_TR/vdj.fq.gz \ +-j 15 -i IG_TR -n test_TR -o /SpecImmune/test/test_20250204 -y pacbio \ +--hg38 /SpecImmune/db/hg38/hg38_no_alt.fa --align_method_1 minimap2 +``` +Test Case 4: CYP +``` +docker run --rm -v $dir_db:/SpecImmune/db -v $dir_test:/SpecImmune/test \ +specimmune:v1.0.0 --db /SpecImmune/db/ -r /SpecImmune/test/CYP/HG03579.CYP.fastq.0.1.fq.gz \ +-j 15 -i CYP -n test_CYP_nano -o /SpecImmune/test/test_20250204 -y nanopore \ +--hg38 /SpecImmune/db/hg38/hg38_no_alt.fa --align_method_1 minimap2 +``` +Run an Interactive Docker Session for Manual Testing +``` +docker run -it --rm -v $dir_db:/SpecImmune/db -v $dir_test:/SpecImmune/test \ +specimmune:v1.0.0 bash -c "source /opt/conda/bin/activate SpecImmune && \ +python /SpecImmune/scripts/main.py --db /SpecImmune/db/ -r /SpecImmune/test/HLA/test_HLA_lite.fastq.gz \ +-j 15 -i HLA -n test_HLA -o /SpecImmune/test/test_20250204 --align_method_1 minimap2 -y pacbio" +``` +Now your Docker image is built, and you can run various test cases for SpecImmune! \ No newline at end of file