|
| 1 | +FROM ubuntu:jammy AS app |
| 2 | + |
| 3 | +ARG AMRFINDER_VER="4.0.3" |
| 4 | +ARG AMRFINDER_DB_VER="2024-12-18.1" |
| 5 | +ARG BLAST_VER="2.16.0" |
| 6 | + |
| 7 | +LABEL base.image="ubuntu:jammy" |
| 8 | +LABEL dockerfile.version="1" |
| 9 | +LABEL software="NCBI AMRFinderPlus" |
| 10 | +LABEL software.version="${AMRFINDER_VER}" |
| 11 | +LABEL description="NCBI resistance gene detection tool" |
| 12 | +LABEL website="https://github.com/ncbi/amr" |
| 13 | +LABEL license="https://github.com/ncbi/amr/blob/master/LICENSE" |
| 14 | +LABEL maintainer="Kelsey Florek" |
| 15 | +LABEL maintainer.email="kelsey.florek@slh.wisc.edu" |
| 16 | +LABEL maintainer2="Curtis Kapsak" |
| 17 | +LABEL maintainer2.email="kapsakcj@gmail.com" |
| 18 | +LABEL maintainer3="Anders Goncalves da Silva" |
| 19 | +LABEL maintainer3.email="andersgs@gmail.com" |
| 20 | +LABEL maintainer4="Erin Young" |
| 21 | +LABEL maintainer4.email="eriny@utah.gov" |
| 22 | +LABEL maintainer5="Holly McQueary" |
| 23 | +LABEL maintainer5.email="holly.c.mcqueary@mass.gov" |
| 24 | + |
| 25 | +# ncbi-blast+ installed via apt is v2.12.0 - DISABLING so that we can manually install a more recent version |
| 26 | +# see here for reason why I'm manualy installing 2.14.0 instead of using apt-get: https://github.com/ncbi/amr/releases/tag/amrfinder_v3.11.8 |
| 27 | + |
| 28 | +# hmmer installed via apt is v3.3.2 |
| 29 | +# removed because likely unnecessary since we are not compiling from source: make g++ |
| 30 | +# libgomp1 required for makeblastdb |
| 31 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 32 | + ca-certificates \ |
| 33 | + wget \ |
| 34 | + curl \ |
| 35 | + libgomp1 \ |
| 36 | + hmmer \ |
| 37 | + procps \ |
| 38 | + gzip && \ |
| 39 | + apt-get autoclean && \ |
| 40 | + rm -rf /var/lib/apt/lists/* |
| 41 | + |
| 42 | +# download and install amrfinderplus pre-compiled binaries; make /data |
| 43 | +RUN mkdir amrfinder && cd /amrfinder && \ |
| 44 | + echo "downloading amrfinderplus v${AMRFINDER_VER} pre-compiled binaries from GitHub..." && \ |
| 45 | + wget -q https://github.com/ncbi/amr/releases/download/amrfinder_v${AMRFINDER_VER}/amrfinder_binaries_v${AMRFINDER_VER}.tar.gz && \ |
| 46 | + tar zxf amrfinder_binaries_v${AMRFINDER_VER}.tar.gz && \ |
| 47 | + rm -v amrfinder_binaries_v${AMRFINDER_VER}.tar.gz && \ |
| 48 | + mkdir -v /data |
| 49 | + |
| 50 | +# install ncbi-blast linux binaries |
| 51 | +RUN echo "downloading ncbi-blast-${BLAST_VER}+ linux binaries from NCBI FTP..." && \ |
| 52 | + wget -q https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/${BLAST_VER}/ncbi-blast-${BLAST_VER}+-x64-linux.tar.gz && \ |
| 53 | + tar -xzf ncbi-blast-${BLAST_VER}+-x64-linux.tar.gz && \ |
| 54 | + rm -v ncbi-blast-${BLAST_VER}+-x64-linux.tar.gz |
| 55 | + |
| 56 | +# set PATH and locale settings for singularity compatibiliity, set amrfinder and manually-installed blast as higher priority in PATH |
| 57 | +ENV PATH="/amrfinder:/ncbi-blast-${BLAST_VER}+/bin:$PATH" \ |
| 58 | + LC_ALL=C |
| 59 | + |
| 60 | +# download databases and index them |
| 61 | +# done in this manner to pin the database version instead of pulling the latest version with `amrfinder -u` |
| 62 | +# softlink is required for `amrfinder -l` and typical `amrfinder` use cases to work properly |
| 63 | +RUN mkdir -p /amrfinder/data/${AMRFINDER_DB_VER} && \ |
| 64 | + echo "Downloading amrfinder databases and indexing them now..." && \ |
| 65 | + wget -q -P /amrfinder/data/${AMRFINDER_DB_VER} ftp://ftp.ncbi.nlm.nih.gov/pathogen/Antimicrobial_resistance/AMRFinderPlus/database/4.0/${AMRFINDER_DB_VER}/* && \ |
| 66 | + amrfinder_index /amrfinder/data/${AMRFINDER_DB_VER} && \ |
| 67 | + ln -s /amrfinder/data/${AMRFINDER_DB_VER} /amrfinder/data/latest |
| 68 | + |
| 69 | +# set final working directory |
| 70 | +WORKDIR /data |
| 71 | + |
| 72 | +# default command is to print help options |
| 73 | +CMD [ "amrfinder", "--help" ] |
| 74 | + |
| 75 | +## Test stage |
| 76 | +FROM app AS test |
| 77 | + |
| 78 | +# list database version and available --organism options |
| 79 | +RUN amrfinder -l |
| 80 | + |
| 81 | +# run recommended tests from amrfinder; check that stx2a_operon is detected in outputs, meaning stxtyper ran correctly |
| 82 | +RUN cd /amrfinder && \ |
| 83 | + bash test_amrfinder.sh . && \ |
| 84 | + echo && echo "Checking for stx2a_operon string in test outputs..." && \ |
| 85 | + grep 'stx2a_operon' test_both.got |
| 86 | + |
| 87 | +# run amrfinder on Salmonella, without and with --organism option |
| 88 | +RUN echo "Downloading Salmonella genome (GCA_010941835.1_PDT000052640.3) for testing now..." && \ |
| 89 | + wget -q https://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/010/941/835/GCA_010941835.1_PDT000052640.3/GCA_010941835.1_PDT000052640.3_genomic.fna.gz && \ |
| 90 | + amrfinder --threads 4 --plus --nucleotide GCA_010941835.1_PDT000052640.3_genomic.fna.gz --output test1.txt && \ |
| 91 | + amrfinder --threads 4 --plus --nucleotide GCA_010941835.1_PDT000052640.3_genomic.fna.gz --organism Salmonella --output test2.txt && \ |
| 92 | + head test1.txt test2.txt |
| 93 | + |
| 94 | +# run amrfinder on Klebesiella oxytoca using --organism/-O flag |
| 95 | +RUN echo "Downloading Klebsiella oxytoca genome (GCA_003812925.1_ASM381292v1) for testing now..." && \ |
| 96 | + wget -q https://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/003/812/925/GCA_003812925.1_ASM381292v1/GCA_003812925.1_ASM381292v1_genomic.fna.gz && \ |
| 97 | + amrfinder --threads 4 --plus --name GCA_003812925.1 -n GCA_003812925.1_ASM381292v1_genomic.fna.gz -O Klebsiella_oxytoca -o GCA_003812925.1-amrfinder.tsv && \ |
| 98 | + head GCA_003812925.1-amrfinder.tsv |
| 99 | + |
| 100 | +# test that gunzip is installed |
| 101 | +RUN gunzip --help |
0 commit comments