Skip to content

Commit

Permalink
Release 1.18
Browse files Browse the repository at this point in the history
  • Loading branch information
daviesrob committed Jul 25, 2023
2 parents 6143086 + 2425ce9 commit d8ca374
Show file tree
Hide file tree
Showing 120 changed files with 9,279 additions and 1,597 deletions.
5 changes: 4 additions & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ libdeflate_template: &LIBDEFLATE
pushd "$HOME"
git clone --depth 1 https://github.com/ebiggers/libdeflate.git
pushd libdeflate
cmake -B build -DLIBDEFLATE_BUILD_SHARED_LIB=OFF -DLIBDEFLATE_BUILD_GZIP=OFF -DCMAKE_C_FLAGS='-g -O3 -fPIC'
cmake -B build -DLIBDEFLATE_BUILD_SHARED_LIB=OFF -DLIBDEFLATE_BUILD_GZIP=OFF -DCMAKE_C_FLAGS="-g -O3 -fPIC $LIBDEFLATE_CFLAGS"
cmake --build build --verbose
popd
popd
Expand Down Expand Up @@ -186,6 +186,9 @@ macosx_task:

environment:
CC: clang
CFLAGS: "-Wall -arch arm64 -arch x86_64"
LDFLAGS: "-arch arm64 -arch x86_64"
LIBDEFLATE_CFLAGS: "-arch arm64 -arch x86_64"
LC_ALL: C
CIRRUS_CLONE_DEPTH: 1

Expand Down
7 changes: 6 additions & 1 deletion INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ various features and specify further optional external requirements:
any enabled pluggable facilities (such as libcurl file access) are built
directly within HTSlib.

Programs that are statically linked to a libhts.a with plugins enabled
need to be linked using -rdynamic or a similar linker option.

