From 149a4e9dce3d28160f39e1121786777fc2a3ac7e Mon Sep 17 00:00:00 2001 From: Keiran Raine Date: Wed, 7 Oct 2020 10:31:58 +0000 Subject: [PATCH 1/2] use libdeflat from installed version in base image, which means samtools will also use it not just the pcap C binaries --- Dockerfile | 3 +-- build/opt-build-local.sh | 31 +++++++++++-------------------- c/Makefile | 5 ++--- setup.sh | 1 - 4 files changed, 14 insertions(+), 26 deletions(-) diff --git a/Dockerfile b/Dockerfile index afe9f18..91c0baf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM quay.io/wtsicgp/cgpbigwig:1.5.0 as builder +FROM quay.io/wtsicgp/cgpbigwig:1.5.1 as builder USER root @@ -11,7 +11,6 @@ ARG BWAMEM2_URL="https://github.com/bwa-mem2/bwa-mem2/releases/download/v2.0pre2 ARG STADEN="https://iweb.dl.sourceforge.net/project/staden/staden/2.0.0b11/staden-2.0.0b11-2016-linux-x86_64.tar.gz" ARG VER_BIODBHTS="3.01" ARG VER_BWA="v0.7.17" -ARG VER_LIBDEFLATE='v1.6' ARG VER_HTSLIB="1.11" ARG VER_SAMTOOLS="1.11" diff --git a/build/opt-build-local.sh b/build/opt-build-local.sh index 79f54b6..07be7ab 100644 --- a/build/opt-build-local.sh +++ b/build/opt-build-local.sh @@ -52,25 +52,18 @@ set -u cpanm --no-wget --no-interactive --notest --mirror http://cpan.metacpan.org -l $INST_PATH Const::Fast cpanm --no-wget --no-interactive --notest --mirror http://cpan.metacpan.org -l $INST_PATH File::Which -## libdeflate -rm -rf tmp_deflate -mkdir -p tmp_deflate -curl -sSL --retry 10 https://github.com/ebiggers/libdeflate/archive/${VER_LIBDEFLATE}.tar.gz > distro.tar.gz -tar --strip-components 1 -C tmp_deflate -zxf distro.tar.gz -cd tmp_deflate -make -j$CPU CFLAGS="-fPIC -O3" install -PREFIX=$INST_PATH make -j$CPU CFLAGS="-fPIC -O3" install -cd ../ -rm -rf distro.* +export HTSLIB=$PWD/tmp_htslib # used after htslib block -# won't build without "development" htslib structure: +# won't build without "development" htslib structure due to need for static linking ## HTSLIB (tar.bz2) -rm -rf tmp_htslib -mkdir -p tmp_htslib +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 tmp_htslib -jxf distro.tar.bz2 -cd tmp_htslib -./configure --enable-plugins --enable-libcurl --with-libdeflate --prefix=$INST_PATH +tar --strip-components 1 -C $HTSLIB -jxf distro.tar.bz2 +cd $HTSLIB +./configure --enable-plugins --enable-libcurl --with-libdeflate --prefix=$INST_PATH \ + CPPFLAGS="-I$INST_PATH/include" \ + LDFLAGS="-L${INST_PATH}/lib -Wl,-R${INST_PATH}/lib" make clean make -j$CPU cd ../ @@ -79,9 +72,8 @@ rm -rf distro.* make -C c clean export REF_CACHE=$PWD/t/data/ref_cache/%2s/%2s/%s export REF_PATH=$REF_CACHE +make -C c -j$CPU prefix=$INST_PATH -env HTSLIB=$PWD/tmp_htslib make -C c -j$CPU prefix=$INST_PATH -env DEFLATE=$PWD/tmp_deflate cp bin/bam_stats $INST_PATH/bin/. cp bin/reheadSQ $INST_PATH/bin/. cp bin/diff_bams $INST_PATH/bin/. @@ -89,8 +81,7 @@ cp bin/mismatchQc $INST_PATH/bin/. cp bin/mmFlagModifier $INST_PATH/bin/. rm -rf $REF_CACHE -rm -rf tmp_htslib -rm -rf tmp_deflate +rm -rf $HTSLIB cpanm --no-wget --no-interactive --notest --mirror http://cpan.metacpan.org --notest -l $INST_PATH --installdeps . cpanm -v --no-wget --no-interactive --mirror http://cpan.metacpan.org -l $INST_PATH . diff --git a/c/Makefile b/c/Makefile index 12ba34f..d767d42 100644 --- a/c/Makefile +++ b/c/Makefile @@ -34,11 +34,10 @@ CFLAGS = -Wall HTSLOC?=$(HTSLIB) HTSTMP?=./htslib_tmp -DEFLATETMP?=./deflate_tmp prefix=?/usr/local/ #Define locations of header files -OPTINC?= -I$(HTSLOC)/ -I/install_tmp/deflate_tmp/ +OPTINC?= -I$(HTSLOC)/ INCLUDES= -I./ $(OPTINC) -rdynamic CAT_INCLUDES+= -I$(prefix)/include @@ -47,7 +46,7 @@ CAT_LFLAGS+= -L$(prefix)/lib # define library paths in addition to /usr/lib # if I wanted to include libraries not in /usr/lib I'd specify # their path using -Lpath, something like: -LFLAGS?= -L$(HTSTMP) -L$(DEFLATETMP) +LFLAGS?= -L$(HTSTMP) # define any libraries to link into executable: # if I want to link in libraries (libx.so or libx.a) I use the -llibname diff --git a/setup.sh b/setup.sh index 444d5f6..040df21 100755 --- a/setup.sh +++ b/setup.sh @@ -9,7 +9,6 @@ export BWAMEM2_URL="https://github.com/bwa-mem2/bwa-mem2/releases/download/v2.0p export STADEN="https://iweb.dl.sourceforge.net/project/staden/staden/2.0.0b11/staden-2.0.0b11-2016-linux-x86_64.tar.gz" export VER_BIODBHTS="3.01" export VER_BWA="v0.7.17" -export VER_LIBDEFLATE='v1.6' export VER_HTSLIB="1.11" export VER_SAMTOOLS="1.11" From beff1b5ff4d1169968c2f9d4496852c519c498a0 Mon Sep 17 00:00:00 2001 From: Keiran Raine Date: Wed, 7 Oct 2020 11:05:42 +0000 Subject: [PATCH 2/2] Versions --- CHANGES.md | 5 +++++ Dockerfile | 2 +- lib/PCAP.pm | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 27fbbd8..bd71fe8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,10 @@ # CHANGES +## 5.4.2 + +* use libdeflate /opt installation from cgpbigwig +* performance now applies to samtools via this modification + ## 5.4.1 * Compile htslib with libdeflate (thanks to @mflevine) diff --git a/Dockerfile b/Dockerfile index 91c0baf..dd57f15 100644 --- a/Dockerfile +++ b/Dockerfile @@ -62,7 +62,7 @@ FROM ubuntu:20.04 LABEL maintainer="cgphelp@sanger.ac.uk"\ uk.ac.sanger.cgp="Cancer, Ageing and Somatic Mutation, Wellcome Sanger Institute" \ - version="5.4.1" \ + version="5.4.2" \ description="pcap-core" ENV OPT /opt/wtsi-cgp diff --git a/lib/PCAP.pm b/lib/PCAP.pm index 15207f9..a731902 100644 --- a/lib/PCAP.pm +++ b/lib/PCAP.pm @@ -28,7 +28,7 @@ use FindBin qw($Bin); use File::Which qw(which); # don't use autodie, only core perl in here -our $VERSION = '5.4.1'; +our $VERSION = '5.4.2'; our @EXPORT = qw($VERSION _which); const my $LICENSE =>