Skip to content

Commit

Permalink
Merge branch 'release/1.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
keiranmraine committed Jun 11, 2020
2 parents 50b9bcd + e612668 commit 8dd1e25
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 153 deletions.
8 changes: 8 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# CHANGES

## 1.3.0

* Update to htslib 1.10.2
* Required for PCAP-core to update to samtools 1.10 for new features
* Update `setup.sh` to exec `build/*` scripts to reduce chance of divergence
* Update Docker image to Ubuntu Focal (20.04) base.
* Fix #33 (typo)

## 1.2.0

Add bam2bw -S/--scale-log10 to enable simple RPKM rescaling.
Expand Down
46 changes: 24 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM ubuntu:16.04 as builder
FROM ubuntu:20.04 as builder

USER root

ARG VER_HTSLIB="1.9"
# ALL tool versions used by opt-build.sh
# need to keep in sync with setup.sh
ARG VER_HTSLIB="1.10.2"
ARG VER_LIBBW="0.4.2"

ENV OPT /opt/wtsi-cgp
Expand All @@ -11,24 +13,23 @@ 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 apt-get install -yq --no-install-recommends build-essential
RUN apt-get install -yq --no-install-recommends apt-transport-https
RUN apt-get install -yq --no-install-recommends curl
RUN apt-get install -yq --no-install-recommends ca-certificates
RUN apt-get install -yq --no-install-recommends make
RUN apt-get install -yq --no-install-recommends bzip2
RUN apt-get install -yq --no-install-recommends gcc
RUN apt-get install -yq --no-install-recommends libtasn1-dev
RUN apt-get install -yq --no-install-recommends nettle-dev
RUN apt-get install -yq --no-install-recommends libgmp-dev
RUN apt-get install -yq --no-install-recommends libp11-kit-dev
RUN apt-get install -yq --no-install-recommends zlib1g-dev
RUN apt-get install -yq --no-install-recommends libbz2-dev
RUN apt-get install -yq --no-install-recommends liblzma-dev
RUN apt-get install -yq --no-install-recommends libcurl4-gnutls-dev
RUN apt-get install -yq --no-install-recommends libncurses5-dev
RUN apt-get install -yq --no-install-recommends libgnutls28-dev

RUN mkdir -p $OPT/bin

Expand All @@ -40,11 +41,11 @@ RUN bash build/opt-build.sh $OPT
COPY . .
RUN bash build/opt-build-local.sh $OPT

FROM ubuntu:16.04
FROM ubuntu:20.04

LABEL maintainer="[email protected]"\
uk.ac.sanger.cgp="Cancer, Ageing and Somatic Mutation, Wellcome Sanger Institute" \
version="1.2.0" \
version="1.3.0" \
description="cgpBigWig"