The <https://github.com/samtools/htslib-plugins> repository contains
several additional plugins, including the iRODS (<http://irods.org/>)
file access plugin previously distributed with HTSlib.
Expand Down Expand Up @@ -266,7 +269,9 @@ Alpine Linux
------------

doas apk update # Ensure the package list is up to date
doas apk add autoconf automake make gcc musl-dev perl bash zlib-dev bzip2-dev xz-dev curl-dev libressl-dev
doas apk add autoconf automake make gcc musl-dev perl bash zlib-dev bzip2-dev xz-dev curl-dev openssl-dev

Note: some older Alpine versions use libressl-dev rather than openssl-dev.

OpenSUSE
--------
Expand Down
52 changes: 32 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,18 @@ srcdir = .
srcprefix =
HTSPREFIX =

# Flags for SIMD code
HTS_CFLAGS_AVX2 =
HTS_CFLAGS_AVX512 =
HTS_CFLAGS_SSE4 =

# Control building of SIMD code. Not used if configure has been run.
HTS_BUILD_AVX2 =
HTS_BUILD_AVX512 =
HTS_BUILD_SSSE3 =
HTS_BUILD_POPCNT =
HTS_BUILD_SSE4_1 =

include htslib_vars.mk
include htscodecs.mk

Expand All @@ -143,8 +151,8 @@ LIBHTS_SOVERSION = 3
# is not strictly necessary and should be removed the next time
# LIBHTS_SOVERSION is bumped (see #1144 and
# https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryDesignGuidelines.html#//apple_ref/doc/uid/TP40002013-SW23)
MACH_O_COMPATIBILITY_VERSION = 3.1.17
MACH_O_CURRENT_VERSION = 3.1.17
MACH_O_COMPATIBILITY_VERSION = 3.1.18
MACH_O_CURRENT_VERSION = 3.1.18

# $(NUMERIC_VERSION) is for items that must have a numeric X.Y.Z string
# even if this is a dirty or untagged Git working tree.
Expand Down Expand Up @@ -206,6 +214,7 @@ LIBHTS_OBJS = \
regidx.o \
region.o \
sam.o \
sam_mods.o \
synced_bcf_reader.o \
vcf_sweep.o \
tbx.o \
Expand Down Expand Up @@ -274,18 +283,20 @@ config.h:
echo '#endif' >> $@
echo '#define HAVE_DRAND48 1' >> $@
echo '#define HAVE_LIBCURL 1' >> $@
if [ "x$(HTS_CFLAGS_SSE4)" != "x" ] ; then \
if [ "x$(HTS_BUILD_POPCNT)" != "x" ] && \
[ "x$(HTS_BUILD_SSE4_1)" != "x" ] && \
[ "x$(HTS_BUILD_SSSE3)" != "x" ]; then \
echo '#define HAVE_POPCNT 1' >> $@ ; \
echo '#define HAVE_SSE4_1 1' >> $@ ; \
echo '#define HAVE_SSSE3 1' >> $@ ; \
echo '#if defined(HTS_ALLOW_UNALIGNED) && HTS_ALLOW_UNALIGNED == 0' >> $@ ; \
echo '#define UBSAN 1' >> $@ ; \
echo '#endif' >> $@ ; \
fi
if [ "x$(HTS_CFLAGS_AVX2)" != "x" ] ; then \
if [ "x$(HTS_BUILD_AVX2)" != "x" ] ; then \
echo '#define HAVE_AVX2 1' >> $@ ; \
fi
if [ "x$(HTS_CFLAGS_AVX512)" != "x" ] ; then \
if [ "x$(HTS_BUILD_AVX512)" != "x" ] ; then \
echo '#define HAVE_AVX512 1' >> $@ ; \
fi

Expand Down Expand Up @@ -447,6 +458,7 @@ hts_expr.o hts_expr.pico: hts_expr.c config.h $(htslib_hts_expr_h) $(htslib_hts_
hts_os.o hts_os.pico: hts_os.c config.h $(htslib_hts_defs_h) os/rand.c
vcf.o vcf.pico: vcf.c config.h $(htslib_vcf_h) $(htslib_bgzf_h) $(htslib_tbx_h) $(htslib_hfile_h) $(hts_internal_h) $(htslib_khash_str2int_h) $(htslib_kstring_h) $(htslib_sam_h) $(htslib_khash_h) $(htslib_kseq_h) $(htslib_hts_endian_h)
sam.o sam.pico: sam.c config.h $(htslib_hts_defs_h) $(htslib_sam_h) $(htslib_bgzf_h) $(cram_h) $(hts_internal_h) $(sam_internal_h) $(htslib_hfile_h) $(htslib_hts_endian_h) $(htslib_hts_expr_h) $(header_h) $(htslib_khash_h) $(htslib_kseq_h) $(htslib_kstring_h)
sam_mods.o sam_mods.pico: sam_mods.c config.h $(htslib_sam_h) $(textutils_internal_h)
tbx.o tbx.pico: tbx.c config.h $(htslib_tbx_h) $(htslib_bgzf_h) $(htslib_hts_endian_h) $(hts_internal_h) $(htslib_khash_h)
faidx.o faidx.pico: faidx.c config.h $(htslib_bgzf_h) $(htslib_faidx_h) $(htslib_hfile_h) $(htslib_khash_h) $(htslib_kstring_h) $(hts_internal_h)
bcf_sr_sort.o bcf_sr_sort.pico: bcf_sr_sort.c config.h $(bcf_sr_sort_h) $(htslib_khash_str2int_h) $(htslib_kbitset_h)
Expand All @@ -466,7 +478,7 @@ textutils.o textutils.pico: textutils.c config.h $(htslib_hfile_h) $(htslib_kstr
cram/cram_codecs.o cram/cram_codecs.pico: cram/cram_codecs.c config.h $(htslib_hts_endian_h) $(htscodecs_varint_h) $(htscodecs_pack_h) $(htscodecs_rle_h) $(cram_h)
cram/cram_decode.o cram/cram_decode.pico: cram/cram_decode.c config.h $(cram_h) $(cram_os_h) $(htslib_hts_h)
cram/cram_encode.o cram/cram_encode.pico: cram/cram_encode.c config.h $(cram_h) $(cram_os_h) $(sam_internal_h) $(htslib_hts_h) $(htslib_hts_endian_h) $(textutils_internal_h)
cram/cram_external.o cram/cram_external.pico: cram/cram_external.c config.h $(htslib_hfile_h) $(cram_h)
cram/cram_external.o cram/cram_external.pico: cram/cram_external.c config.h $(htscodecs_rANS_static4x16_h) $(htslib_hfile_h) $(cram_h)
cram/cram_index.o cram/cram_index.pico: cram/cram_index.c config.h $(htslib_bgzf_h) $(htslib_hfile_h) $(hts_internal_h) $(cram_h) $(cram_os_h)
cram/cram_io.o cram/cram_io.pico: cram/cram_io.c config.h os/lzma_stub.h $(cram_h) $(cram_os_h) $(htslib_hts_h) $(cram_open_trace_file_h) $(htscodecs_rANS_static_h) $(htscodecs_rANS_static4x16_h) $(htscodecs_arith_dynamic_h) $(htscodecs_tokenise_name3_h) $(htscodecs_fqzcomp_qual_h) $(htscodecs_varint_h) $(htslib_hfile_h) $(htslib_bgzf_h) $(htslib_faidx_h) $(hts_internal_h)
cram/cram_stats.o cram/cram_stats.pico: cram/cram_stats.c config.h $(cram_h) $(cram_os_h)
Expand Down Expand Up @@ -722,18 +734,18 @@ htscodecs/tests/tokenise_name3: htscodecs/tests/tokenise_name3_test.o $(HTSCODEC
htscodecs/tests/varint: htscodecs/tests/varint_test.o $(HTSCODECS_OBJS)
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS) -lm -lpthread

htscodecs/tests/arith_dynamic_test.o: CPPFLAGS += -Ihtscodecs -D_POSIX_C_SOURCE=200112L
htscodecs/tests/arith_dynamic_test.o: htscodecs/tests/arith_dynamic_test.c $(htscodecs_arith_dynamic_h)
htscodecs/tests/fqzcomp_qual_test.o: CPPFLAGS += -Ihtscodecs -D_POSIX_C_SOURCE=200112L
htscodecs/tests/fqzcomp_qual_test.o: htscodecs/tests/fqzcomp_qual_test.c $(htscodecs_fqzcomp_qual_h) $(htscodecs_varint_h)
htscodecs/tests/rANS_static4x16pr_test.o: CPPFLAGS += -Ihtscodecs -D_POSIX_C_SOURCE=200112L
htscodecs/tests/rANS_static4x16pr_test.o: htscodecs/tests/rANS_static4x16pr_test.c $(htscodecs_rANS_static4x16_h)
htscodecs/tests/rANS_static_test.o: CPPFLAGS += -Ihtscodecs -D_POSIX_C_SOURCE=200112L
htscodecs/tests/rANS_static_test.o: htscodecs/tests/rANS_static_test.c $(htscodecs_rANS_static_h)
htscodecs/tests/tokenise_name3_test.o: CPPFLAGS += -Ihtscodecs -D_POSIX_C_SOURCE=200112L
htscodecs/tests/tokenise_name3_test.o: htscodecs/tests/tokenise_name3_test.c $(htscodecs_tokenise_name3_h)
htscodecs/tests/varint_test.o: CPPFLAGS += -Ihtscodecs -D_POSIX_C_SOURCE=200112L
htscodecs/tests/varint_test.o: htscodecs/tests/varint_test.c $(htscodecs_varint_h)
htscodecs/tests/arith_dynamic_test.o: CPPFLAGS += -Ihtscodecs
htscodecs/tests/arith_dynamic_test.o: htscodecs/tests/arith_dynamic_test.c config.h $(htscodecs_arith_dynamic_h)
htscodecs/tests/fqzcomp_qual_test.o: CPPFLAGS += -Ihtscodecs
htscodecs/tests/fqzcomp_qual_test.o: htscodecs/tests/fqzcomp_qual_test.c config.h $(htscodecs_fqzcomp_qual_h) $(htscodecs_varint_h)
htscodecs/tests/rANS_static4x16pr_test.o: CPPFLAGS += -Ihtscodecs
htscodecs/tests/rANS_static4x16pr_test.o: htscodecs/tests/rANS_static4x16pr_test.c config.h $(htscodecs_rANS_static4x16_h)
htscodecs/tests/rANS_static_test.o: CPPFLAGS += -Ihtscodecs
htscodecs/tests/rANS_static_test.o: htscodecs/tests/rANS_static_test.c config.h $(htscodecs_rANS_static_h)
htscodecs/tests/tokenise_name3_test.o: CPPFLAGS += -Ihtscodecs
htscodecs/tests/tokenise_name3_test.o: htscodecs/tests/tokenise_name3_test.c config.h $(htscodecs_tokenise_name3_h)
htscodecs/tests/varint_test.o: CPPFLAGS += -Ihtscodecs
htscodecs/tests/varint_test.o: htscodecs/tests/varint_test.c config.h $(htscodecs_varint_h)

test/hts_endian.o: test/hts_endian.c config.h $(htslib_hts_endian_h)
test/fuzz/hts_open_fuzzer.o: test/fuzz/hts_open_fuzzer.c config.h $(htslib_hfile_h) $(htslib_hts_h) $(htslib_sam_h) $(htslib_vcf_h)
Expand All @@ -743,7 +755,7 @@ test/pileup.o: test/pileup.c config.h $(htslib_sam_h) $(htslib_kstring_h)
test/pileup_mod.o: test/pileup_mod.c config.h $(htslib_sam_h)
test/plugins-dlhts.o: test/plugins-dlhts.c config.h
test/sam.o: test/sam.c config.h $(htslib_hts_defs_h) $(htslib_sam_h) $(htslib_faidx_h) $(htslib_khash_h) $(htslib_hts_log_h)
test/test_bgzf.o: test/test_bgzf.c config.h $(htslib_bgzf_h) $(htslib_hfile_h) $(hfile_internal_h)
test/test_bgzf.o: test/test_bgzf.c config.h $(htslib_bgzf_h) $(htslib_hfile_h) $(htslib_hts_log_h) $(hfile_internal_h)
test/test_expr.o: test/test_expr.c config.h $(htslib_hts_expr_h)
test/test_kfunc.o: test/test_kfunc.c config.h $(htslib_kfunc_h)
test/test_kstring.o: test/test_kstring.c config.h $(htslib_kstring_h)
Expand All @@ -758,7 +770,7 @@ test/test_faidx.o: test/test_faidx.c config.h $(htslib_faidx_h)
test/test_index.o: test/test_index.c config.h $(htslib_sam_h) $(htslib_vcf_h)
test/test-vcf-api.o: test/test-vcf-api.c config.h $(htslib_hts_h) $(htslib_vcf_h) $(htslib_kstring_h) $(htslib_kseq_h)
test/test-vcf-sweep.o: test/test-vcf-sweep.c config.h $(htslib_vcf_sweep_h)
test/test-bcf-sr.o: test/test-bcf-sr.c config.h $(htslib_synced_bcf_reader_h)
test/test-bcf-sr.o: test/test-bcf-sr.c config.h $(htslib_synced_bcf_reader_h) $(htslib_hts_h) $(htslib_vcf_h)
test/test-bcf-translate.o: test/test-bcf-translate.c config.h $(htslib_vcf_h)
test/test_introspection.o: test/test_introspection.c config.h $(htslib_hts_h) $(htslib_hfile_h)
test/test-bcf_set_variant_type.o: test/test-bcf_set_variant_type.c config.h $(htslib_hts_h) vcf.c
Expand Down
167 changes: 167 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,170 @@
Noteworthy changes in release 1.18 (25th July 2023)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Updates
-------

* Using CRAM 3.1 no longer gives a warning about the specification
being draft. Note CRAM 3.0 is still the default output format.
(PR#1583)

* Replaced use of sprintf with snprintf, to silence potential warnings
from Apple's compilers and those who implement similar checks.
(PR#1594, fixes #1586. Reported by Oleksii Nikolaienko)

* Fastq output will now generate empty records for reads with no
sequence data (i.e. sequence is "*" in SAM format). (PR#1576,
fixes samtools/samtools#1576. Reported by Nils Homer)

* CRAM decoding speed-ups. (PR#1580)

* A new MN aux tag can now be used to verify that MM/ML base modification
data has not been broken by hard clipping. (PR#1590, PR#1612. See also
PR samtools/hts-specs#714 and issue samtools/hts-specs#646.
Reported by Jared Simpson)

* The base modification API has been improved to make it easier for callers
to tell unchecked bases from unmodified ones. (PR#1636, fixes #1550.
Requested by Chris Wright)

* A new bam_mods_queryi() API has been added to return additional
data about the i-th base modification returned by bam_mods_recorded().
(PR#1636, fixes #1550 and #1635. Requested by Jared Simpson)

* Speed up index look-ups for whole-chromosome queries. (PR#1596)

* Mpileup now merges adjacent (mis)match CIGAR operations, so CIGARs
using the X/= operators give the same results as if the M operator
was used. (PR#1607, fixes #1597. Reported by Marcel Martin)

* It's now possible to call bcf_sr_set_regions() after adding readers
using bcf_sr_add_reader() (previously this returned an error). Doing so
will discard any unread data, and reset the readers so they iterate over
the new regions. (PR#1624, fixes samtools/bcftools#1918. Reported by
Gregg Thomas)

* The synced BCF reader can now accept regions with reference names including
colons and hyphens, by enclosing them in curly braces. For example,
{chr_part:1-1001}:10-20 will return bases 10 to 20 from reference
"chr_part:1-1001". (PR#1630, fixes #1620. Reported by Bren)

* Add a "samples" directory with code demonstrating usage of HTSlib plus
a tutorial document. (PR#1589)

Build changes
-------------

* Htscodecs has been updated to 1.5.1 (PR#1654)

* Htscodecs SIMD code now works with Apple multiarch binaries.
(PR#1587, HTSlib fix for samtools/htscodecs#76. Reported by John Marshall)

* Improve portability of "expr" usage in version.sh.
(PR#1593, fixes #1592. Reported by John Marshall)

* Improve portability to *BSD targets by ensuring _XOPEN_SOURCE is defined
correctly and that source files properly include "config.h". Perl
scripts also now all use #!/usr/bin/env instead of assuming that
it's in /usr/bin/perl. (PR#1628, fixes #1606.
Reported by Robert Clausecker)

* Fixed NAME entry in htslib-s3-plugin man page so the whatis and apropos
commands find it. (PR#1634, thanks to Étienne Mollier)

* Assorted dependency tracking fixes. (PR#1653, thanks to John Marshall)

Documentation updates
---------------------

* Changed Alpine build instructions as they've switched back to using openssl.
(PR#1609)

* Recommend using -rdynamic when statically linking a libhts.a with
plugins enabled. (PR#1611, thanks to John Marshall. Fixes #1600,
reported by Jack Wimberley)

* Fixed example in docs for sam_hdr_add_line(). (PR#1618, thanks to kojix2)

* Improved test harness for base modifications API. (PR#1648)

Bug fixes
---------

* Fix a major bug when searching against a CRAM index where one container
has start and end coordinates entirely contained within the previous
container. This would occasionally miss data, and sometimes return much
more than required. The bug affected versions 1.11 to 1.17, although the
change in 1.11 was bug-fixing multi-threaded index queries. This bug did
not affect index building. There is no need to reindex your CRAM files.
(PR#1574, PR#1640. Fixes #1569, #1639, samtools/samtools#1808,
samtools/samtools#1819. Reported by xuxif, Jens Reeder and Jared Simpson)

* Prevent CRAM blocks from becoming too big in files with short
sequences but very long aux tags. (PR #1613)

* Fix bug where the CRAM decoder for CONST_INT and CONST_BYTE
codecs may incorrectly look for extra data in the CORE block.
Note that this bug only affected the experimental CRAM v4.0 decoder.
(PR#1614)

* Fix crypt4gh redirection so it works in conjunction with non-file
IO, such as using htsget. (PR#1577)

* Improve error checking for the VCF POS column, when facing invalid
data. (PR#1575, replaces #1570 originally reported and fixed
by Colin Nolan.)

* Improved error checking on VCF indexing to validate the data is BGZF
compressed. (PR#1581)

* Fix bug where bin number calculation could overflow when making iterators
over regions that go to the end of a chromosome. (PR#1595)

* Backport attractivechaos/klib#78 (by Pall Melsted) to HTSlib.
Prevents infinite loops in kseq_read() when reading broken gzip files.
(PR#1582, fixes #1579. Reported by Goran Vinterhalter)

* Backport attractivechaos/klib@384277a (by innoink) to HTSlib.
Fixes the kh_int_hash_func2() macro definition.
(PR#1599, fixes #1598. Reported by fanxinping)

* Remove a compilation warning on systems with newer libcurl releases.
(PR#1572)

* Windows: Fixed BGZF EOF check for recent MinGW releases. (PR#1601,
fixes samtools/bcftools#1901)

* Fixed bug where tabix would not return the correct regions for files
where the column ordering is end, ..., begin instead of begin, ..., end.
(PR#1626, fixes #1622. Reported by Hiruna Samarakoon)

* sam_format_aux1() now always NUL-terminates Z/H tags. (PR#1631)

* Ensure base modification iterator is reset when no MM tag is present.
(PR#1631, PR#1647)

* Fix segfault when attempting to write an uncompressed BAM file opened using
hts_open(name, "wbu"). This was attempting to write BAM data without
wrapping it in BGZF blocks, which is invalid according to the BAM
specification. "wbu" is now internally converted to "wb0" to output
uncompressed data wrapped in BGZF blocks. (PR#1632, fixes #1617.
Reported by Joyjit Daw)

* Fixed over-strict bounds check in probaln_glocal() which caused it to make
sub-optimal alignments when the requested band width was greater than the
query length. (PR#1616, fixes #1605. Reported by Jared Simpson)

* Fixed possible double frees when handling errors in bcf_hdr_add_hrec(),
if particular memory allocations fail. (PR#1637)

* Ensure that bcf_hdr_remove() clears up all pointers to the items removed
from dictionaries. Failing to do this could have resulted in a call
requesting a deleted item via bcf_hdr_get_hrec() returning a stale pointer.
(PR#1637)

* Stop the gzip decompresser from finishing prematurely when an empty
gzip block is followed by more data. (PR#1643, PR#1646)

Noteworthy changes in release 1.17 (21st February 2023)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion bgzf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Copyright (c) 2008 Broad Institute / Massachusetts Institute of Technology
2011, 2012 Attractive Chaos <[email protected]>
Copyright (C) 2009, 2013-2021 Genome Research Ltd
Copyright (C) 2009, 2013-2022 Genome Research Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion bgzip.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH bgzip 1 "21 February 2023" "htslib-1.17" "Bioinformatics tools"
.TH bgzip 1 "25 July 2023" "htslib-1.18" "Bioinformatics tools"
.SH NAME
.PP
bgzip \- Block compression/decompression utility
Expand Down
Loading

0 comments on commit d8ca374

Please sign in to comment.