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

%files
    ANI_companion.py /opt/
    code-ANI.tt /opt/

%environment
    export PATH=/opt/usr/local/bin:$PATH
    export PATH=/opt/FastANI:$PATH
    export PATH=/opt/Bacsort/scripts:"$PATH"

%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
    apt-get install pdftk -y

    #Biomust
    #apt-get install -y libcam-pdf-perl
    #cpanm LWP::Simple --force
    #cpanm aliased --force
    #cpanm Bio::MUST::Core
    #cpanm Bio::MUST::Drivers
    #cpanm Bio::MUST::Apps::FortyTwo
    #cpanm Bio::MUST::Apps::Physeter

    #R
    apt install r-base -y
    wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
    add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
    apt update -y
    apt install -y --no-install-recommends r-base
    #apt-get install -y r-cran-ggplot2 -y
    R -e 'install.packages(c("ggplot2"))'
    R -e 'install.packages(c("tidyr"))'
    R -e 'install.packages(c("ape"))'
    R -e 'install.packages(c("phangorn"))'
    #tpage
    apt-get install libtemplate-perl -y

    #Fastani
    cd /opt/
    apt install -y autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev
    apt-get install -y libgsl-dev
    git clone https://github.com/ParBLiSS/FastANI
    cd FastANI/
    ./bootstrap.sh
    ./configure
    make
    export PATH=/opt/FastANI:$PATH

    #Orthoani
    ln -s /usr/bin/python3 /usr/bin/python
    pip3 install orthoani
    apt install -y ncbi-blast+

    #Bacsort
    cd /opt/
    git clone https://github.com/rrwick/Bacsort
    export PATH=/opt/Bacsort/scripts:"$PATH"

    cd /opt/
    git clone https://github.com/hcdenbakker/fANI2Tree

    #companion
    cd /opt/
    mkdir companion
    pip3 install click
    mv ANI_companion.py companion/ 

%runscript
    echo "This container contains : "

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