bootstrap: docker
From: ubuntu:20.04

%help
    This container provides portable & reproducible components for GoSTRIPES:
    Workflows for STRIPE-seq data analysis (from Brendel Group).
    Please see https://github.com/BrendelGroup/GoSTRIPES for complete documentation.

%post
    export DEBIAN_FRONTEND=noninteractive
    apt -y update
    apt -y install build-essential
    apt -y install bc git tcsh tzdata unzip zip wget
    apt -y install cpanminus
    apt -y install cython cython3
    apt -y install openjdk-8-jdk
    apt -y install software-properties-common
    apt -y install libbz2-dev
    apt -y install libcairo2-dev
    apt -y install libcurl4-openssl-dev
    apt -y install libcurl4-gnutls-dev
    apt -y install libudunits2-dev
    apt -y install libgd-dev
    apt -y install libmariadb-dev-compat
    apt -y install libpq-dev
    apt -y install libssl-dev
    apt -y install libtbb-dev
    apt -y install libxml2-dev
    apt -y install python3-minimal
    apt -y install python3-pip


### Read quality control

    echo 'Installing FASTQC from http://www.bioinformatics.babraham.ac.uk/projects/fastqc/ '
    #### Install
    cd /opt
    wget http://www.bioinformatics.babraham.ac.uk/projects/fastqc/fastqc_v0.11.9.zip
    unzip fastqc_v0.11.9.zip
    chmod +x FastQC/fastqc

    echo 'Installing TRIM_GALORE from http://www.bioinformatics.babraham.ac.uk/projects/trim_galore/ '
    #### Prerequisites
    pip3 install --upgrade cutadapt
    #### Install
    cd /opt
    wget https://github.com/FelixKrueger/TrimGalore/archive/0.6.7.zip
    mv 0.6.7.zip TrimGalore-0.6.7.zip
    unzip TrimGalore-0.6.7.zip

    echo 'Installing Trimmomatic from http://www.usadellab.org/cms/index.php?page=trimmomatic '
    #### Install
    cd /opt
    wget http://www.usadellab.org/cms/uploads/supplementary/Trimmomatic/Trimmomatic-0.39.zip
    unzip Trimmomatic-0.39.zip
#   Use:	java -jar /opt/Trimmomatic-0.39/trimmomatic-0.39.jar

    echo 'Installing TagDust from https://sourceforge.net/projects/tagdust/files/latest/download '
    #### Install
    cd /opt
    wget --content-disposition https://sourceforge.net/projects/tagdust/files/tagdust-2.33.tar.gz/download
    tar -xzf *tagdust-2.33.tar.gz* 
    \rm  *tagdust-2.33.tar.gz*
    cd tagdust-2.33/
    ./configure
    make
    make install


### Read manipulation

    echo 'Installing SRATOOLKIT from http://www.ncbi.nlm.nih.gov/books/NBK158900/ '
    ###### Install
    cd /opt
    wget http://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/3.0.1/sratoolkit.3.0.1-ubuntu64.tar.gz
    tar -xzf sratoolkit.3.0.1-ubuntu64.tar.gz

    echo 'Installing UMI-tools from https://github.com/CGATOxford/UMI-tools '
    #### Install
    pip3 install --upgrade umi-tools


### Read mapping

    echo 'Installing bwa from https://github.com/lh3/bwa '
    ###### Install
    cd /opt
    git clone https://github.com/lh3/bwa.git
    cd bwa
    make
    cp bwa /usr/local/bin/

    echo 'Installing BOWTIE2 from http://bowtie-bio.sourceforge.net/bowtie2 '
    ###### Install
    apt -y install bowtie2

    echo 'Installing hisat2 from https://ccb.jhu.edu/software/hisat2/ '
    ###### Install
    cd /opt
    git clone https://github.com/infphilo/hisat2 hisat2
    cd hisat2
    make

    echo 'Installing STAR from https://github.com/alexdobin/STAR '
    ###### Install
    cd /opt
    git clone https://github.com/alexdobin/STAR


### Alignment utilities

    echo 'Installing HTSLIB from http://www.htslib.org/ '
    #### Prerequisites
    apt -y install zlib1g-dev libbz2-dev liblzma-dev
    #### Install
    cd /opt
    git clone http://github.com/samtools/htslib.git htslib
    cd htslib
    git submodule update --init --recursive
    make && make install && make clean

    echo 'Installing SAMTOOLS from http://www.htslib.org/ '
    #### Prerequisites
    apt -y install ncurses-dev
    #### Install
    cd /opt
    git clone http://github.com/samtools/samtools.git samtools
    cd samtools
    make && make install && make clean


