From 8a04e8b57dfb1aaff6d84dfd3ef48c009a2ec003 Mon Sep 17 00:00:00 2001 From: ab63 Date: Tue, 11 Jun 2024 17:02:48 +0100 Subject: [PATCH 1/3] you will never know the pain I went through to make this install process work as expected --- INSTALL.TXT | 20 ++++--------- Makefile | 6 ++-- README.md | 2 +- setup.sh | 82 +++++++++++++++++++++-------------------------------- 4 files changed, 43 insertions(+), 67 deletions(-) diff --git a/INSTALL.TXT b/INSTALL.TXT index 6640d6c..223f2a0 100644 --- a/INSTALL.TXT +++ b/INSTALL.TXT @@ -11,22 +11,14 @@ caveman depends on: Compilation =========== -If you have a local install of htslib: +``` + cd CaVEMan + ./setup.sh +``` -Type 'make' if you have the following environmental variables $HTSLIB set -to be the directory of your local install of each. - -Otherwise the command below will hopefully help you. - -make HTSLOC="/full/path/to/htslib" TEST_REF="/path/to/GRCh37/genome.fa.fai" - -If you wish to temporarily install htslib purely for building caveman: - -Type './setup.sh ' within the CaVEMan directory. Caveman executables -will be installed to 'install_directory/bin/'. +Caveman executables will be installed to `/bin/`. Installation ============ -Copy 'bin/caveman', and other executables in bin/ to a location you want -(e.g. a directory in your $PATH). +Add `/bin/` to path diff --git a/Makefile b/Makefile index bb22e7a..a691df1 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ HTSTMP?=./caveman_tmp prefix=?/usr/local/ #Define locations of header files -OPTINC?=-I$(HTSLOC)/ +OPTINC?=-I$(HTSLOC)/ -I$(LINASM_INC) INCLUDES= -Isrc $(OPTINC) -rdynamic JOIN_INCLUDES= -I$(prefix)/include @@ -28,7 +28,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) +LFLAGS?=-L$(HTSTMP) -L$(LINASM_LIB) # define any libraries to link into executable: # if I want to link in libraries (libx.so or libx.a) I use the -llibname @@ -85,7 +85,7 @@ test: $(TESTS) #Unit tests with coverage coverage: CFLAGS += --coverage coverage: test - + make_bin: $(MD) ./bin diff --git a/README.md b/README.md index b202571..d138cb1 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ CaVEMan A C implementation of the CaVEMan program. Uses an expectation maximisation approach to calling single base substitutions in paired data. -Designed for use with a compute farm/cluster most steps in the program make +Designed for use with a compute farm/cluster; most steps in the program make use of an index parameter. The split step is designed to divide the genome into chunks of adjustable size to optimise for runtime/memory usage requirements. For simple execution of CaVEMan please see [cgpCaVEManWrapper](https://github.com/cancerit/cgpCaVEManWrapper) diff --git a/setup.sh b/setup.sh index 1487866..0bcfa5b 100755 --- a/setup.sh +++ b/setup.sh @@ -21,8 +21,6 @@ # along with this program. If not, see . ##########LICENCE########## -SOURCE_HTSLIB="https://github.com/samtools/htslib/releases/download/1.10.2/htslib-1.10.2.tar.bz2" - REQUIRED_MIN_LIBZ="1.2.3.4" function version_eq_gt() { @@ -32,28 +30,7 @@ function version_eq_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; } -get_distro () { - EXT="" - DECOMP="gunzip -f" - echo "$1" - if [[ $2 == *.tar.bz2* ]] ; then - EXT="tar.bz2" - DECOMP="bzip2 -fd" - 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 - mkdir -p $1 - `$DECOMP $1.$EXT` - tar --strip-components 1 -C $1 -xf $1.tar -} +set -euo pipefail if [ "$#" -ne "1" ] ; then echo "Please provide an installation path such as /opt/pancan" @@ -75,18 +52,10 @@ echo "Max compilation CPUs set to $CPU" # get current directory INIT_DIR=`pwd` -# log information about this system - echo '============== System information ====' - set -x - lsb_release -a - uname -a - sw_vers - system_profiler - grep MemTotal /proc/meminfo - set +x - echo; echo -LIBZ_VER=`echo '#include ' | cpp -H -o /dev/null |& head -1 | cut -d' ' -f 2 | xargs grep -e '#define ZLIB_VERSION' | cut -d ' ' -f 3 | perl -pe 's/["\n]//g'` -echo $LIBZ_VER +set +o pipefail +LIBZ_VER=$(echo '#include ' | cpp -H -o /dev/null |& head -1 | cut -d' ' -f 2 | xargs grep -e '#define ZLIB_VERSION' | cut -d ' ' -f 3 | perl -pe 's/["\n]//g') +set -o pipefail + if version_eq_gt $LIBZ_VER $REQUIRED_MIN_LIBZ ; then echo "Found acceptable libz version $LIBZ_VER." echo "Continuing install" @@ -97,8 +66,6 @@ else exit 1 fi -set -ue - # cleanup inst_path mkdir -p $INST_PATH/bin cd $INST_PATH @@ -110,22 +77,38 @@ SETUP_DIR=$INIT_DIR/install_tmp mkdir -p $SETUP_DIR cd $SETUP_DIR +echo -n "Building linasm..." +if [ -e $SETUP_DIR/linasm.success ]; then + echo -n "previously installed..." +else + wget https://github.com/rurban/linasm/archive/refs/heads/master.zip + unzip -o master.zip && cd linasm-master + mkdir -p linasm_inst + make + make install prefix=${SETUP_DIR}/linasm-master/linasm_inst/ + make clean + touch $SETUP_DIR/linasm.success +fi + +export LINASM_INC=$SETUP_DIR/linasm-master/linasm_inst/include/ +export LINASM_LIB=$SETUP_DIR/linasm-master/linasm_inst/lib/ +cd $SETUP_DIR echo -n "Building htslib ..." if [ -e $SETUP_DIR/htslib.success ]; then - echo -n " previously installed ..."; + echo -n "previously installed ..."; else - cd $SETUP_DIR - if [ ! -e htslib ]; then - get_distro "htslib" $SOURCE_HTSLIB - fi - make -C htslib -j$CPU + wget https://github.com/samtools/htslib/releases/download/1.10.2/htslib-1.10.2.tar.bz2 + bzip2 -fd htslib-1.10.2.tar.bz2 + mkdir -p htslib + tar --strip-components 1 -C htslib -xf htslib-1.10.2.tar + cd htslib + make -j$CPU touch $SETUP_DIR/htslib.success fi export HTSLIB="$SETUP_DIR/htslib" - -set -e +export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${HTSLIB}:${LINASM_LIB}" echo -n "Building CaVEMan ..." if [ -e "$SETUP_DIR/caveman.success" ]; then @@ -143,8 +126,9 @@ fi cd $INIT_DIR # cleanup all junk -rm -rf $SETUP_DIR +rm -rf $SETUP_DIR c/ +make clean echo -echo "Please add the following to beginning of path:" -echo " $INST_PATH/bin" +echo "Installation succesful" +echo "Binaries available at $INST_PATH/bin/" From 3613281ae74b9c54c28af506a3ced5bdfdcbe857 Mon Sep 17 00:00:00 2001 From: ab63 Date: Wed, 12 Jun 2024 13:09:26 +0100 Subject: [PATCH 2/3] pin linasm to specific commit in absence of versioned release, and keep shared lib post compilation, + minor qol tweaks --- setup.sh | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/setup.sh b/setup.sh index 0bcfa5b..02e666a 100755 --- a/setup.sh +++ b/setup.sh @@ -81,29 +81,29 @@ echo -n "Building linasm..." if [ -e $SETUP_DIR/linasm.success ]; then echo -n "previously installed..." else - wget https://github.com/rurban/linasm/archive/refs/heads/master.zip - unzip -o master.zip && cd linasm-master - mkdir -p linasm_inst - make - make install prefix=${SETUP_DIR}/linasm-master/linasm_inst/ - make clean + wget https://github.com/rurban/linasm/archive/e33b4a083f8bbdcbd58018c9abc65047d20fd431.zip && + unzip -o e33b4a083f8bbdcbd58018c9abc65047d20fd431.zip && mv linasm-e33b4a083f8bbdcbd58018c9abc65047d20fd431 linasm && cd linasm && + mkdir -p linasm_inst && + make && + make install prefix=${SETUP_DIR}/linasm/linasm_inst/ && + make clean && touch $SETUP_DIR/linasm.success fi -export LINASM_INC=$SETUP_DIR/linasm-master/linasm_inst/include/ -export LINASM_LIB=$SETUP_DIR/linasm-master/linasm_inst/lib/ +export LINASM_INC=$SETUP_DIR/linasm/linasm_inst/include/ +export LINASM_LIB=$SETUP_DIR/linasm/linasm_inst/lib/ cd $SETUP_DIR echo -n "Building htslib ..." if [ -e $SETUP_DIR/htslib.success ]; then echo -n "previously installed ..."; else - wget https://github.com/samtools/htslib/releases/download/1.10.2/htslib-1.10.2.tar.bz2 - bzip2 -fd htslib-1.10.2.tar.bz2 - mkdir -p htslib - tar --strip-components 1 -C htslib -xf htslib-1.10.2.tar - cd htslib - make -j$CPU + wget https://github.com/samtools/htslib/releases/download/1.10.2/htslib-1.10.2.tar.bz2 && + bzip2 -fd htslib-1.10.2.tar.bz2 && + mkdir -p htslib && + tar --strip-components 1 -C htslib -xf htslib-1.10.2.tar && + cd htslib && + make -j$CPU && touch $SETUP_DIR/htslib.success fi @@ -115,20 +115,21 @@ if [ -e "$SETUP_DIR/caveman.success" ]; then echo -n " previously installed ..."; else cd $INIT_DIR - mkdir -p $INIT_DIR/c/bin && make clean && make -j$CPU && - cp $INIT_DIR/bin/caveman $INST_PATH/bin/. && - cp $INIT_DIR/bin/mergeCavemanResults $INST_PATH/bin/. && + mv $INIT_DIR/bin/* $INST_PATH/bin/ && + mkdir -p $INST_PATH/lib/ && + cp $LINASM_LIB/liblinasm.so $INST_PATH/lib/. && touch $SETUP_DIR/caveman.success fi -cd $INIT_DIR +exit # cleanup all junk -rm -rf $SETUP_DIR c/ +rm -rf $SETUP_DIR make clean echo echo "Installation succesful" echo "Binaries available at $INST_PATH/bin/" +echo "linasm.so available at $INST_PATH/lib/ - directory must be on LD_LIBRARY_PATH" From 3972d4ade023d7fe27b32a875c0b00ea0bda2565 Mon Sep 17 00:00:00 2001 From: ab63 Date: Wed, 12 Jun 2024 13:14:06 +0100 Subject: [PATCH 3/3] add info about LD_LIBRARY_PATH to install guide --- INSTALL.TXT | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/INSTALL.TXT b/INSTALL.TXT index 223f2a0..e1f445d 100644 --- a/INSTALL.TXT +++ b/INSTALL.TXT @@ -21,4 +21,6 @@ Caveman executables will be installed to `/bin/`. Installation ============ -Add `/bin/` to path +`/lib/` must be appended to LD_LIBRARY_PATH. +This ensures shared libraries are available to executables. +Add `/bin/` to path if system-wide availbility of executables is desired.