# Copyright (c) 2016, Ontropos, Inc. All rights reserved.
#
# Copyright (c) 2015-2017, Gregory M. Kurtzer. All rights reserved.
# 
# "Singularity" Copyright (c) 2016, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory (subject to receipt of any
# required approvals from the U.S. Dept. of Energy).  All rights reserved.

BootStrap: debootstrap
OSVersion: trusty
MirrorURL: http://archive.ubuntu.com/ubuntu/
Include: bash


%post
    # Prep work
    mkdir -p /tmp/work
    cd /tmp/work
    sed -i 's/main/main restricted universe/g' /etc/apt/sources.list
    apt-get update
    apt-get -y install wget bzip2 build-essential zlib1g-dev software-properties-common libncurses5-dev


    # Install BWA
    wget "http://downloads.sourceforge.net/project/bio-bwa/bwa-0.7.15.tar.bz2?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fbio-bwa%2Ffiles%2F&ts=1473712599&use_mirror=heanet" -O bwa-0.7.15.tar.bz2
    tar -xvjf bwa-0.7.15.tar.bz2
    cd bwa-0.7.15/
    make
    cp bwa /usr/bin/bwa
    cd /tmp/work


    # Install SAM Tools
    wget "http://downloads.sourceforge.net/project/samtools/samtools/1.3.1/samtools-1.3.1.tar.bz2?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fsamtools%2Ffiles%2Fsamtools%2F1.3.1%2F&ts=1473713899&use_mirror=pilotfiber" -O samtools-1.3.1.tar.bz2
    tar -xvjf samtools-1.3.1.tar.bz2
    cd samtools-1.3.1
    ./configure
    make
    cp samtools /usr/bin/samtools


    # Install java prereq
    apt-add-repository -y ppa:webupd8team/java
    apt-get update
    echo 'oracle-java8-installer shared/accepted-oracle-license-v1-1 select true' | debconf-set-selections
    apt-get -y install oracle-java8-installer


    # This is now ready to have GATK (Genomic Analysis Took Kit) installed
    # from: https://software.broadinstitute.org/gatk/download/