ENV OPT /opt/wtsi-cgp
Expand All @@ -61,6 +62,7 @@ bzip2 \
zlib1g \
liblzma5 \
libncurses5 \
libcurl3-gnutls \
unattended-upgrades && \
unattended-upgrade -d -v && \
apt-get remove -yq unattended-upgrades && \
Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.0
1.3.0
2 changes: 1 addition & 1 deletion c/bam2bwbases.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void print_usage (int exit_code){
printf("-f --filter-include [int] SAM flags to include. [default: %d]\n",filterinc);
printf(" N.B. if properly paired reads are filtered for inclusion bam2bw will assume paired-end data\n");
printf(" and exclude any proper-pair flagged reads not in F/R orientation.");
printf("-o --outfile [file] Path to the output .bw file produced. Per base results wiillbe output as four bw files [ACGT].outputname.bw [default:'%s']\n\n",out_file);
printf("-o --outfile [file] Path to the output .bw file produced. Per base results will be output as four bw files [ACGT].outputname.bw [default:'%s']\n\n",out_file);
printf("Optional: \n");
printf("-c --region [file] A samtools style region (contig:start-stop) or a bed file of regions over which to produce the bigwig file\n");
printf("-r --reference [file] Path to reference genome.fa file (required for cram if ref_path cannot be resolved)\n");
Expand Down
Binary file removed c/c_tests/utils_tests
Binary file not shown.
152 changes: 23 additions & 129 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

########## LICENSE ##########
# Copyright (c) 2016 Genome Research Ltd.
# Copyright (c) 2016-2020 Genome Research Ltd.
#
# Author: Cancer Genome Project [email protected]
#
Expand Down Expand Up @@ -32,147 +32,41 @@
#
###########################

# for bamstats
SOURCE_HTSLIB="https://github.com/samtools/htslib/releases/download/1.7/htslib-1.7.tar.bz2"
#libBigWig - bigwig access library
SOURCE_LIB_BW="https://github.com/dpryan79/libBigWig/archive/0.4.2.tar.gz"

get_distro () {
EXT=""
if [[ $2 == *.tar.bz2* ]] ; then
EXT="tar.bz2"
elif [[ $2 == *.zip* ]] ; then
EXT="zip"
elif [[ $2 == *.tar.gz* ]] ; then
EXT="tar.gz"
else
echo "I don't understand the file type for $1"
exit 1
fi
if hash curl 2>/dev/null; then
curl -sS -o $1.$EXT -L $2
else
wget -nv -O $1.$EXT $2
fi
}

get_file () {
# output, source
if hash curl 2>/dev/null; then
curl -sS -o $1 -L $2
else
wget -nv -O $1 $2
fi
}

if [ "$#" -ne "1" ] ; then
echo "Please provide an installation path such as /opt/ICGC"
exit 0
fi

CPU=1
ls /proc/cpuinfo >& /dev/null # very noddy attempt to figure out thread count
if [ $? -eq 0 ]; then
CPU=`grep -c ^processor /proc/cpuinfo`
else
CPU=`sysctl -a | grep machdep.cpu | grep thread_count | awk '{print $2}'`
if [ $? -ne 0 ]; then
# fall back to unthreaded core test
CPU=`sysctl -a | grep machdep.cpu | grep core_count | awk '{print $2}'`
fi
fi
if [ "$CPU" -gt "6" ]; then
CPU=6
# ALL tool versions used by opt-build.sh
# need to keep in sync with Dockerfile
export VER_HTSLIB="1.10.2"
export VER_LIBBW="0.4.2"

if [[ ($# -ne 1 && $# -ne 2) ]] ; then
echo "Please provide an installation path and optionally perl lib paths to allow, e.g."
echo " ./setup.sh /opt/myBundle"
echo "OR all elements versioned:"
echo " ./setup.sh /opt/cgpPinel-X.X.X /opt/cgpVcf-X.X.X/lib/perl:/opt/PCAP-core-X.X.X/lib/perl"
exit 1
fi
echo "Max compilation CPUs set to $CPU"

set -e

INST_PATH=$1

if [[ $# -eq 2 ]] ; then
CGP_PERLLIBS=$2
fi

# get current directory
INIT_DIR=`pwd`

set -e

# cleanup inst_path
mkdir -p $INST_PATH
mkdir -p $INST_PATH/bin
cd $INST_PATH
INST_PATH=`pwd`
mkdir -p $INST_PATH/bin
cd $INIT_DIR

#create a location to build dependencies
SETUP_DIR=$INIT_DIR/install_tmp
mkdir -p $SETUP_DIR

echo -n "Get htslib ..."
if [ -e $SETUP_DIR/htslibGet.success ]; then
echo " already staged ...";
else
echo
cd $SETUP_DIR
get_distro "htslib" $SOURCE_HTSLIB
touch $SETUP_DIR/htslibGet.success
fi

echo -n "Building htslib ..."
if [ -e $SETUP_DIR/htslib.success ]; then
echo " previously installed ...";
else
echo
cd $SETUP_DIR
mkdir -p htslib
tar --strip-components 1 -C htslib -jxf htslib.tar.bz2
cd htslib
./configure --enable-plugins --enable-libcurl --prefix=$INST_PATH
make -j$CPU
make install
rm -f $INST_PATH/lib/libhts.so*
cd $SETUP_DIR
touch $SETUP_DIR/htslib.success
fi

cd $INIT_DIR

echo -n "Building libBigWig ..."
if [ -e $SETUP_DIR/libBigWig.success ]; then
echo -n " previously installed ...";
else
cd $SETUP_DIR
get_distro "libBigWig" $SOURCE_LIB_BW
mkdir -p libBigWig
tar --strip-components 1 -C libBigWig -zxf libBigWig.tar.gz
make -C libBigWig -j$CPU install prefix=$INST_PATH
rm -f $INST_PATH/lib/libBigWig.so
touch $SETUP_DIR/libBigWig.success
fi
echo

export HTSLIB="$SETUP_DIR/htslib"
cd $INIT_DIR


echo -n "Building cgpBigWig ..."
if [ -e $SETUP_DIR/cgpBigWig.success ]; then
echo -n " previously installed ...";
else
cd $INIT_DIR
make -C c clean
make -C c -j$CPU prefix=$INST_PATH HTSLIB=$SETUP_DIR/htslib
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/.
touch $SETUP_DIR/cgpBigWig.success
# need to clean up as will clash with other version
make -C c clean
fi
echo
#add bin path for install tests
export PATH=$INST_PATH/bin:$PATH

# cleanup all junk
rm -rf $SETUP_DIR
bash build/opt-build.sh $INST_PATH
bash build/opt-build-local.sh $INST_PATH

echo
echo
Expand Down

0 comments on commit 8dd1e25

Please sign in to comment.