From 12e68b13bee8170fe088b6add5ca430cdb7a35d0 Mon Sep 17 00:00:00 2001 From: Asya Khleborodova Date: Tue, 19 Dec 2023 16:52:53 -0500 Subject: [PATCH] raven_assembler updated with docker image (#9) --- config/containers.json | 1 + docker/raven_assembler/Dockerfile | 59 +++++++++++++++++++++++++++++++ docker/raven_assembler/README.md | 35 ++++++++++++++++++ workflow/Snakefile | 6 ++-- 4 files changed, 97 insertions(+), 4 deletions(-) create mode 100644 docker/raven_assembler/Dockerfile create mode 100644 docker/raven_assembler/README.md diff --git a/config/containers.json b/config/containers.json index 46aecee..49458a5 100644 --- a/config/containers.json +++ b/config/containers.json @@ -1,4 +1,5 @@ { "images": { + "raven": "docker://asyakhleborodova/raven_assembly:v0.1.0" } } diff --git a/docker/raven_assembler/Dockerfile b/docker/raven_assembler/Dockerfile new file mode 100644 index 0000000..63e090f --- /dev/null +++ b/docker/raven_assembler/Dockerfile @@ -0,0 +1,59 @@ +FROM ubuntu:22.04 + +RUN mkdir -p /opt2 && mkdir -p /data2 +WORKDIR /opt2 + +# Set time zone to US east coast +ENV TZ=America/New_York +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \ + && echo $TZ > /etc/timezone + +RUN apt-get update \ + && apt-get -y upgrade \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + build-essential \ + cmake \ + curl \ + gawk \ + git \ + gzip \ + g++ \ + libboost-dev \ + libcurl4-openssl-dev \ + libssl-dev \ + libxml2-dev \ + locales \ + # python/3.10.6 + python3 \ + python3-pip \ + samtools \ + wget \ + zlib1g-dev \ + && apt-get clean && apt-get purge \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + + +ENV CONDA_DIR /opt2/conda +RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \ + /bin/bash ~/miniconda.sh -b -p /opt2/conda + +# Put conda in path so we can use conda activate +ENV PATH=$CONDA_DIR/bin:$PATH + +# Set the locale +RUN localedef -i en_US -f UTF-8 en_US.UTF-8 + +############### INSTALL ################ +RUN ln -sf /usr/bin/python3 /usr/bin/python +RUN pip3 install --upgrade pip \ + && pip3 install matplotlib \ + && pip3 install numpy \ + && pip3 install pandas \ + && pip3 install scipy + +RUN conda install -y --channel=defaults --channel=bioconda --channel=conda-forge raven-assembler + +WORKDIR /opt2 + +COPY Dockerfile /opt2 +WORKDIR /data2 diff --git a/docker/raven_assembler/README.md b/docker/raven_assembler/README.md new file mode 100644 index 0000000..454b395 --- /dev/null +++ b/docker/raven_assembler/README.md @@ -0,0 +1,35 @@ +## Steps for Building Docker Images + +Directly below are instructions for building an image using the provided Dockerfile: + +```bash +# See listing of images on computer +docker image ls + +# Build from Dockerfile +docker build --no-cache -f Dockerfile --tag=raven_assembly:v0.1.0 . + +# Testing, take a peek inside +docker run -ti raven_assembly:v0.1.0 /bin/bash + +# Updating Tag before pushing to DockerHub +docker tag raven_assembly:v0.1.0 asyakhleborodova/raven_assembly:v0.1.0 +docker tag raven_assembly:v0.1.0 asyakhleborodova/raven_assembly # latest + +# Check out new tag(s) +docker image ls + +# Push new tagged image to DockerHub +docker push asyakhleborodova/raven_assembly:v0.1.0 +docker push asyakhleborodova/raven_assembly:latest +``` + +### Other Recommended Steps + +Scan your image for known vulnerabilities: + +```bash +docker scan raven_assembly:v0.1.0 +``` + +> **Please Note**: Any references to `asyakhleborodova` should be replaced your username if you would also like to push the image to a non-org account. diff --git a/workflow/Snakefile b/workflow/Snakefile index fefa0cc..df3c684 100644 --- a/workflow/Snakefile +++ b/workflow/Snakefile @@ -90,7 +90,7 @@ rule To_Fasta: params: rname="To_Fasta", samtools="samtools/1.9", - seqkit="seqkit/0.12.1", + seqkit="seqkit/2.2.0", dir=directory(join(workpath, "reads")), temp_ext = lambda w: ext[w.samples], FQ=join(workpath, "reads/{samples}.fastq") @@ -130,17 +130,15 @@ rule raven_assembly: dir=directory(join(workpath, "raven_assembly")), gfa="{samples}.raven.gfa", #conda: "envs/raven-assembler.yaml" + container: config['images']['raven'] threads: 32 shell: """ - source /data/NCBR/apps/genome-assembly/conda/etc/profile.d/conda.sh - conda activate raven-assembler mkdir -p {params.dir} cd {params.dir} #raven --threads {threads} {input} > {output.fa} raven --graphical-fragment-assembly {params.gfa} --threads {threads} {input} awk '$1 ~/S/ {{print ">"$2"\\n"$3}}' {output.gfa} > {output.fa} - conda deactivate """ # rule wtdbg2_assembly: