forked from StaPH-B/docker-builds
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
143 lines (123 loc) · 5.21 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# global arg variables
ARG SHIGATYPER_VER="2.0.5"
ARG SAMTOOLSVER="1.9"
ARG BCFTOOLSVER="1.9"
ARG MINIMAP2_VER="2.24"
### start of builder stage ###
FROM ubuntu:jammy as builder
# re-instantiate these variables
ARG SHIGATYPER_VER
ARG SAMTOOLSVER
ARG BCFTOOLSVER
ARG MINIMAP2_VER
# so that apt doesn't ask for input
ARG DEBIAN_FRONTEND=noninteractive
# Install dependencies via apt-get; cleanup apt garbage
RUN apt-get update && apt-get install -y --no-install-recommends \
wget \
git \
libncurses5-dev \
libbz2-dev \
liblzma-dev \
libcurl4-gnutls-dev \
zlib1g-dev \
libssl-dev \
gcc \
make \
python3 \
python3-setuptools \
bzip2 \
gnuplot \
ca-certificates \
gawk \
curl \
build-essential && \
apt-get autoclean && rm -rf /var/lib/apt/lists/*
# shigatyper depends on samtools
RUN wget https://github.com/samtools/samtools/releases/download/${SAMTOOLSVER}/samtools-${SAMTOOLSVER}.tar.bz2 && \
tar -xjf samtools-${SAMTOOLSVER}.tar.bz2 && \
rm -v samtools-${SAMTOOLSVER}.tar.bz2 && \
cd samtools-${SAMTOOLSVER} && \
./configure && \
make && \
make install
# shigatyper depends on bcftools
RUN wget https://github.com/samtools/bcftools/releases/download/${BCFTOOLSVER}/bcftools-${BCFTOOLSVER}.tar.bz2 && \
tar -xjf bcftools-${BCFTOOLSVER}.tar.bz2 && \
rm -v bcftools-${BCFTOOLSVER}.tar.bz2 && \
cd bcftools-${BCFTOOLSVER} && \
make && \
make install
# shigatyper depends on minimap2
RUN curl -L https://github.com/lh3/minimap2/releases/download/v${MINIMAP2_VER}/minimap2-${MINIMAP2_VER}_x64-linux.tar.bz2 | tar -jxf -
# set the environment
ENV PATH="${PATH}:/minimap2-${MINIMAP2_VER}_x64-linux" \
LC_ALL=C
### start of app stage ###
# using fresh ubuntu:jammy image as base for app stage
FROM ubuntu:jammy as app
# re-instantiate thes variables
ARG SHIGATYPER_VER
ARG MINIMAP2_VER
# LABELS must be contained in `app` stage to pass the GHActions checks
LABEL base.image="ubuntu:jammy"
LABEL dockerfile.version="1"
LABEL software="shigatyper"
LABEL software.version="${SHIGATYPER_VER}"
LABEL description="Determine Shigella serotype using Illumina (single or paired-end) or Oxford Nanopore reads!"
LABEL website="https://github.com/CFSAN-Biostatistics/shigatyper"
LABEL license="https://github.com/CFSAN-Biostatistics/shigatyper/blob/master/LICENSE"
LABEL maintainer="John Arnn"
LABEL maintainer.email="[email protected]"
LABEL maintainer2="Curtis Kapsak"
LABEL maintainer2.email="[email protected]"
# copy in samtools and bcftools executables into app stage
COPY --from=builder /usr/local/bin/* /usr/local/bin
# copy in minimap2 executable into app stage
COPY --from=builder /minimap2-${MINIMAP2_VER}_x64-linux /usr/local/bin
# ensuring samtools & bcftools dependencies are present (dependencies for running tools, not for compiling/installing tools)
RUN apt-get update && apt-get install --no-install-recommends -y \
perl \
zlib1g \
libncurses5 \
bzip2 \
liblzma-dev \
libcurl4-gnutls-dev \
python3 \
python3-setuptools \
wget \
ca-certificates \
&& apt-get autoclean && rm -rf /var/lib/apt/lists/*
# get shigatyper code; install; index fasta file
# FYI - samtools faidx cmd has a * in the path due to version inconsistencies
RUN wget https://github.com/CFSAN-Biostatistics/shigatyper/archive/refs/tags/${SHIGATYPER_VER}.tar.gz && \
tar -xf ${SHIGATYPER_VER}.tar.gz && \
rm -v ${SHIGATYPER_VER}.tar.gz && \
cd shigatyper-${SHIGATYPER_VER} && \
python3 setup.py install && \
samtools faidx /usr/local/lib/python3.10/dist-packages/ShigaTyper-*-py3.10.egg/resources/ShigellaRef5.fasta
# ensuring final working directory is /data
WORKDIR /data
# default command is to pull up help options; can be overridden of course
CMD ["shigatyper", "--help"]
### start of test stage ###
# using app stage as base image for test stage
FROM app as test
# fetch test data from ENA FTP
# SRR8186675 = https://www.ncbi.nlm.nih.gov/biosample/SAMN10040549 , expect Shigella boydii serotype 12
# SRR7738178 = https://www.ncbi.nlm.nih.gov/biosample/SAMN09878976 , expect Shigella sonnei (I think Form II?)
# SRR8186651 = https://www.ncbi.nlm.nih.gov/biosample/SAMN10052840 , expect Shigella flexneri serotype 3a
RUN echo "downloading test FASTQ files from ENA's FTP, please be patient..." && \
wget -q -P /data ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR818/005/SRR8186675/SRR8186675_1.fastq.gz && \
wget -q -P /data ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR818/005/SRR8186675/SRR8186675_2.fastq.gz && \
wget -q -P /data ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR773/008/SRR7738178/SRR7738178_1.fastq.gz && \
wget -q -P /data ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR773/008/SRR7738178/SRR7738178_2.fastq.gz && \
wget -q -P /data ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR818/001/SRR8186651/SRR8186651_1.fastq.gz && \
wget -q -P /data/ ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR818/001/SRR8186651/SRR8186651_2.fastq.gz
# actually run shigatyper on test fastq files; ls to see output filenames
RUN shigatyper --R1 /data/SRR8186675_1.fastq.gz --R2 /data/SRR8186675_2.fastq.gz --name SRR8186675 && \
shigatyper --R1 /data/SRR7738178_1.fastq.gz --R2 /data/SRR7738178_2.fastq.gz --name SRR7738178 && \
shigatyper --R1 /data/SRR8186651_1.fastq.gz --R2 /data/SRR8186651_2.fastq.gz --name SRR8186651 && \
echo && \
ls -lh && \
shigatyper --version