### Genome utilities

    echo 'Installing GENOMETOOLS from from http://genometools.org/ '
    #### Prerequisites
    apt -y install libcairo2-dev libpango1.0-dev
    #### Install
    cd /opt
    wget http://genometools.org/pub/genometools-1.6.2.tar.gz
    tar -xzf genometools-1.6.2.tar.gz
    cd genometools-1.6.2/
    make && make install

    echo 'Installing bedtools from https://github.com/arq5x/bedtools2/ '
    cd /opt
    git clone https://github.com/arq5x/bedtools2.git
    cd bedtools2/
    make && make install && make clean

    echo 'Installing bedops from https://github.com/bedops '
    cd /opt
    mkdir bedops && cd bedops
    wget https://github.com/bedops/bedops/releases/download/v2.4.40/bedops_linux_x86_64-v2.4.40.tar.bz2
    tar jxvf bedops_linux_x86_64-v2.4.40.tar.bz2
    # ... creates bin directory with tool binaries; added to path below
    \rm bedops_linux_x86_64-v2.4.40.tar.bz2

    echo 'Installing gfftobed from https://github.com/jacobbierstedt/gfftobed.git '
    cd /opt
    git clone https://github.com/jacobbierstedt/gfftobed.git
    cd gfftobed
    make
    cp gfftobed /usr/local/bin


### All things R

    echo 'Installing R'
    ####
    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
    add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/'
    apt -y update
    apt -y install r-base
    R CMD javareconf

    echo 'Installing CRAN and Bioconductor packages'
    ######
    echo 'install.packages("BiocManager", repos="http://ftp.ussg.iu.edu/CRAN", dependencies=TRUE)'         > R2install
    echo 'BiocManager::install(c("BiocVersion"), ask=FALSE)'                                              >> R2install
    echo 'install.packages("dplyr", repos="http://ftp.ussg.iu.edu/CRAN", dependencies=TRUE)'              >> R2install
    echo 'install.packages("gplots", repos="http://ftp.ussg.iu.edu/CRAN", dependencies=TRUE)'             >> R2install
    echo 'install.packages("ggplot2", repos="http://ftp.ussg.iu.edu/CRAN", dependencies=TRUE)'            >> R2install
    echo 'install.packages("ggdendro", repos="http://ftp.ussg.iu.edu/CRAN", dependencies=TRUE)'           >> R2install
    echo 'install.packages("gtable", repos="http://ftp.ussg.iu.edu/CRAN", dependencies=TRUE)'             >> R2install
    echo 'install.packages("gridExtra", repos="http://ftp.ussg.iu.edu/CRAN", dependencies=TRUE)'          >> R2install
    echo 'install.packages("pastecs", repos="http://ftp.ussg.iu.edu/CRAN", dependencies=TRUE)'            >> R2install
    echo 'install.packages("RCurl", repos="http://ftp.ussg.iu.edu/CRAN", dependencies=TRUE)'              >> R2install
    echo 'install.packages("rJava", repos="http://ftp.ussg.iu.edu/CRAN", dependencies=TRUE)'              >> R2install
    echo 'install.packages("shiny", repos="http://ftp.ussg.iu.edu/CRAN", dependencies=TRUE)'              >> R2install
    echo 'install.packages("sqldf", repos="http://ftp.ussg.iu.edu/CRAN", dependencies=TRUE)'              >> R2install
    echo 'install.packages("tidyr", repos="http://ftp.ussg.iu.edu/CRAN", dependencies=TRUE)'              >> R2install
    echo 'install.packages("venneuler", repos="http://ftp.ussg.iu.edu/CRAN", dependencies=TRUE)'          >> R2install
    echo 'install.packages("XML", repos="http://ftp.ussg.iu.edu/CRAN", dependencies=TRUE)'                >> R2install
    echo 'install.packages("R.devices", repos="http://ftp.ussg.iu.edu/CRAN", dependencies=TRUE)'          >> R2install
    echo 'BiocManager::install(c("BiocGenerics", "GenomicRanges", "genomation", "TSRchitect"),ask=FALSE)' >> R2install
    echo 'BiocManager::install(c("bumphunter", "seqLogo", "ENCODExplorer", "edgeR"),ask=FALSE)'           >> R2install
    echo 'BiocManager::install(c("ChIPseeker", "ChIPpeakAnno"),ask=FALSE)'                                >> R2install
    echo 'BiocManager::install(c("TxDb.Scerevisiae.UCSC.sacCer3.sgdGene", "org.Sc.sgd.db"),ask=FALSE)'    >> R2install

    Rscript R2install


### Tools to analyze mapped reads

    echo 'Installing RSEM from http://deweylab.github.io/RSEM/ ' 
    #### Install
    cd /opt
    git clone https://github.com/deweylab/RSEM.git
    cd RSEM
    make
    make ebseq
    make install

    echo 'Installing GoSTRIPES from https://github.com/BrendelGroup/GoSTRIPES '
    #### Install
    cd /opt
    git clone https://github.com/BrendelGroup/GoSTRIPES


%environment
    export LC_ALL=C
    export PATH=$PATH:/opt/bedops/bin
    export PATH=$PATH:/opt/FastQC
    export PATH=$PATH:/opt/GoSTRIPES/bin
    export PATH=$PATH:/opt/hisat2
    export PATH=$PATH:/opt/sratoolkit.3.0.1-ubuntu64/bin
    export PATH=$PATH:/opt/STAR/bin/Linux_x86_64
    export PATH=$PATH:/opt/TrimGalore-0.6.7

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/

%labels
    Maintainer vpbrendel
    Version v1.2
