BootStrap: debootstrap
OSVersion: focal
MirrorURL: http://us.archive.ubuntu.com/ubuntu/

%files

%environment
    export PATH=/opt/usr/local/bin:$PATH
    export PATH=/opt/miniconda/bin:$PATH
    export PATH=/opt/diamond:$PATH
    export PATH=/opt/Prodigal:$PATH
    export PATH=/opt/exonerate-2.2.0-x86_64/bin:$PATH
    export PATH=/opt/jellyfish-2.2.10/bin:$PATH
    export PATH=/opt/pplacer-Linux-v1.1.alpha17:$PATH
    export PATH=/opt/FastANI:$PATH
    export PATH=/opt/FASTTREE:$PATH
    #export GTDBTK_DATA_PATH=/scratch/ulg/GENERA/Databases/GTDB/release202/
    export GTDBTK_DATA_PATH=release202/

%post
    # Ubuntu

    ## permissions
    chmod -R 777 /opt           # chmod775 can be enough
    chmod -R 777 /root          # chmod775 can be enough

    ## update repository for apt
    apt install -y software-properties-common
    apt-add-repository universe
    apt update

    ## UFT8
    apt install -y locales
    localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8

    #basic
    apt install git -y
    apt install python3.8 -y
    apt-get install python3-pip -y
    apt-get install wget -y
    apt-get install unzip -y
    apt-get install rsync -y
    apt install cpanminus -y
    apt-get install libssl-dev -y

    #instal conda
    cd /opt/
    wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
    bash Miniconda3-latest-Linux-x86_64.sh -b -p /opt/miniconda
    export PATH=/opt/miniconda/bin:$PATH
    conda install -c bioconda python=3.7 -y

    #Blast
    apt-get install ncbi-blast+ -y

    #Exonerate
    cd /opt/
    wget http://ftp.ebi.ac.uk/pub/software/vertebrategenomics/exonerate/exonerate-2.2.0-x86_64.tar.gz
    tar -xzf exonerate-2.2.0-x86_64.tar.gz
    export PATH=/opt/exonerate-2.2.0-x86_64/bin:$PATH

    #jellyfish
    cd /opt/
    wget https://github.com/gmarcais/Jellyfish/releases/download/v2.2.10/jellyfish-2.2.10.tar.gz
    tar -xzf jellyfish-2.2.10.tar.gz
    cd jellyfish-2.2.10
    ./configure && make && make install
    export PATH=/opt/jellyfish-2.2.10/bin:$PATH

    #checkm deps
    apt-get install -y hmmer
    cd /opt/
    wget https://github.com/matsen/pplacer/releases/download/v1.1.alpha17/pplacer-Linux-v1.1.alpha17.zip
    unzip pplacer-Linux-v1.1.alpha17.zip
    export PATH=/opt/pplacer-Linux-v1.1.alpha17:$PATH
    #Prodigal
    cd /opt
    git clone https://github.com/hyattpd/Prodigal
    cd Prodigal/
    make install
    export PATH=/opt/Prodigal:$PATH

    #Diamond
    cd /opt/
    mkdir diamond
    cd diamond/
    wget http://github.com/bbuchfink/diamond/releases/download/v2.0.4/diamond-linux64.tar.gz
    tar xzf diamond-linux64.tar.gz
    export PATH=/opt/diamond:$PATH

    #checkm
    cd /opt/
    pip3 install numpy
    pip3 install Pillow
    pip3 install matplotlib
    pip3 install pysam
    pip3 install checkm-genome
    mkdir checkm-data
    cd checkm-data/
    wget https://data.ace.uq.edu.au/public/CheckM_databases/checkm_data_2015_01_16.tar.gz
    tar -xzf checkm_data_2015_01_16.tar.gz
    cd ../
    checkm data setRoot checkm-data/

    #GTDB
    cd /opt/
    git clone https://github.com/ParBLiSS/FastANI
    cd FastANI
    apt install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev -y
    apt-get install libgsl-dev -y
    ./bootstrap.sh   
    ./configure
    make
    cd /opt/
    mkdir FASTTREE
    cd  FASTTREE
    wget http://www.microbesonline.org/fasttree/FastTree
    chmod a+x FastTree
    cd /opt/
    apt install mash -y
    #GTDBtk
    python -m pip install gtdbtk
    export GTDBTK_DATA_PATH=release202/
 
%runscript
    echo "This container contains : "
    CheckM

%help
    This is a container for contamination detection
 
%labels
    Author Luc Cornet
    Version v0.0.1
