116 lines
2.6 KiB
Docker
116 lines
2.6 KiB
Docker
FROM ubuntu:bionic
|
|
|
|
ENV R_VERSION=3.6.3
|
|
ENV ROCKER_VERSION=4.1.1
|
|
ENV R_HOME=/usr/local/lib/R
|
|
ENV TZ=Etc/UTC
|
|
ENV SAMTOOLS_VERSION=1.2
|
|
|
|
RUN <<END_RUN_CMD
|
|
# Install R
|
|
apt-get update
|
|
apt-get install --no-install-recommends -y \
|
|
curl \
|
|
ca-certificates
|
|
curl -L "https://github.com/rocker-org/rocker-versioned2/archive/refs/tags/R${ROCKER_VERSION}.tar.gz" | tar xvz
|
|
./rocker-versioned2-R${ROCKER_VERSION}/scripts/install_R.sh
|
|
rm -rf rocker-versioned2-R${ROCKER_VERSION}
|
|
|
|
# Install BioPerl
|
|
apt-get update
|
|
apt-get install --no-install-recommends -y \
|
|
curl \
|
|
perl \
|
|
cpanminus \
|
|
build-essential \
|
|
make \
|
|
libexpat1-dev \
|
|
libssl-dev \
|
|
zlib1g-dev \
|
|
libncurses5-dev
|
|
cpanm -n -v Bio::Seq Bio::SeqIO Perl4::CoreLibs
|
|
|
|
# Install R packages
|
|
install2.r --error --skipinstalled BiocManager
|
|
R -e "BiocManager::install(c('Biostrings', 'seqinr'))"
|
|
|
|
# Install samtools
|
|
curl -L "https://github.com/samtools/samtools/releases/download/${SAMTOOLS_VERSION}/samtools-${SAMTOOLS_VERSION}.tar.bz2" | tar xvj
|
|
cd samtools-${SAMTOOLS_VERSION} && make && make install && cd ..
|
|
rm -rf samtools-${SAMTOOLS_VERSION}
|
|
|
|
# Install viquas
|
|
mkdir /viquas && \
|
|
curl -L "https://master.dl.sourceforge.net/project/viquas/ViQuaS1.3.tar.gz" | tar xvz -C /viquas --strip-components=1
|
|
|
|
# Cleanup
|
|
apt-get remove -y \
|
|
build-essential \
|
|
make \
|
|
curl
|
|
rm -rf /var/lib/apt/lists
|
|
END_RUN_CMD
|
|
|
|
RUN <<END_RUN_CMD
|
|
cat << 'EOF' > /usr/bin/viquas
|
|
#!/bin/sh
|
|
USAGE="
|
|
USAGE:
|
|
viquas reference.fsa reads.bam [o r perform_richness diversity_region_length]
|
|
"
|
|
|
|
NUM_ARGS=$#
|
|
case $NUM_ARGS in
|
|
2)
|
|
;;
|
|
6)
|
|
;;
|
|
*)
|
|
echo "${USAGE}"
|
|
echo "Incorrect number of arguments: expecting 2 or 6"
|
|
exit 1
|
|
esac
|
|
|
|
PWD_BACKUP=$PWD
|
|
|
|
if [ ! -f "${1}" ]; then
|
|
echo "Error: ${1} is not a file"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f "${2}" ]; then
|
|
echo "Error: ${2} is not a file"
|
|
exit 1
|
|
fi
|
|
|
|
REFERENCE_FILE=$(basename "${1}")
|
|
BAM_FILE=$(basename "${2}")
|
|
|
|
cp "${1}" /viquas
|
|
cp "${2}" /viquas
|
|
|
|
cd /viquas || exit 1
|
|
|
|
case $NUM_ARGS in
|
|
2)
|
|
Rscript /viquas/ViQuaS.R "${REFERENCE_FILE}" "${BAM_FILE}"
|
|
;;
|
|
6)
|
|
Rscript /viquas/ViQuaS.R "${REFERENCE_FILE}" "${BAM_FILE}" "${@[3:]}"
|
|
;;
|
|
*)
|
|
echo "${USAGE}"
|
|
echo "Incorrect number of arguments: expecting 2 or 6"
|
|
exit 1
|
|
esac
|
|
|
|
mv /viquas/ViQuaS-Spectrum.fa "${PWD_BACKUP}"
|
|
mv /viquas/ViQuaS-Richness.txt "${PWD_BACKUP}" 2> /dev/null
|
|
|
|
cd "${PWD_BACKUP}" || exit 1
|
|
EOF
|
|
chmod +x /usr/bin/viquas
|
|
chmod -R 777 /viquas
|
|
END_RUN_CMD
|
|
|
|
ENTRYPOINT [ "viquas" ]
|