From 4c2ad1c30298f4e9f4304b384d0abc87944e2bfe Mon Sep 17 00:00:00 2001 From: Jaden Date: Mon, 21 Jun 2021 16:13:40 -0700 Subject: [PATCH 1/5] add docker support to imrep --- Dockerfile | 33 +++++++++++++++++++++++++++++++++ README.md | 14 ++++++++++++++ requirements.txt | 6 ++++++ 3 files changed, 53 insertions(+) create mode 100644 Dockerfile create mode 100644 requirements.txt diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9737fa1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +FROM ubuntu:18.04 + +ENV PATH /opt/conda/bin:$PATH +RUN apt-get update --fix-missing +RUN apt-get install -y build-essential \ + wget \ + bzip2 \ + samtools \ + libbam-dev \ + libhts-dev \ + python-minimal + +RUN apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +ENV PATH="/root/miniconda3/bin:${PATH}" +ARG PATH="/root/miniconda3/bin:${PATH}" + +RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \ + && mkdir /root/.conda \ + && bash Miniconda3-latest-Linux-x86_64.sh -b \ + && rm -f Miniconda3-latest-Linux-x86_64.sh + +RUN pip install --upgrade pip + +WORKDIR /imrep +COPY . . + +RUN cd suffix_tree && python ./setup.py install --user && cd .. + +RUN pip install -r requirements.txt + +ENTRYPOINT ["python", "./imrep.py"] \ No newline at end of file diff --git a/README.md b/README.md index bbfe644..275c754 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,20 @@ Note : ImReP is written in Python2.7. So if your cluster default Python version Find ImReP analysis in _toyExample_ directory. Learn more [here](https://github.com/mandricigor/imrep/wiki/Quick-Start) +## Docker Usage +Build the docker container from the current working directory: +``` +docker build -t imrep . +``` +Run the docker container and pass in the necessary `` +``` +docker run --rm -ti imrep +``` +Here is a full example with Docker: +``` +docker build -t imrep . +docker run --rm -ti imrep --bam example/toyExample.bam example/toyExample.cdr3 +``` # ImReP Tutorial Use the sidebar on the right to navigate ImReP tutorial. Get started with a toy example of 200 RNA-Seq reads (_example/toyExample.bam_) distributed with ImRep package diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..2f71f9c --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +biopython==1.76.0 +intervaltree==3.1.0 +jellyfish==0.4.0 +networkx==2.5.1 +numpy==1.20.3 +pysam==0.16.0.1 From a694b1546414289f5e2d0079f9788d575f84bdca Mon Sep 17 00:00:00 2001 From: Jaden Date: Tue, 22 Jun 2021 09:33:11 -0700 Subject: [PATCH 2/5] Improve Docker docs --- README.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 275c754..9844782 100644 --- a/README.md +++ b/README.md @@ -6,19 +6,19 @@ ImReP is a method for rapid and accurate profiling of the adaptive immune repertoires from regular RNA-Seq data Download ImReP using -``` +```bash git clone https://github.com/mandricigor/imrep.git ``` Install ImReP from the base directory -``` +```bash cd imrep ./install.sh ``` Run ImReP analysis by a single command for the BAM file with mapped and unmapped reads (preferred). BAM file needs to be indexed (.bai file). Forgot to save unmapped reads, we got you covered. Learn more [here](https://github.com/mandricigor/imrep/wiki/Forgot-to-save-unmapped-reads%3F) -``` +```bash python imrep.py --bam example/toyExample.bam example/toyExample.cdr3 ``` @@ -28,16 +28,22 @@ Find ImReP analysis in _toyExample_ directory. Learn more [here](https://github. ## Docker Usage -Build the docker container from the current working directory: -``` +Docker enables you to run ImRep without needing to explicitly install and manage its dependencies. You can install and learn more about Docker [here](https://www.docker.com/products/docker-desktop). + +First, build the docker container from the current working directory: +```bash +git clone https://github.com/Mangul-Lab-USC/imrep.git +# Make sure you are in the correct directory... +cd imrep +# build the docker container and give it a `-t` docker build -t imrep . ``` -Run the docker container and pass in the necessary `` -``` +Run the docker container and pass in your intended ``. +```bash docker run --rm -ti imrep ``` Here is a full example with Docker: -``` +```bash docker build -t imrep . docker run --rm -ti imrep --bam example/toyExample.bam example/toyExample.cdr3 ``` From 083068d57d28e1ac37183d4ed285188b81f4fa61 Mon Sep 17 00:00:00 2001 From: Jaden Date: Tue, 22 Jun 2021 09:36:05 -0700 Subject: [PATCH 3/5] Update install.sh to use requirements.txt This change gives us one source of truth for dependency versions and management. --- install.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 2cf6b8e..de9121f 100755 --- a/install.sh +++ b/install.sh @@ -1,9 +1,4 @@ -pip install pysam --user -pip install biopython==1.76 --user -pip install intervaltree --user -pip install jellyfish==0.5.4 --user -pip install numpy --user -pip install networkx --user +pip install -r requirements.txt cd suffix_tree python setup.py install --user cd .. From 2c591af157cca542dbbc8a49498edbcfec7c53dd Mon Sep 17 00:00:00 2001 From: Jaden Date: Wed, 23 Jun 2021 13:08:23 -0700 Subject: [PATCH 4/5] Clean up Dockerfile - Remove unnecessary ENV var - remove --quiet tag - remove unncessary cd out of suffix tree since we set a WORKDIR anyway, it automatically navigates to that DIR after the command finishes. --- Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9737fa1..0752680 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,5 @@ FROM ubuntu:18.04 -ENV PATH /opt/conda/bin:$PATH RUN apt-get update --fix-missing RUN apt-get install -y build-essential \ wget \ @@ -16,7 +15,7 @@ RUN apt-get clean && \ ENV PATH="/root/miniconda3/bin:${PATH}" ARG PATH="/root/miniconda3/bin:${PATH}" -RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \ +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \ && mkdir /root/.conda \ && bash Miniconda3-latest-Linux-x86_64.sh -b \ && rm -f Miniconda3-latest-Linux-x86_64.sh @@ -26,7 +25,7 @@ RUN pip install --upgrade pip WORKDIR /imrep COPY . . -RUN cd suffix_tree && python ./setup.py install --user && cd .. +RUN cd suffix_tree && python ./setup.py install --user RUN pip install -r requirements.txt From a0974bf8c8b92e0a17c466ad0988216318bb4e81 Mon Sep 17 00:00:00 2001 From: Jaden Date: Wed, 23 Jun 2021 16:58:18 -0700 Subject: [PATCH 5/5] Add Docker volume instructions to actually receive the output files --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9844782..087c03c 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Find ImReP analysis in _toyExample_ directory. Learn more [here](https://github. ## Docker Usage -Docker enables you to run ImRep without needing to explicitly install and manage its dependencies. You can install and learn more about Docker [here](https://www.docker.com/products/docker-desktop). +Docker enables you to run ImRep without needing to explicitly install and manage its dependencies. You can learn more about Docker [here](https://docs.docker.com/get-started/overview/). First, build the docker container from the current working directory: ```bash @@ -38,14 +38,16 @@ cd imrep # build the docker container and give it a `-t` docker build -t imrep . ``` -Run the docker container and pass in your intended ``. +Run the docker container like so, and pass in your intended ImRep ``. ```bash -docker run --rm -ti imrep +docker run --rm -v ${PWD}:/imrep -ti imrep ``` +In this case, we mount a Docker [volume](https://docs.docker.com/storage/volumes/) `-v` to recieve the output generated from within the container locally. + Here is a full example with Docker: ```bash docker build -t imrep . -docker run --rm -ti imrep --bam example/toyExample.bam example/toyExample.cdr3 +docker run --rm -v ${PWD}:/imrep -ti imrep --bam example/toyExample.bam example/toyExample.cdr3 ``` # ImReP Tutorial