From 31f629fd7c3f43aeec344fe5dec5e7e784c09ccf Mon Sep 17 00:00:00 2001 From: Julian Hess Date: Tue, 10 Sep 2019 18:14:17 -0400 Subject: [PATCH 1/4] Remove internal dependency on htslib --- Makefile.am | 2 +- Makefile.in | 26 +++-- SeqLib/BamHeader.h | 8 +- SeqLib/BamRecord.h | 10 +- SeqLib/BamWalker.h | 3 +- SeqLib/RefGenome.h | 2 +- bwa | 2 +- configure | 205 +++++++++++++++++++++------------------ htslib | 1 - src/BamReader.cpp | 3 +- src/Makefile.am | 2 +- src/Makefile.in | 125 +++++++----------------- src/ReadFilter.cpp | 2 +- src/seqtools/Makefile.in | 31 +++--- 14 files changed, 185 insertions(+), 237 deletions(-) delete mode 160000 htslib diff --git a/Makefile.am b/Makefile.am index 1926745b2..6c5193c88 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ AUTOMAKE_OPTIONS = foreign -SUBDIRS = bwa htslib fermi-lite src +SUBDIRS = bwa fermi-lite src install: mkdir -p lib && cp src/libseqlib.a fermi-lite/libfml.a bwa/libbwa.a htslib/libhts.a lib diff --git a/Makefile.in b/Makefile.in index 01025b80b..3631dc9d5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -132,7 +132,7 @@ am__recursive_targets = \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - cscope distdir distdir-am dist dist-all distcheck + cscope distdir dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)config.h.in # Read a list of newline-separated strings from the standard input, @@ -285,6 +285,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -294,7 +295,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign -SUBDIRS = bwa htslib fermi-lite src +SUBDIRS = bwa fermi-lite src all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -320,8 +321,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -454,10 +455,7 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -522,7 +520,7 @@ distdir-am: $(DISTFILES) ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir @@ -548,7 +546,7 @@ dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir @@ -566,7 +564,7 @@ dist dist-all: distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ @@ -576,7 +574,7 @@ distcheck: dist *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac diff --git a/SeqLib/BamHeader.h b/SeqLib/BamHeader.h index 12a2281b0..1d3ea3949 100644 --- a/SeqLib/BamHeader.h +++ b/SeqLib/BamHeader.h @@ -1,10 +1,10 @@ #ifndef SEQLIB_BAM_HEADER_H__ #define SEQLIB_BAM_HEADER_H__ -#include "htslib/htslib/hts.h" -#include "htslib/htslib/sam.h" -#include "htslib/htslib/bgzf.h" -#include "htslib/htslib/kstring.h" +#include +#include +#include +#include #include "SeqLib/SeqLibUtils.h" #include diff --git a/SeqLib/BamRecord.h b/SeqLib/BamRecord.h index 3ad3b4e22..2c7337703 100644 --- a/SeqLib/BamRecord.h +++ b/SeqLib/BamRecord.h @@ -10,11 +10,11 @@ #include extern "C" { -#include "htslib/htslib/hts.h" -#include "htslib/htslib/sam.h" -#include "htslib/htslib/bgzf.h" -#include "htslib/htslib/kstring.h" -#include "htslib/htslib/faidx.h" +#include +#include +#include +#include +#include } diff --git a/SeqLib/BamWalker.h b/SeqLib/BamWalker.h index d8ae7eecf..e192e086b 100644 --- a/SeqLib/BamWalker.h +++ b/SeqLib/BamWalker.h @@ -12,8 +12,7 @@ #endif extern "C" { -#include "htslib/cram/cram.h" -#include "htslib/cram/cram_io.h" +#include } struct idx_delete { diff --git a/SeqLib/RefGenome.h b/SeqLib/RefGenome.h index d76065a29..297157f8f 100644 --- a/SeqLib/RefGenome.h +++ b/SeqLib/RefGenome.h @@ -5,7 +5,7 @@ #include #include -#include "htslib/htslib/faidx.h" +#include namespace SeqLib { diff --git a/bwa b/bwa index c02766e3c..609311b88 160000 --- a/bwa +++ b/bwa @@ -1 +1 @@ -Subproject commit c02766e3c34ac3f4af9842e20a54b7f9f4b36d0b +Subproject commit 609311b8842244c5c15405b3ea553455f542f786 diff --git a/configure b/configure index 5a70d3a6c..790634115 100755 --- a/configure +++ b/configure @@ -644,6 +644,7 @@ am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE +am__quote am__include DEPDIR OBJEXT @@ -702,6 +703,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -720,8 +722,7 @@ PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR -SHELL -am__quote' +SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking @@ -780,6 +781,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1032,6 +1034,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1169,7 +1180,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1322,6 +1333,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -2134,7 +2146,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -am__api_version='1.16' +am__api_version='1.15' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do @@ -2679,8 +2691,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: -# -# +# +# mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The @@ -2731,7 +2743,7 @@ END Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . +that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM @@ -3281,45 +3293,45 @@ DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 -$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } -cat > confinc.mk << 'END' + +am_make=${MAKE-make} +cat > confinc << 'END' am__doit: - @echo this is the am__doit target >confinc.out + @echo this is the am__doit target .PHONY: am__doit END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= -# BSD make does it like this. -echo '.include "confinc.mk" # ignored' > confmf.BSD -# Other make implementations (GNU, Solaris 10, AIX) do it like this. -echo 'include confinc.mk # ignored' > confmf.GNU -_am_result=no -for s in GNU BSD; do - { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 - (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - case $?:`cat confinc.out 2>/dev/null` in #( - '0:this is the am__doit target') : - case $s in #( - BSD) : - am__include='.include' am__quote='"' ;; #( - *) : - am__include='include' am__quote='' ;; -esac ;; #( - *) : - ;; +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from 'make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; esac - if test "$am__include" != "#"; then - _am_result="yes ($s style)" - break - fi -done -rm -f confinc.* confmf.* -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 -$as_echo "${_am_result}" >&6; } +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : @@ -5683,7 +5695,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # -AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF @@ -6297,35 +6309,29 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. - # TODO: see whether this extra hack can be removed once we start - # requiring Autoconf 2.70 or later. - case $CONFIG_FILES in #( - *\'*) : - eval set x "$CONFIG_FILES" ;; #( - *) : - set x $CONFIG_FILES ;; #( - *) : - ;; -esac + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac shift - # Used to flag and report bootstrapping failures. - am_rc=0 - for am_mf + for mf do # Strip MF so we end up with the name of the file. - am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile which includes - # dependency-tracking related rules and includes. - # Grep'ing the whole file directly is not great: AIX grep has a line + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named 'Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ - || continue - am_dirpart=`$as_dirname -- "$am_mf" || -$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$am_mf" : 'X\(//\)[^/]' \| \ - X"$am_mf" : 'X\(//\)$' \| \ - X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$am_mf" | + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -6343,48 +6349,53 @@ $as_echo X"$am_mf" | q } s/.*/./; q'` - am_filepart=`$as_basename -- "$am_mf" || -$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ - X"$am_mf" : 'X\(//\)$' \| \ - X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$am_mf" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running 'make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "$am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } - /^X\/\(\/\/\)$/{ + /^X\(\/\/\)[^/].*/{ s//\1/ q } - /^X\/\(\/\).*/{ + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` - { echo "$as_me:$LINENO: cd "$am_dirpart" \ - && sed -e '/# am--include-marker/d' "$am_filepart" \ - | $MAKE -f - am--depfiles" >&5 - (cd "$am_dirpart" \ - && sed -e '/# am--include-marker/d' "$am_filepart" \ - | $MAKE -f - am--depfiles) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } || am_rc=$? + as_dir=$dirpart/$fdir; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done done - if test $am_rc -ne 0; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. Try re-running configure with the - '--disable-dependency-tracking' option to at least be able to build - the package (albeit without support for automatic dependency tracking). -See \`config.log' for more details" "$LINENO" 5; } - fi - { am_dirpart=; unset am_dirpart;} - { am_filepart=; unset am_filepart;} - { am_mf=; unset am_mf;} - { am_rc=; unset am_rc;} - rm -f conftest-deps.mk } ;; diff --git a/htslib b/htslib deleted file mode 160000 index 49fdfbda2..000000000 --- a/htslib +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 49fdfbda20acbd73303df3c7fef84f2d972c5f8d diff --git a/src/BamReader.cpp b/src/BamReader.cpp index 91fcedf4c..6d4fa2588 100644 --- a/src/BamReader.cpp +++ b/src/BamReader.cpp @@ -199,7 +199,8 @@ BamReader::BamReader() {} // open cram reference if (!m_cram_reference.empty()) { char * m_cram_reference_cstr = strdup(m_cram_reference.c_str()); - int ret = cram_load_reference(fp->fp.cram, m_cram_reference_cstr); + // TODO: verify that this does what I think it does + int ret = cram_set_option(fp->fp.cram, CRAM_OPT_REFERENCE, m_cram_reference_cstr); free(m_cram_reference_cstr); if (ret < 0) throw std::invalid_argument("Could not read reference genome " + m_cram_reference + " for CRAM opt"); diff --git a/src/Makefile.am b/src/Makefile.am index 925738b73..f86e92307 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,6 @@ noinst_LIBRARIES = libseqlib.a -libseqlib_a_CPPFLAGS = -I../ -I../htslib -Wno-sign-compare +libseqlib_a_CPPFLAGS = -I../ -Wno-sign-compare libseqlib_a_SOURCES = FastqReader.cpp BFC.cpp ReadFilter.cpp SeqPlot.cpp jsoncpp.cpp ssw_cpp.cpp ssw.c \ GenomicRegion.cpp RefGenome.cpp BamWriter.cpp BamReader.cpp \ diff --git a/src/Makefile.in b/src/Makefile.in index ded871939..abe5acda3 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -132,22 +132,7 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp -am__maybe_remake_depfiles = depfiles -am__depfiles_remade = ./$(DEPDIR)/libseqlib_a-BFC.Po \ - ./$(DEPDIR)/libseqlib_a-BWAWrapper.Po \ - ./$(DEPDIR)/libseqlib_a-BamHeader.Po \ - ./$(DEPDIR)/libseqlib_a-BamReader.Po \ - ./$(DEPDIR)/libseqlib_a-BamRecord.Po \ - ./$(DEPDIR)/libseqlib_a-BamWriter.Po \ - ./$(DEPDIR)/libseqlib_a-FastqReader.Po \ - ./$(DEPDIR)/libseqlib_a-FermiAssembler.Po \ - ./$(DEPDIR)/libseqlib_a-GenomicRegion.Po \ - ./$(DEPDIR)/libseqlib_a-ReadFilter.Po \ - ./$(DEPDIR)/libseqlib_a-RefGenome.Po \ - ./$(DEPDIR)/libseqlib_a-SeqPlot.Po \ - ./$(DEPDIR)/libseqlib_a-jsoncpp.Po \ - ./$(DEPDIR)/libseqlib_a-ssw.Po \ - ./$(DEPDIR)/libseqlib_a-ssw_cpp.Po +am__depfiles_maybe = depfiles am__mv = mv -f AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -292,6 +277,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -301,7 +287,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LIBRARIES = libseqlib.a -libseqlib_a_CPPFLAGS = -I../ -I../htslib -Wno-sign-compare +libseqlib_a_CPPFLAGS = -I../ -Wno-sign-compare libseqlib_a_SOURCES = FastqReader.cpp BFC.cpp ReadFilter.cpp SeqPlot.cpp jsoncpp.cpp ssw_cpp.cpp ssw.c \ GenomicRegion.cpp RefGenome.cpp BamWriter.cpp BamReader.cpp \ BWAWrapper.cpp BamRecord.cpp FermiAssembler.cpp BamHeader.cpp @@ -327,8 +313,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -354,27 +340,21 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-BFC.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-BWAWrapper.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-BamHeader.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-BamReader.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-BamRecord.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-BamWriter.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-FastqReader.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-FermiAssembler.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-GenomicRegion.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-ReadFilter.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-RefGenome.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-SeqPlot.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-jsoncpp.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-ssw.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-ssw_cpp.Po@am__quote@ # am--include-marker - -$(am__depfiles_remade): - @$(MKDIR_P) $(@D) - @echo '# dummy' >$@-t && $(am__mv) $@-t $@ - -am--depfiles: $(am__depfiles_remade) +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-BFC.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-BWAWrapper.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-BamHeader.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-BamReader.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-BamRecord.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-BamWriter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-FastqReader.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-FermiAssembler.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-GenomicRegion.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-ReadFilter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-RefGenome.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-SeqPlot.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-jsoncpp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-ssw.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libseqlib_a-ssw_cpp.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -666,10 +646,7 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -738,21 +715,7 @@ clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am - -rm -f ./$(DEPDIR)/libseqlib_a-BFC.Po - -rm -f ./$(DEPDIR)/libseqlib_a-BWAWrapper.Po - -rm -f ./$(DEPDIR)/libseqlib_a-BamHeader.Po - -rm -f ./$(DEPDIR)/libseqlib_a-BamReader.Po - -rm -f ./$(DEPDIR)/libseqlib_a-BamRecord.Po - -rm -f ./$(DEPDIR)/libseqlib_a-BamWriter.Po - -rm -f ./$(DEPDIR)/libseqlib_a-FastqReader.Po - -rm -f ./$(DEPDIR)/libseqlib_a-FermiAssembler.Po - -rm -f ./$(DEPDIR)/libseqlib_a-GenomicRegion.Po - -rm -f ./$(DEPDIR)/libseqlib_a-ReadFilter.Po - -rm -f ./$(DEPDIR)/libseqlib_a-RefGenome.Po - -rm -f ./$(DEPDIR)/libseqlib_a-SeqPlot.Po - -rm -f ./$(DEPDIR)/libseqlib_a-jsoncpp.Po - -rm -f ./$(DEPDIR)/libseqlib_a-ssw.Po - -rm -f ./$(DEPDIR)/libseqlib_a-ssw_cpp.Po + -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -798,21 +761,7 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -f ./$(DEPDIR)/libseqlib_a-BFC.Po - -rm -f ./$(DEPDIR)/libseqlib_a-BWAWrapper.Po - -rm -f ./$(DEPDIR)/libseqlib_a-BamHeader.Po - -rm -f ./$(DEPDIR)/libseqlib_a-BamReader.Po - -rm -f ./$(DEPDIR)/libseqlib_a-BamRecord.Po - -rm -f ./$(DEPDIR)/libseqlib_a-BamWriter.Po - -rm -f ./$(DEPDIR)/libseqlib_a-FastqReader.Po - -rm -f ./$(DEPDIR)/libseqlib_a-FermiAssembler.Po - -rm -f ./$(DEPDIR)/libseqlib_a-GenomicRegion.Po - -rm -f ./$(DEPDIR)/libseqlib_a-ReadFilter.Po - -rm -f ./$(DEPDIR)/libseqlib_a-RefGenome.Po - -rm -f ./$(DEPDIR)/libseqlib_a-SeqPlot.Po - -rm -f ./$(DEPDIR)/libseqlib_a-jsoncpp.Po - -rm -f ./$(DEPDIR)/libseqlib_a-ssw.Po - -rm -f ./$(DEPDIR)/libseqlib_a-ssw_cpp.Po + -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -832,18 +781,18 @@ uninstall-am: .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ - clean-generic clean-noinstLIBRARIES cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES cscopelist-am ctags ctags-am distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am .PRECIOUS: Makefile diff --git a/src/ReadFilter.cpp b/src/ReadFilter.cpp index 97f469e38..b61c0ba89 100644 --- a/src/ReadFilter.cpp +++ b/src/ReadFilter.cpp @@ -1,7 +1,7 @@ #include "SeqLib/ReadFilter.h" #include -#include "htslib/htslib/khash.h" +#include //#define QNAME "D0EN0ACXX111207:7:2306:6903:136511" //#define QFLAG -1 diff --git a/src/seqtools/Makefile.in b/src/seqtools/Makefile.in index e6de23018..d3e622ecb 100644 --- a/src/seqtools/Makefile.in +++ b/src/seqtools/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -119,8 +119,7 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp -am__maybe_remake_depfiles = depfiles -am__depfiles_remade = ./$(DEPDIR)/seqtools-seqtools.Po +am__depfiles_maybe = depfiles am__mv = mv -f AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -253,6 +252,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -285,8 +285,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -350,13 +350,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seqtools-seqtools.Po@am__quote@ # am--include-marker - -$(am__depfiles_remade): - @$(MKDIR_P) $(@D) - @echo '# dummy' >$@-t && $(am__mv) $@-t $@ - -am--depfiles: $(am__depfiles_remade) +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seqtools-seqtools.Po@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -438,10 +432,7 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -513,7 +504,7 @@ clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am - -rm -f ./$(DEPDIR)/seqtools-seqtools.Po + -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -559,7 +550,7 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -f ./$(DEPDIR)/seqtools-seqtools.Po + -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -579,7 +570,7 @@ uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \ distclean distclean-compile distclean-generic distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ From 7a4a68bd8879a6d42570d71baddcd3386259a73f Mon Sep 17 00:00:00 2001 From: Julian Hess Date: Wed, 25 Sep 2019 13:14:16 -0400 Subject: [PATCH 2/4] Make Num(Hard|Soft)Clipped more efficient No need to enumerate the whole CIGAR string; we need only to look at the first and lass CIGAR operators, since clips cannot occur anywhere else in the read. --- SeqLib/BamRecord.h | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/SeqLib/BamRecord.h b/SeqLib/BamRecord.h index 2c7337703..65f73a8b3 100644 --- a/SeqLib/BamRecord.h +++ b/SeqLib/BamRecord.h @@ -665,31 +665,29 @@ class BamRecord { inline int32_t NumSoftClip() const { int32_t p = 0; uint32_t* c = bam_get_cigar(b); - for (size_t i = 0; i < b->core.n_cigar; ++i) - if (bam_cigar_opchr(c[i]) == 'S') - p += bam_cigar_oplen(c[i]); + + p = (((*c) & 0xF) == BAM_CSOFT_CLIP ? ((*c) >> 4) : 0); + c += b->core.n_cigar - 1; + p += (((*c) & 0xF) == BAM_CSOFT_CLIP ? ((*c) >> 4) : 0); + return p; - } + } /** Get the number of hard clipped bases */ inline int32_t NumHardClip() const { int32_t p = 0; uint32_t* c = bam_get_cigar(b); - for (size_t i = 0; i < b->core.n_cigar; ++i) - if (bam_cigar_opchr(c[i]) == 'H') - p += bam_cigar_oplen(c[i]); - return p; - } + p = (((*c) & 0xF) == BAM_CHARD_CLIP ? ((*c) >> 4) : 0); + c += b->core.n_cigar - 1; + p += (((*c) & 0xF) == BAM_CHARD_CLIP ? ((*c) >> 4) : 0); + + return p; + } /** Get the number of clipped bases (hard clipped and soft clipped) */ inline int32_t NumClip() const { - int32_t p = 0; - uint32_t* c = bam_get_cigar(b); - for (size_t i = 0; i < b->core.n_cigar; ++i) - if ( (bam_cigar_opchr(c[i]) == 'S') || (bam_cigar_opchr(c[i]) == 'H') ) - p += bam_cigar_oplen(c[i]); - return p; + return NumSoftClip() + NumHardClip(); } /** Get a string (Z) tag From 9f589fa7fed0179d3f562f95a6157e32cfb1bddb Mon Sep 17 00:00:00 2001 From: Julian Hess Date: Fri, 26 Mar 2021 15:31:33 -0400 Subject: [PATCH 3/4] Add BamReader::GetRegionIdx --- SeqLib/BamReader.h | 5 +++++ src/BamReader.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/SeqLib/BamReader.h b/SeqLib/BamReader.h index 9113ce8c2..50b602cd9 100644 --- a/SeqLib/BamReader.h +++ b/SeqLib/BamReader.h @@ -174,6 +174,11 @@ class BamReader { */ bool SetMultipleRegions(const GRC& grc); + /** Return the current region index + * @return current region index + */ + size_t GetRegionIdx(); + /** Return if the reader has opened the first file */ bool IsOpen() const { if (m_bams.size()) return m_bams.begin()->second.fp.get() != NULL; return false; } diff --git a/src/BamReader.cpp b/src/BamReader.cpp index b4aea4490..409c71b5a 100644 --- a/src/BamReader.cpp +++ b/src/BamReader.cpp @@ -141,6 +141,11 @@ void BamReader::Reset() { return false; } + size_t BamReader::GetRegionIdx() { + // this ought to be in sync across all open BAMs + return m_bams.begin()->second.m_region_idx; + } + bool BamReader::Open(const std::string& bam) { // dont open same bam twice From db79b509bc97474e36d8b28486b51395bfadc635 Mon Sep 17 00:00:00 2001 From: Julian Hess Date: Fri, 26 Mar 2021 15:59:32 -0400 Subject: [PATCH 4/4] Remove a couple new htslib build references --- Makefile.am | 2 +- Makefile.in | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 6c5193c88..ad2ebdd90 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,7 @@ AUTOMAKE_OPTIONS = foreign SUBDIRS = bwa fermi-lite src install: - mkdir -p lib && cp src/libseqlib.a fermi-lite/libfml.a bwa/libbwa.a htslib/libhts.a lib + mkdir -p lib && cp src/libseqlib.a fermi-lite/libfml.a bwa/libbwa.a lib seqtools: mkdir -p bin && cd src/seqtools && make && mv seqtools ../../bin diff --git a/Makefile.in b/Makefile.in index bfb586701..09de47ae6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -296,7 +296,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign -SUBDIRS = bwa htslib fermi-lite src +SUBDIRS = bwa fermi-lite src all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -778,7 +778,7 @@ uninstall-am: install: - mkdir -p lib && cp src/libseqlib.a fermi-lite/libfml.a bwa/libbwa.a htslib/libhts.a lib + mkdir -p lib && cp src/libseqlib.a fermi-lite/libfml.a bwa/libbwa.a lib seqtools: mkdir -p bin && cd src/seqtools && make && mv seqtools ../../bin