diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..93f3fa0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +/LICENCE +/README.md +/INSTALL.md +/LICENCE +/CHANGES.md +/.gitignore +/.git diff --git a/.travis.yml b/.travis.yml index 4aa69ce..82c276a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,46 +2,21 @@ notifications: slack: wtsi-cgpit:ptUMR1tkNyZJYd9TpGoss8WR email: false -env: - - CC=gcc +sudo: false -language: - - c - -dist: trusty - -addons: - apt: - packages: - - build-essential - - curl - - libcurl4-openssl-dev - - libssl-dev - - nettle-dev - - zlib1g-dev - - libbz2-dev - - liblzma-dev - -install: true +services: + - docker script: - - ./setup.sh ~/wtsi-opt - -matrix: - include: - - #Trusty - compiler: gcc - os: linux - sudo: required - - #Trusty - compiler: clang - os: linux - sudo: required - - dist: precise - compiler: gcc - os: linux - sudo: required - - dist: precise - compiler: clang - os: linux - sudo: required + - set -e + - echo 'Build and check docker image' + - docker build -t cgpbigwig . + - docker images | grep -c cgpbigwig + - echo 'Verify program(s) from this repo' + - docker run -t --rm cgpbigwig bam2bedgraph --version + - docker run -t --rm cgpbigwig bwjoin --version + - docker run -t --rm cgpbigwig bam2bw --version + - docker run -t --rm cgpbigwig bwcat --version + - docker run -t --rm cgpbigwig bam2bwbases --version + - docker run -t --rm cgpbigwig bg2bw --version + - docker run -t --rm cgpbigwig detectExtremeDepth --version diff --git a/CHANGES.md b/CHANGES.md index 0dd87ae..85bc4fc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,10 @@ # CHANGES +## 1.1.0 + +Add docker build to allow internal large CI system to process. dockstore-cgpbigwig will +be modified to base from here and only contain additional helpers and CWL. + ## 1.0.4 * Add checks to sam_iter_next to ensure result is checked for errors @@ -14,7 +19,7 @@ * Where a proper pair filter is used, now check for the correct paired-end orientation of F/R. * If this is not met the read is ignored * Added a -f filter of flags to **include** alongside the existing -F for exclude as per samtools style filtering for `bam2bw`, `bam2bwbases` and `bam2bedgraph` -* **NB this flag was used as the exclude in `bam2bedgraph`. The flags have now been switched.** +* **NB this flag was used as the exclude in `bam2bedgraph`. The flags have now been switched.** ## 1.0.2 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bbba0c3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,78 @@ +FROM ubuntu:16.04 as builder + +USER root + +ARG VER_HTSLIB="1.9" +ARG VER_LIBBW="0.4.2" + +ENV OPT /opt/wtsi-cgp +ENV PATH $OPT/bin:$PATH +ENV LD_LIBRARY_PATH $OPT/lib +ENV LC_ALL C + +RUN apt-get -yq update +RUN apt-get install -yq --no-install-recommends\ + build-essential\ + apt-transport-https\ + curl\ + ca-certificates\ + make\ + bzip2\ + gcc\ + libtasn1-dev\ + libgnutls-dev\ + nettle-dev\ + libgmp-dev\ + libp11-kit-dev\ + zlib1g-dev\ + libbz2-dev\ + liblzma-dev\ + libcurl4-gnutls-dev\ + libncurses5-dev + +RUN mkdir -p $OPT/bin + +WORKDIR /install_tmp + +ADD build/opt-build.sh build/ +RUN bash build/opt-build.sh $OPT + +COPY . . +RUN bash build/opt-build-local.sh $OPT + +FROM ubuntu:16.04 + +LABEL maintainer="cgphelp@sanger.ac.uk"\ + uk.ac.sanger.cgp="Cancer, Ageing and Somatic Mutation, Wellcome Sanger Institute" \ + version="1.1.0" \ + description="cgpBigWig" + +ENV OPT /opt/wtsi-cgp +ENV PATH $OPT/bin:$PATH +ENV LD_LIBRARY_PATH $OPT/lib +ENV LC_ALL C + +RUN apt-get -yq update +RUN apt-get install -yq --no-install-recommends \ +apt-transport-https \ +curl \ +ca-certificates \ +bzip2 \ +zlib1g \ +liblzma5 \ +libncurses5 \ +unattended-upgrades && \ +unattended-upgrade -d -v && \ +apt-get remove -yq unattended-upgrades && \ +apt-get autoremove -yq + +RUN mkdir -p $OPT +COPY --from=builder $OPT $OPT + +## USER CONFIGURATION +RUN adduser --disabled-password --gecos '' ubuntu && chsh -s /bin/bash && mkdir -p /home/ubuntu + +USER ubuntu +WORKDIR /home/ubuntu + +CMD ["/bin/bash"] diff --git a/README.md b/README.md index 72799f8..75b28ee 100644 --- a/README.md +++ b/README.md @@ -2,22 +2,24 @@ Package of C scripts for generation of [BigWig][BigWig] coverage files +[![Quay Badge][quay-status]][quay-repo] + | Master | Dev | |-----------------------------------------------|----------------------------------------------| | [![Master Badge][travis-master]][travis-base] | [![Dev Badge][travis-develop]][travis-base] | -- [Installation](#installation) -- [Docker and Singularity](#docker-and-singularity) -- [Programs](#programs) - - [bwcat](#bwcat) - - [bwjoin](#bwjoin) - - [bam2bw](#bam2bw) - - [bg2bw](#bg2bw) - - [bam2bwbases](#bam2bwbases) - - [bam2bedgraph](#bam2bedgraph) -- [License](#license) +* [Installation](#installation) +* [Docker and Singularity](#docker-and-singularity) +* [Programs](#programs) + * [bwcat](#bwcat) + * [bwjoin](#bwjoin) + * [bam2bw](#bam2bw) + * [bg2bw](#bg2bw) + * [bam2bwbases](#bam2bwbases) + * [bam2bedgraph](#bam2bedgraph) +* [License](#license) @@ -38,6 +40,8 @@ To install this package run: ## Docker and Singularity +A docker image for this tool can be found at [quay.io][quay-repo] (this may be more current than the dockstore version). + There are [docker][quay.io] and [dockstore.org][dockstore] wrappers for this project at [dockstore-cgpbigwig] including CWL bindings. See the [dockstore-cgpbigwig] documentation for more detail. @@ -204,3 +208,8 @@ identical to a statement that reads ‘Copyright (c) 2005, 2006, 2007, 2008, [travis-master]: https://travis-ci.org/cancerit/cgpBigWig.svg?branch=master [travis-develop]: https://travis-ci.org/cancerit/cgpBigWig.svg?branch=develop [travis-base]: https://travis-ci.org/cancerit/cgpBigWig + + +[quay-status]: https://quay.io/repository/wtsicgp/cgpbigwig/status +[quay-repo]: https://quay.io/repository/wtsicgp/cgpbigwig +[quay-builds]: https://quay.io/repository/wtsicgp/cgpbigwig?tab=builds diff --git a/VERSION.txt b/VERSION.txt index ee90284..9084fa2 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -1.0.4 +1.1.0 diff --git a/build/opt-build-local.sh b/build/opt-build-local.sh new file mode 100755 index 0000000..028cae3 --- /dev/null +++ b/build/opt-build-local.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +set -ex + +if [[ -z "${TMPDIR}" ]]; then + TMPDIR=/tmp +fi + +set -u + +if [ "$#" -lt "1" ] ; then + echo "Please provide an installation path such as /opt/ICGC" + exit 1 +fi + +# get path to this script +SCRIPT_PATH=`dirname $0`; +SCRIPT_PATH=`(cd $SCRIPT_PATH && pwd)` + +# get the location to install to +INST_PATH=$1 +mkdir -p $1 +INST_PATH=`(cd $1 && pwd)` +echo $INST_PATH + +# get current directory +INIT_DIR=`pwd` + +CPU=`grep -c ^processor /proc/cpuinfo` +if [ $? -eq 0 ]; then + if [ "$CPU" -gt "6" ]; then + CPU=6 + fi +else + CPU=1 +fi +echo "Max compilation CPUs set to $CPU" + +mkdir -p $INST_PATH/bin + +# make sure tools installed can see the install loc of libraries +set +u +export LD_LIBRARY_PATH=`echo $INST_PATH/lib:$LD_LIBRARY_PATH | perl -pe 's/:\$//;'` +export PATH=`echo $INST_PATH/bin:$PATH | perl -pe 's/:\$//;'` +export MANPATH=`echo $INST_PATH/man:$INST_PATH/share/man:$MANPATH | perl -pe 's/:\$//;'` +set -u + +##### cgpBigWig installation +make -C c clean +make -C c -j$CPU prefix=$INST_PATH HTSLIB=$INST_PATH/lib +cp bin/bam2bedgraph $INST_PATH/bin/. +cp bin/bwjoin $INST_PATH/bin/. +cp bin/bam2bw $INST_PATH/bin/. +cp bin/bwcat $INST_PATH/bin/. +cp bin/bam2bwbases $INST_PATH/bin/. +cp bin/bg2bw $INST_PATH/bin/. +cp bin/detectExtremeDepth $INST_PATH/bin/. +make -C c clean + +cd $HOME diff --git a/build/opt-build.sh b/build/opt-build.sh new file mode 100755 index 0000000..a4b0325 --- /dev/null +++ b/build/opt-build.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +set -ex + +if [[ -z "${TMPDIR}" ]]; then + TMPDIR=/tmp +fi + +set -u + +if [ "$#" -lt "1" ] ; then + echo "Please provide an installation path such as /opt/ICGC" + exit 1 +fi + +# get path to this script +SCRIPT_PATH=`dirname $0`; +SCRIPT_PATH=`(cd $SCRIPT_PATH && pwd)` + +# get the location to install to +INST_PATH=$1 +mkdir -p $1 +INST_PATH=`(cd $1 && pwd)` +echo $INST_PATH + +# get current directory +INIT_DIR=`pwd` + +CPU=`grep -c ^processor /proc/cpuinfo` +if [ $? -eq 0 ]; then + if [ "$CPU" -gt "6" ]; then + CPU=6 + fi +else + CPU=1 +fi +echo "Max compilation CPUs set to $CPU" + + +SETUP_DIR=$INIT_DIR/install_tmp +mkdir -p $SETUP_DIR/distro # don't delete the actual distro directory until the very end +mkdir -p $INST_PATH/bin +cd $SETUP_DIR + + +# make sure tools installed can see the install loc of libraries +set +u +export LD_LIBRARY_PATH=`echo $INST_PATH/lib:$LD_LIBRARY_PATH | perl -pe 's/:\$//;'` +export PATH=`echo $INST_PATH/bin:$PATH | perl -pe 's/:\$//;'` +export MANPATH=`echo $INST_PATH/man:$INST_PATH/share/man:$MANPATH | perl -pe 's/:\$//;'` +set -u + +##### DEPS for cgpBigWig ##### + +## HTSLIB (tar.bz2) +if [ ! -e $SETUP_DIR/htslib.success ]; then + rm -rf htslib + mkdir -p htslib + curl -sSL --retry 10 https://github.com/samtools/htslib/releases/download/${VER_HTSLIB}/htslib-${VER_HTSLIB}.tar.bz2 > distro.tar.bz2 + tar --strip-components 1 -C htslib -jxf distro.tar.bz2 + cd htslib + ./configure --enable-plugins --enable-libcurl --prefix=$INST_PATH + make clean + make -j$CPU + make install + cd $SETUP_DIR + rm -rf distro.* + touch $SETUP_DIR/htslib.success +fi + +## LIB-BW (tar.gz) +if [ ! -e $SETUP_DIR/libBigWig.success ]; then + curl -sSL --retry 10 https://github.com/dpryan79/libBigWig/archive/${VER_LIBBW}.tar.gz > distro.tar.gz + rm -rf distro/* + tar --strip-components 1 -C distro -xzf distro.tar.gz + make -C distro clean + make -C distro -j$CPU install prefix=$INST_PATH + rm -rf distro.* distro/* + touch $SETUP_DIR/libBigWig.success +fi + +cd $HOME +rm -rf $SETUP_DIR