forked from samtools/htslib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NEWS
2302 lines (1656 loc) · 94 KB
/
NEWS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Noteworthy changes in release a.b
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Noteworthy changes in release 1.19.1 (22nd January 2024)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Fixed a regression in release 1.19 that caused all aux records to
be stored uncompressed in CRAM files. The resulting files were
correctly formatted, but bigger than they needed to be.
(PR#1729, fixes samtools#1968. Reported by Clockris)
* Fixed possible out-of-bounds reads due to an incorrect check on
B tag lengths in cram_encode_aux(). (PR#1725)
* Fixed an incorrect check on tag length which could fail to catch a
two byte out-of-bounds read in bam_get_aux(). (PR#1728)
* Made errors reported by hts_open_format() less confusing when it can't
open the reference file. (PR#1724, fixes #1723. Reported by
Alex Leonard)
* Made hts_close() fail more gracefully if it's passed a NULL pointer
(PR#1724)
Noteworthy changes in release 1.19 (12th December 2023)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Updates
-------
* A temporary work-around has been put in the VCF parser so that it is
less likely to fail on rows with a large number of ALT alleles,
where Number=G tags like PL can expand beyond the 2Gb limit enforced
by HTSlib. For now, where this happens the offending tag will be dropped
so the data can be processed, albeit without the likelihood data.
In future work, the library will instead convert such tags into their
local alternatives (see https://github.com/samtools/hts-specs/pull/434).
* New program. Adds annot-tsv which annotates regions in a destination file with
texts from overlapping regions in a source file.
(PR#1619)
* Change bam_parse_cigar() so that it can modify existing BAM records. This
makes more useful as public API. Previously it could only handle partially
formed BAM records.
(PR#1651, fixes #1650. Reported by Oleksii Nikolaienko)
* Add "uncompressed" to hts_format_description() where appropriate. This adds
an "uncompressed" description to uncompressed files that would normally be
compressed, such as BAM and BCF.
(PR#1656, in relation to samtools#1884. Thanks to John Marshall)
* Speed up to the VCF parser and writer.
(PR#1644 and PR#1663)
* Add an hclen (hard clip length) SAM filter function.
(PR#1660, with reference to samtools#813)
* Avoid really closing stdin/stdout in hclose()/hts_close()/et al.
See discussion in PR for details.
(PR#1665. Thanks to John Marshall)
* Add support to handle multiple files in bgzip.
(PR#1658, fixes #1642. Requested by bw2)
* Enable auto-vectorisation in CRAM 3.1 codecs. Speeds decoding on some
sequencing platform data.
(PR#1669)
* Speed up removal of lines in large headers.
(PR#1662, fixes #1460. Reported by Anže Starič)
* Apply seqtk PR to improve kseq.h parsing performance. Port of
Fabian Klötzl's (kloetzl) lh3/seqtk#123 and attractivechaos/klib#173 to
HTSlib.
(PR#1674. Thanks to John Marshall)
Build changes
-------------
* Updated htscodecs submodule to 1.6.0.
(PR#1685, PR#1717, PR#1719)
* Apply the packed attribute to uint*_u types for Clang to prevent
-fsanitize=alignment failures.
(PR#1667. Thanks to Fangrui Song)
* Fuzz testing improvements.
(PR#1664)
* Add C++ casts for external headers in klist.h and kseq.h.
(PR#1683. See also PR#1674 and PR#1682)
* Add test case compiling the public headers as C++.
(PR#1682. Thanks to John Marshall)
* Enable optimisation level -O3 for SAM QUAL+33 formatting.
(PR#1679)
* Make compiler flag detection work with zig cc.
(PR#1687)
* Fix unused value warnings when built with NDEBUG.
(PR#1688)
* Remove some disused Makefile variables, fix typos and a warning. Improve
bam_parse_basemod() documentation.
(PR#1705, Thanks to John Marshall)
Bug fixes
---------
* Fail bgzf_useek() when offset is above block limits.
(PR#1668)
* Fix multi-threaded on-the-fly indexing problems.
(PR#1672, fixes samtools#1861 and bcftools#1985. Reported by Mark Ebbert and
lacek)
* Fix hfile_libcurl small seek bug.
(PR#1676, fixes samtools#1918. Also may fix #1037, #1625 and samtools#1622.
Reported by Alex Reynolds, Mark Walker, Arthur Gilly and skatragadda-nygc.
Thanks to John Marshall)
* Fix a minor memory leak in malformed CRAM EXTERNAL blocks. [fuzz]
(PR#1671)
* Fix a cram decode hang from block_resize().
(PR#1680. Reported by Sebastian Deorowicz)
* Cram fuzzing improvements. Fixes a number of cram errors.
(PR#1701, fixes #1691, #1692, #1693, #1696, #1697, #1698, #1699 and #1700.
Thanks to Octavio Galland for finding and reporting all these)
* Fix crypt4gh redirection.
(PR#1675, fixes grbot/crypt4gh-tutorial#2. Reported by hth4)
* Fix PG header linking when records make a loop.
(PR#1702, fixes #1694. Reported by Octavio Galland)
* Prevent issues with no-stored-sequence records in CRAM files, by ensuring
they are accounted for properly in block size calculations, and by limiting
the maximum query length in the CIGAR data. Originally seen as an overflow
by OSS-Fuzz / UBSAN, it turned out this could lead to excessive time and
memory use by HTSlib, and could result in it writing out unreadable CRAM
files.
(PR#1710)
* Fix some illegal shifts and integer overflows found by OSS-Fuzz / UBSAN.
(PR#1707, PR#1712, PR#1713)
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)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* A new API for iterating through a BAM record's aux field.
(PR#1354, addresses #1319. Thanks to John Marshall)
* Text mode for bgzip. Allows bgzip to compress lines of text with block breaks
at newlines.
(PR#1493, thanks to Mike Lin for the initial version PR#1369)
* Make tabix support CSI indices with large positions. Unlike SAM and VCF
files, BED files do not set a maximum reference length which hindered CSI
support. This change sets an arbitrary large size of 100G to enable it to
work.
(PR#1506)
* Add a fai_line_length function. Exposes the internal line-wrap length.
(PR#1516)
* Check for invalid barcode tags in fastq output.
(PR#1518, fixes samtools#1728. Reported by Poshi)
* Warn if reference found in a CRAM file is not contained in the specified
reference file.
(PR#1517 and PR#1521, adds diagnostics for #1515. Reported by Wei WeiDeng)
* Add a faidx_seq_len64 function that can return sequence lengths longer than
INT_MAX. At the same time limit faidx_seq_len to INT_MAX output. Also add a
fai_adjust_region to ensure given ranges do not go beyond the end of the
requested sequence.
(PR#1519)
* Add a bcf_strerror function to give text descriptions of BCF errors.
(PR#1510)
* Add CRAM SQ/M5 header checking when specifying a fasta file. This is to
prevent creating a CRAM that cannot be decoded again.
(PR#1522. In response to samtools#1748 though not a direct fix)
* Improve support for very long input lines (> 2Gbyte). This is mostly useful
for tabix which does not do much interpretation of its input.
(PR#1542, a partial fix for #1539)
* Speed up load_ref_portion. This function has been sped up by about 7x, which
speeds up low-depth CRAM decoding by about 10%.
(PR#1551)
* Expand CRAM API to cope with new samtools cram_size command.
(PR#1546)
* Merges neighbouring I and D ops into one op within pileup. This means
4M1D1D1D3M is reported as 4M3D3M. Fixing this in sam.c means not only is
samtools mpileup now looking better, but any tool using the mpileup API will
be getting consistent results.
(PR#1552, fixes the last remaining part of samtools#139)
* Update the API documentation for bgzf_mt as it refered to a previous
iteration.
(PR#1556, fixes #1553. Reported by Raghavendra Padmanabhan)
Build changes
-------------
* Use POSIX grep in testing as egrep and fgrep are considered obsolete.
(PR#1509, thanks to David Seifert)
* Switch to building libdefalte with cmake for Cirris CI.
(PR#1511)
* Ensure strings in config_vars.h are escaped correctly.
(PR#1530, fixes #1527. Reported by Lucas Czech)
* Easier modification of shared library permissions during install.
(PR#1532, fixes #1525. Reported by StephDC)
* Fix build on ancient compilers. Added -std=gnu90 to build tests so older
C compilers will still be happy.
(PR#1524, fixes #1523. Reported by Martin Jakt)
* Switch MacOS CI tests to an ARM-based image.
(PR#1536)
* Cut down the number of embed_ref=2 tests that get run.
(PR#1537)
* Add symbol versions to libhts.so. This is to aid package developers.
(PR#1560 addresses #1505, thanks to John Marshall. Reported by Stefan Bruens)
* htscodecs now updated to v1.4.0.
(PR#1563)
* Cleaned up misleading system error reports in test_bgzf.
(PR#1565)
Bug fixes
---------
* VCF. Fix n-squared complexity in sample line with many adjacent tabs [fuzz].
(PR#1503)
* Improved bcftools detection and reporting of bgzf decode errors.
(PR#1504, thanks to Lilian Janin. PR#1529 thanks to Bergur Ragnarsson, fixes
#1528. PR#1554)
* Prevent crash when the only FASTA entry has no sequence [fuzz].
(PR#1507)
* Fixed typo in sam.h documentation.
(PR#1512, thanks to kojix2)
* Fix buffer read-overrun in bam_plp_insertion_mod.
(PR#1520)
* Fix hash keys being left behind by bcf_hdr_remove.
(PR#1535, fixes #1533. Reported by Giulio Genovese in #842)
* Make bcf_hdr_idinfo_exists more robust by checking id value exists.
(PR#1544, fixes #1538. Reported by Giulio Genovese)
* CRAM improvements. Fixed crash with multi-threaded CRAM. Fixed a bug in the
codec parameter learning for CRAM 3.1 name tokeniser. Fixed Cram compression
container substitution matrix generation,
(PR#1558, PR#1559 and PR#1562)
Noteworthy changes in release 1.16 (18th August 2022)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Make hfile_s3 refresh AWS credentials on expiry in order to make HTSlib work
better with AWS IAM credentials, which have a limited lifespan.
(PR#1462 and PR#1474, addresses #344)
* Allow BAM headers between 2GB and 4GB in size once more. This is not
permitted in the BAM specification but was allowed in an earlier version of
HTSlib. There is now a warning at 2GB and a hard failure at 4GB.
(PR#1421, fixes #1420 and samtools#1613. Reported by John Marshall and
R C Mueller)
* Improve error message when failing to load an index.
(PR#1468, example of the problem samtools#1637)
* Permit MM (base modification) tags containing "." and "?" suffixes. These
define implicit vs explicit coordinates. See the SAM tags specification for
details.
(PR#1423 and PR#1426, fixes #1418. PR#1469, fixes #1466. Reported
by cjw85)
* Warn if spaces instead of tabs are detected in a VCF file to prevent
confusion.
(PR#1328, fixes bcftools#1575. Reported by ketkijoshi278)
* Add an "sclen" filter expression keyword. This is the length of a soft-clip,
both left and right end. It may be combined with qlen (qlen-sclen) to obtain
the number of bases in the query sequence that have been aligned to the genome
ie it provides a way to compare local-alignment vs global-alignment length.
(PR#1441 and PR/samtools#1661, fixes #1436. Requested by Chang Y)
* Improve error messages for CRAM reference mismatches. If the user specifies
the wrong reference, the CRAM slice header MD5sum checks fail. We now report
the SQ line M5 string too so it is possible to validate against the whole
chr in the ref.fa file. The error message has also been improved to report
the reference name instead of #num. Finally, we now hint at the likely cause,
which counters the misleading samtools supplied error of "truncated or
corrupt" file.
(PR#1427, fixes samtools#1640. Reported by Jian-Guo Zhou)
* Expose more of the CRAM API and add new functionality to extract the reference
from a CRAM file.
(PR#1429 and PR#1442)
* Improvements to the implementation of embedded references in CRAM where no
external reference is specified.
(PR#1449, addresses some of the issues in #1445)
* The CRAM writer now allows alignment records with RG:Z: aux tags that
don't have a corresponding @RG ID in the file header. Previously these
tags would have been silently dropped. HTSlib will complain whenever it
has to add one though, as such tags do not conform to recommended practice
for the SAM, BAM and CRAM formats.
(PR#1480, fixes #1479. Reported by Alex Leonard)
* Set tab delimiter in man page for tabix GFF3 sort.
(PR#1457. Thanks to Colin Diesh)
* When using libdeflate, the 1...9 scale of BGZF compression levels is
now remapped to the 1...12 range used by libdeflate instead of being
passed directly. In particular, HTSlib levels 8 and 9 now map to
libdeflate levels 10 and 12, so it is possible to select the highest (but
slowest) compression offered by libdeflate.
(PR#1488, fixes #1477. Reported by Gert Hulselmans)
* The VCF variant API has been extended so that it can return separate flags
for INS and DEL variants as well as the existing INDEL one. These flags
have not been added to the old bcf_get_variant_types() interface as
it could break existing users. To access them, it is necessary to use new
functions bcf_has_variant_type() and bcf_has_variant_types().
(PR#1467)
* The missing, but trivial, `le_to_u8()` function has been added to hts_endian.
(PR#1494, Thanks to John Marshall)
* bcf_format_gt() now works properly on big-endian platforms.
(PR#1495, Thanks to John Marshall)
Build changes
-------------
These are compiler, configuration and makefile based changes.
* Update htscodecs to version 1.3.0 for new SIMD code + various fixes.
Updates the htscodecs submodule and adds changes necessary to make HTSlib
build the new SIMD codec implementations.
(PR#1438, PR#1489, PR#1500)
* Fix clang builds under mingw. Under mingw, clang requires dllexport to be
applied to both function declarations and function definitions.
(PR#1435, PR#1497, PR#1498 fixes #1433. Reported by teepean)
* Fix curl type warning with gcc 12.1 on Windows.
(PR#1443)
* Detect ARM Neon support and only build appropriate SIMD object files.
(PR#1451, fixes #1450. Thanks to John Marshall)
* `make print-config` now reports extra CFLAGS that are needed to build the
SIMD parts of htscodecs. These may be of use to third-party build
systems that don't use HTSlib's or htscodecs' build infrastructure. (PR#1485.
Thanks to John Marshall)
* Fixed some Makefile dependency issues for the "check"/"test" targets
and plugins. In particular, "make check" will now build the "all" target,
if not done already, before running the tests.
(PR#1496)
Bug fixes
---------
* Fix bug when reading position -1 in BCF (0 in VCF), which is used to indicate
telomeric regions. The BCF reader was incorrectly assuming the value stored
in the file was unsigned, so a VCF->BCF->VCF round-trip would change it
from 0 to 4294967296.
(PR#1476, fixes #1475 and bcftools#1753. Reported by Rodrigo Martin)
* Various bugs and quirks have been fixed in the filter expression engine,
mostly related to the handling of absent tags, and the is_true flag.
Note that as a result of these fixes, some filter expressions may give
different results:
- Fixed and-expressions including aux tag values which could give an invalid
true result depending on the order of terms.
- The expression `![NM]` is now true if only `NM` does not exist. In
earlier versions it would also report true for tags like `NM:i:0` which
exist but have a value of zero.
- The expression `[X1] != 0` is now false when `X1` does not exist. Earlier
versions would return true for this comparison when the tag was missing.
- NULL values due to missing tags now propagate through string, bitwise
and mathematical operations. Logical operations always treat them as
false.
(PR#1463, fixes samtools#1670. Reported by Gert Hulselmans;
PR#1478, fixes samtools#1677. Reported by johnsonzcode)
* Fix buffer overrun in bam_plp_insertion_mod. Memory now grows to the proper
size needed for base modification data.
(PR#1430, fixes samtools#1652. Reported by hd2326)
* Remove limit of returned size from fai_retrieve().
(PR#1446, fixes samtools#1660. Reported by Shane McCarthy)
* Cap hts_getline() return value at INT_MAX. Prevents hts_getline() from
returning a negative number (a fail) for very long string length values.
(PR#1448. Thanks to John Marshall)
* Fix breakend detection and test bcf_set_variant_type().
(PR#1456, fixes #1455. Thanks to Martin Pollard)
* Prevent arrays of BCF_BT_NULL values found in BCF files from causing
bcf_fmt_array() to call exit() as the type is unsupported. These are
now tested for and caught by bcf_record_check(), which returns an
error code instead. (PR#1486)
* Improved detection of fasta and fastq files that have very long comments
following identifiers. (PR#1491, thanks to John Marshall.
Fixes samtools/samtools#1689, reported by cjw85)
* Fixed a SEGV triggered by giving a SAM file to `samtools import`.
(PR#1492)
Noteworthy changes in release 1.15.1 (7th April 2022)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Security fix: Fixed broken error reporting in the sam_prob_realn()
function, due to a missing hts_log() parameter. Prior to this fix
(i.e., in HTSlib versions 1.8 to 1.15) it was possible to abuse
the log message format string by passing a specially crafted
alignment record to this function. (PR#1406)
* HTSlib now uses libhtscodecs release 1.2.2. This fixes a number
of bugs where invalid compressed data could trigger usage of
uninitialised values. (PR#1416)
* Fixed excessive memory used by multi-threaded SAM output on
long reads. (Part of PR#1384)
* Fixed a bug where tabix would misinterpret region specifiers
starting at position 0. It will also now warn if the file
being indexed is supposed to be 1-based but has positions
less than or equal to 0. (PR#1411)
* The VCF header parser will now issue a warning if it finds an
INFO header with Type=Flag but Number not equal to 0. It will
also ignore the incorrect Number so the flag can be used. (PR#1415)
Noteworthy changes in release 1.15 (21st February 2022)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Features and Updates
--------------------
* Bgzip now has a --keep option to not remove the input file after
compressing. (PR#1331)
* Improved file format detection so some BED files are no longer
detected as FASTQ or FASTA. (PR#1350, thanks to John Marshall)
* Added xz (lzma), zstd and D4 formats to the file type detection
functions. We don't actively support reading these data types, but
function calls and htsfile can detect them. (PR#1340, thanks to
John Marshall)
* CRAM now also uses libdeflate for read-names if the libdeflate
version is new enough (1.9 onwards). Previously we used zlib for
this due to poor performance of libdeflate. This gives a slight
speed up and reduction in file size. (PR#1383)
* The VCF and BCF readers will now issue a warning if contig, INFO
or FORMAT IDs do not match the formats described in the VCFv4.3
specification. Note that while the invalid names will mostly still
be accepted, future updates will convert the warnings to errors
causing files including invalid names to be rejected. (PR#1389)
Build changes
-------------
These are compiler, configuration and makefile based changes.
* HTSlib now uses libhtscodecs release 1.2.1.
* Improved support for compiling and linking against HTSlib with
Microsoft Visual Studio. (PR#1380, #1377, #1375. Thanks to
Aidan Bickford and John Marshall)
* Various internal CI improvements.
Bug fixes
---------
* Fixed CRAM index queries for HTSJDK output (PR#1388, reported by
Chris Norman). Note this also fixes writing CRAM writing, to match
the specification (and HTSJDK), from version 3.1 onwards.
* Fixed CRAM index queries when required-fields settings are selected
to ignore CIGARs (PR#1372, reported by Giulio Genovese).
* Unmapped but placed (having chr/pos) are now included in the BAM
indices. (PR#1352, thanks to John Marshall)
* CRAM now honours the filename##idx##index nomenclature for
specifying non-standard index locations. (PR#1360, reported by
Michael Cariaso)
* Minor CRAM v1.0 read-group fix (PR#1349, thanks to John Marshall)
* Permit .fa and .fq file type detection as synonyms for FASTA and
FASTQ. (PR#1386).
* Empty VCF format fields are now output ":.:" as instead of "::".
(PR#1370)
* Repeated bcf_sr_seek calls now work. (PR#1363, reported by
Giulio Genovese)
* Bcf_remove_allele_set now works on unpacked BCF records. (PR#1358,
reported by Brent Pedersen).
* The hts_parse_decimal() function used to read numbers in region lists
is now better at rejecting non-numeric values. In particular it
now rejects a lone 'G' instead of interpreting it as '0G', i.e. zero.
(PR#1396, PR#1400, reported by SSSimon Yang; thanks to John Marshall).
* Improve support for GPU issues listed by -Wdouble-promotion.
(PR#1365, reported by David Seisert)
* Fix example code in header file documentation. (PR#1381, Thanks to
Aidan Bickford)
Noteworthy changes in release 1.14 (22nd October 2021)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Features and Updates
--------------------
* Added a keep option to bgzip to leave the original file untouched. This
brings bgzip into line with gzip. (PR #1331, thanks to Alex Petty)
* "endpos" has been added to the filter language, giving the position
of the rightmost mapped base as measured by the CIGAR string. For
unmapped reads it is the same as "pos". (PR #1307, thanks to John Marshall)
* Interfaces have been added to interpret the new base modification tags
added to the SAMtags document in samtools/hts-specs#418. (PR #1132)
* New API functions hts_flush()/sam_flush()/bcf_flush() for flushing output
htsFile/samFile/vcfFile streams. (PR #1326, thanks to John Marshall)
* The synced_bcf_reader now sorts lines with symbolic alleles by END tag as
well as POS. (PR #1321)
* Added synced_bcf_reader options BCF_SR_REGIONS_OVERLAP and
BCF_SR_TARGETS_OVERLAP for better control of records that start outside
the desired region but overlap it are handled. Fixes samtools/bcftools#1420
and samtools/bcftools#1421 raised by John Marshall. (PR #1327)
* HTSlib will now accept long-cigar CG:B: tags made by htsjdk which don't
quite follow the specification properly (using signed values instead of
unsigned). Thanks to Colin Diesh for reporting an example file. (PR #1317)
* The warning printed when the BGZF reader finds a file with no EOF block
has been changed to be less alarming. Unfortunately some third-party
BGZF encoders don't write EOF blocks at the end of files. Thanks to
Keiran Raine for reporting an example file. (PR #1323)
* The FASTA and FASTQ readers get an option to skip over the first item on
the header line, and use the second as the read name. It allows the original
name to be restored on some of the fastq files served from the European
Nucleotide Archive (ENA). (PR #1325)
* HTSlib is now more strict when parsing the VCF samples line (beginning
#CHROM). It will only accept tabs between the mandatory field names and
sample names must be separated with tabs. (PR #1328)
* HTSlib will now warn if it looks like the header has been corrupted
by diagnostic messages from the program that made it. This can happen when
using `nohup`, which by default mixes stdout and stderr into the same
stream. (PR#1339, thanks to John Marshall)
* File format detection will now recognise signatures for XZ, Zstd and D4
files (note that HTSlib will not read them yet). (PR #1340, thanks to
John Marshall)
Build changes
-------------
These are compiler, configuration and makefile based changes.
* Some redundant tests have been removed from the test harness, speeding it up.
(PR #1308)
* The version.sh script now works better on shallow checkouts. (PR #1324)
* A check-untracked Makefile target has been added to catch untracked files
(mostly) left by the test harness. (PR #1324)
Bug fixes
---------
* Fixed a case where flushing the thread pool could very occasionally cause
a deadlock. (PR #1309)
* Fixed a bug where some CRAM files could fail to decode if the required_fields
option was in use. Thanks to Matt Sexton for reporting the issue.
(PR #1314, fixes samtools/samtools#1475)
* Fixed a regression where the S3 plugin could not read public files unless
you supplied some Amazon credentials. Thanks to Chris Saunders for reporting.
(PR #1332, fixes samtools/samtools#1491)
* Fixed a possible CRAM thread deadlock discovered by @ryancaicse.
(PR #1330, fixes #1329)
* Some set-but-unused variables have been removed. (PR #1334)
* Fixed a bug which prevented "flag.read2" from working in the filter
language unless it was at the end of the expression. Thanks to Vamsi Kodali
for reporting the issue. (PR #1342)
* Fixed a memory leak that could happen if CRAM fails to inflate a LZMA
block. (PR #1340, thanks to John Marshall)
Noteworthy changes in release 1.13 (7th July 2021)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Features and Updates
--------------------
* In case a PG header line has multiple ID tags supplied by other applications,
the header API now selects the first one encountered as the identifying tag
and issues a warning when detecting subsequent ID tags.
(#1256; fixed samtools/samtools#1393)
* VCF header reading function (vcf_hdr_read) no longer tries to download a
remote index file by default.
(#1266; fixes #380)
* Support reading and writing FASTQ format in the same way as SAM, BAM or CRAM.
Records read from a FASTQ file will be treated as unmapped data.
(#1156)
* Added GCP requester pays bucket access. Thanks to @indraniel.
(#1255)
* Made mpileup's overlap removal choose which copy to remove at random instead
of always removing the second one. This avoids strand bias in experiments
where the +ve and -ve strand reads always appear in the same order.
(#1273; fixes samtools/bcftools#1459)
* It is now possible to use platform specific BAQ parameters. This also
selects long-read parameters for read lengths bigger than 1kb, which helps
bcftools mpileup call SNPs on PacBio CCS reads.
(#1275)
* Improved bcf_remove_allele_set. This fixes a bug that stopped iteration over
alleles prematurely, marks removed alleles as 'missing' and does automatic
lazy unpacking.
(#1288; fixes #1259)
* Improved compression metrics for unsorted CRAM files. This improves the
choice of codecs when handling unsorted data.
(#1291)
* Linear index entries for empty intervals are now initialised with the file
offset in the next non-empty interval instead of the previous one. This
may reduce the amount of data iterators have to discard before reaching
the desired region, when the starting location is in a sequence gap.
Thanks to @carsonh for reporting the issue.
(#1286; fixes #486)
* A new hts_bin_level API function has been added, to compute the level of a
given bin in the binning index.
(#1286)
* Related to the above, a new API method, hts_idx_nseq, now returns the total
number of contigs from an index.
(#1295 and #1299)
* Added bracket handling to bcf_hdr_parse_line, for use with ##META lines.
Thanks to Alberto Casas Ortiz.
(#1240)
Build changes
-------------
These are compiler, configuration and makefile based changes.
* HTSlib now uses libhtscodecs release 1.1.1.
* Added a curl/curl.h check to configure and improved INSTALL documentation on
build options. Thanks to Melanie Kirsche and John Marshall.
(#1265; fixes #1261)
* Some fixes to address GCC 11.1 warnings.
(#1280, #1284, #1285; fixes #1283)
* Supports building HTSlib in a separate directory. Thanks to John Marshall.
(#1277; fixes #231)
* Supports building HTSlib on MinGW 32-bit environments. Thanks to
John Marshall.
(#1301)
Bug fixes
---------
* Fixed hts_itr_query() et al region queries: fixed bug introduced in
HTSlib 1.12, which led to iterators producing very few reads for some
queries (especially for larger target regions) when unmapped reads were
present. HTSlib 1.11 had a related problem in which iterators would omit
a few unmapped reads that should have been produced; cf #1142.
Thanks to Daniel Cooke for reporting the issue.
(#1281; fixes #1279)
* Removed compressBound assertions on opening bgzf files. Thanks to
Gurt Hulselmans for reporting the issue.
(#1258; fixed #1257)
* Duplicate sample name error message for a VCF file now only displays the
duplicated name rather the entire same name list.
(#1262; fixes samtools/bcftools#1451)
* Fix to make samtools cat work on CRAMs again.
(#1276; fixes samtools/samtools#1420)
* Fix for a double memory free in SAM header creation. Thanks to @ihsineme.
(#1274)
* Prevent assert in bcf_sr_set_regions. Thanks to Dr K D Murray.
(#1270)
* Fixed crash in knet_open() etc stubs. Thanks to John Marshall.
(#1289)
* Fixed filter expression "cigar" on unmapped reads. Stop treating an empty
CIGAR string as an error. Thanks to Chang Y for reporting the issue.
(#1298, fixes samtools/samtools#1445)
* Bug fixes in the bundled copy of htscodecs:
- Fixed an uninitialized access in the name tokeniser decoder.
(samtools/htscodecs#23)
- Fixed a bug with name tokeniser and variable number of names per slice,
causing it to incorrectly report an error on certain valid inputs.
(samtools/htscodecs#24)
Noteworthy changes in release 1.12 (17th March 2021)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Features and Updates
--------------------
* Added experimental CRAM 3.1 and 4.0 support. (#929)
These should not be used for long term data storage as the
specification still needs to be ratified by GA4GH and may be subject
to changes in format. (This is highly likely for 4.0). However it
may be tested using:
test/test_view -t ref.fa -C -o version=3.1 in.bam -p out31.cram
For smaller but slower files, try varying the compression profile
with an additional "-o small". Profile choices are fast, normal,
small and archive, and can be applied to all CRAM versions.
* Added a general filtering syntax for alignment records in SAM/BAM/CRAM
readers. (#1181, #1203)
An example to find chromosome spanning read-pairs with high mapping
quality: 'mqual >= 30 && mrname != rname'
To find significant sized deletions:
'cigar =~ "[0-9]{2}D"' or 'rlen - qlen > 10'.
To report duplicates that aren't part of a "proper pair":
'flag.dup && !flag.proper_pair'
More details are in the samtools.1 man page under "FILTER EXPRESSIONS".
* The knet networking code has been removed. It only supported the http
and ftp protocols, and a better and safer alternative using libcurl
has been available since release 1.3. If you need access to ftp:// and
http:// URLs, HTSlib should be built with libcurl support. (#1200)
* The old htslib/knetfile.h interfaces have been marked as deprecated. Any
code still using them should be updated to use hFILE instead. (#1200)
* Added an introspection API for checking some of the capabilities provided
by HTSlib. (#1170) Thanks also to John Marshall for contributions. (#1222)
- `hfile_list_schemes`: returns the number of schemes found
- `hfile_list_plugins`: returns the number of plugins found
- `hfile_has_plugin`: checks if a specific plugin is available
- `hts_features`: returns a bit mask with all available features
- `hts_test_feature`: test if a feature is available
- `hts_feature_string`: return a string summary of enabled features
* Made performance improvements to `probaln_glocal` method, which
speeds up mpileup BAQ calculations. (#1188)
- Caching of reused loop variables and removal of loop invariants
- Code reordering to remove instruction latency.
- Other refactoring and tidyups.
* Added a public method for constructing a BAM record from the
component pieces. Thanks to Anders Kaplan. (#1159, #1164)
* Added two public methods, `sam_parse_cigar` and `bam_parse_cigar`, as part of
a small CIGAR API (#1169, #1182). Thanks to Daniel Cameron for input. (#1147)
* HTSlib, and the included htsfile program, will now recognise the old
RAZF compressed file format. Note that while the format is detected,
HTSlib is unable to read it. It is recommended that RAZF files are
uncompressed with `gunzip` before using them with HTSlib. Thanks to
John Marshall (#1244); and Matthew J. Oldach who reported problems
with uncompressing some RAZF files (samtools/samtools#1387).