# bismark container definition file - see %help section
# Created : 2024-06-12
# Last updated : 2024-06-13
# authors : valentin.vautrot@u-bourgogne.fr

BootStrap: docker
From: ubuntu:22.04

%help 
Description : This is a singularity/apptainer container packing bismark v0.24.2. It can be run by mounting a host bowtie2 installation directory, preferably towards /usr/bin/bowtie2/ destination to avoid PATH problems. Python2 is installed with the required librairies to run the miniconda version of bowtie2-2.3.2 present on the ccub.
exemple : singularity exec -e --bind /work/gad/shared/bin/bowtie2-2.3.2/:/usr/bin/bowtie2[:options],<python2_directory>:/usr/bin/python/ <path/to/this/container.sif> bismark [--<options>] --genome <path/to/bismark/converted/genome> <fastq.file>
Use "singularity test <path/to/this/container.sif>" to see --version calls of installed softwares.
This container has no runscripts.
Authors : valentin.vautrot@u-bourgogne.fr

%post
export DEBIAN_FRONTEND=noninteractive

apt-get update
apt-get install -y --no-install-recommends apt-utils
apt-get install -y --no-install-recommends \
    locales \
    language-pack-fr \
    wget \
    samtools \
    python2.7 \
    python2.7-dev \
    libtbb2

ln -s /usr/bin/python2.7 /usr/bin/python

# install perl and required librairies and tools
apt-get install -y --no-upgrade --no-install-recommends \
    perl \
    build-essential \
    cpanminus \
    pkg-config \
    libgd3 \
    libgd-dev \
    libpng16-16 \
    libimage-png-libpng-perl \
    libfont-freetype-perl

# install GD for perl
cpan -v
cpanm -v
cpan App::cpanminus
cpanm ExtUtils::PkgConfig
cpanm GD
cpanm GD::Graph

# get bismark code (no repo)
wget -P /usr/bin/bismark --no-check-certificate https://github.com/FelixKrueger/Bismark/archive/refs/tags/v0.24.2.tar.gz
tar -xvzf /usr/bin/bismark/v0.24.2.tar.gz -C /usr/bin/
rm -rf /usr/bin/bismark/

# create mount directory for bowtie2 bind, to avoid problems
mkdir /usr/bin/bowtie2


%environment
export PATH=${PATH}:/usr/bin/samtools/:/usr/bin/Bismark-0.24.2/:/usr/bin/bowtie2/:/usr/bin/python:/usr/bin/python2.7:/usr/lib/x86_64-linux-gnu/:/usr/lib/python2.7/
export PYTHON=/usr/bin/python
export LANGUAGE=fr_FR.UTF-8
export LC_ALL=fr_FR.UTF-8
export LANG=fr_FR.UTF-8
export LC_CTYPE=fr_FR.UTF-8

%test
samtools --version
echo "############################"
bismark --version
echo "############################"
echo "PATH variable : $PATH "

%labels
Author valentin.vautrot
container_version 0.1
Ubuntu_version 22.04