Bootstrap: docker
From: ubuntu:20.04

%labels
MAINTAINER Sebastien RAVEL
version="1.0"
software="Conda4RattleSNP"
description="Conda dependence for RattleSNP"
website="https://rattleSNP.readthedocs.io/en/latest/"

%environment
export PATH="$PATH:/usr/local/miniconda/miniconda3/envs/samtools-bwa-atropos-fastqc/bin"
export PATH="$PATH:/usr/local/miniconda/miniconda3/envs/picard/bin"
export PATH="$PATH:/usr/local/miniconda/miniconda3/envs/gatk4/bin"
export PATH="$PATH:/usr/local/miniconda/miniconda3/envs/bcftools-vcftools/bin"
export PATH="$PATH:/usr/local/miniconda/miniconda3/envs/raxml/bin"
export CONDARC="/.condarc"
export LC_ALL=C

%post
# Set timezone:
TZ=Europe/Paris
DEBIAN_FRONTEND=noninteractive
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Install dependencies:
apt-get update && apt-get install -y tzdata cython

apt update && apt install -y wget python3.8 python3-pip make
# for pysam
apt-get install -y autoconf automake make gcc perl zlib1g-dev libbz2-dev liblzma-dev libcurl4-gnutls-dev libssl-dev
wget https://github.com/samtools/htslib/releases/download/1.15/htslib-1.15.tar.bz2
tar -xf htslib-1.15.tar.bz2
cd htslib-1.15 && ./configure && make && make install && cd ..


apt install -y r-base-core
python3 -m pip install --no-cache-dir install cython
python3 -m pip install --no-cache-dir install pysamstats
python3 -m pip install --no-cache-dir PyYAML pandas matplotlib tabulate rpy2
python3 -m pip install --no-cache-dir biopython argparse
python3 -m pip install --no-cache-dir numpy
python3 -m pip install --no-cache-dir snakemake
python3 -m pip install --no-cache-dir click>=8.0.3
python3 -m pip install --no-cache-dir cookiecutter
python3 -m pip install --no-cache-dir --upgrade --upgrade-strategy eager --no-cache-dir pysamstats numpy

mkdir /usr/local/miniconda && cd /usr/local/miniconda
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod +x Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh -b -p /usr/local/miniconda/miniconda3
rm Miniconda3-latest-Linux-x86_64.sh
cd /usr/local/miniconda/miniconda3/bin
export PATH="/usr/local/miniconda/miniconda3/bin:$PATH" >> $SINGULARITY_ENVIRONMENT

conda config --add channels defaults
conda config --add channels bioconda
conda config --add channels conda-forge

conda create -n samtools-bwa-atropos-fastqc
conda install samtools -n samtools-bwa-atropos-fastqc
conda install bwa -n samtools-bwa-atropos-fastqc
conda install atropos -n samtools-bwa-atropos-fastqc
conda install fastqc -n samtools-bwa-atropos-fastqc
conda clean --all --yes

conda create -n picard
conda install picard -n picard
conda clean --all --yes

conda create -n gatk4
conda install gatk4 -n gatk4
conda clean --all --yes

conda create -n bcftools-vcftools
conda install bcftools -n bcftools-vcftools
conda install vcftools -n bcftools-vcftools
conda clean --all --yes

conda create -n raxml
conda install raxml -n raxml
conda install raxml-ng -n raxml
conda clean --all --yes

%runscript
exec /bin/bash "$@"

