Debian Codegraph @

NEWS

raw
1 .. An online version of the release history can be found here:
2 .. http://pysam.readthedocs.io/en/latest/release.html
3
4 Release 0.23.3
5 ==============
6
7 .. rubric:: 10 June 2025
8
9 This is a bugfix release, still wrapping htslib/samtools/bcftools 1.21.
10
11 It has been tested with Python versions 3.8 through 3.13, and wheels are
12 available via PyPI_ for all of those Python versions. Wheels are built for
13 macOS and Linux (manylinux_2_28 and musllinux_1_2) on both ARM and x86-64.
14
15 The final pysam release that supported Python 3.6 and 3.7 was v0.23.0.
16
17 Bugs fixed:
18
19 * Worked around Cython 3.1.2 bug whereby a new Cython-internal function
20 incorrectly triggered the pysam build system's duplicate symbol check.
21
22
23 Release 0.23.2
24 ==============
25
26 .. rubric:: 6 June 2025
27
28 This is a bugfix release, still wrapping htslib/samtools/bcftools 1.21.
29
30 It has been tested with Python versions 3.8 through 3.13, and wheels are
31 available via PyPI_ for all of those Python versions. Wheels are built for
32 macOS and Linux (manylinux_2_28 and musllinux_1_2) on both ARM and x86-64.
33
34 Bugs fixed:
35
36 * Pysam 0.23.1 inadvertently broke binary compatibility for Cython projects
37 by changing the size of :class:`.AlignedSegment`. That class has been
38 restored to its previous size, so v0.23.2 restores binary compatibility
39 with Cython projects previously compiled against v0.23.0 and earlier.
40 (This bug does not affect pure Python projects using pysam.)
41
42 * Improved I/O exception messages in :class:`.AlignmentFile` and
43 :class:`.VariantFile`, and ensured that error codes returned by all
44 HTSlib function invocations result in an exception being raised.
45
46
47 Release 0.23.1
48 ==============
49
50 .. rubric:: 28 May 2025
51
52 This is a bugfix release, still wrapping htslib/samtools/bcftools 1.21.
53
54 It has been tested with Python versions 3.8 through 3.13, and wheels are
55 available via PyPI_ for all of those Python versions. Wheels are built for
56 macOS and Linux (manylinux_2_28 and musllinux_1_2) on both ARM and x86-64.
57
58 This release inadvertently broke binary compatibility for Cython projects.
59 This should not affect Python projects using pysam. However Cython projects
60 should update to release 0.23.2.
61
62 Bugs fixed:
63
64 * Worked around Cython 3.1.0 behaviour change so that ``pysam.CMATCH`` etc
65 remain as synonyms for ``pysam.CIGAR_OPS.CMATCH`` etc. Note that a future
66 release will remove these synonyms to comply with Cython's new convention.
67 (#1339, PR #1340, reported by Adam Taranto, Andy Bond, et al)
68
69 * The Python interpreter no longer exits abruptly on x86-64 Linux
70 when ``pysam.bcftools.*()`` commands terminate with error messages.
71 (#1333, #1335, reported by Maximilian Blacher and Ben Habermeyer)
72
73 * Fixed :meth:`.AlignedSegment.get_aligned_pairs` type hint, which now
74 has overloaded hints reflecting the different tuples returned.
75 (PR #1342, thanks to Gosuke Shibahara)
76
77 * Corrected "invalid type for record" exception message.
78 (PR #1334, thanks to Gaik Tamazian)
79
80 * Fixed :class:`.TabixIterator` error handling. (#1328, reported by @Fan-iX)
81
82 * Fixed bugs in the caching of :attr:`.AlignedSegment.query_sequence` and
83 :attr:`.AlignedSegment.query_qualities` values.
84
85 * Pysam once again builds on CentOS 7, as it now works around limitations
86 in that obsolete platform's obsolete GCC 4.8.x system compiler.
87 (#1327, reported by Mario Fasold)
88
89 New functionality:
90
91 * New :attr:`.AlignedSegment.query_qualities_str` property enables
92 accessing the QUAL field as an ASCII-encoded base quality string.
93 The existing :attr:`.AlignedSegment.query_qualities` property can
94 now take an array or such a string when setting the value.
95 (PR #1324, PR #1341, requested by Nils Homer)
96
97 * Improved :attr:`.AlignedSegment.cigarstring` performance.
98 (PR #1295, thanks to @limwz01)
99
100 * Wheels are now built for musllinux in addition to manylinux and macOS.
101 (Requested by Nils Homer)
102
103
104 Release 0.23.0
105 ==============
106
107 .. rubric:: 5 February 2025
108
109 This pysam release wraps htslib/samtools/bcftools 1.21 (PR #1310).
110
111 It has been tested with Python versions 3.6 through 3.13, and wheels are
112 available via PyPI_ for all of those Python versions. Python versions 3.6
113 through 3.8 are end-of-life; particularly if you use pysam with one of
114 these versions, please vote in the version survey at issue #1230.
115
116 This is expected to be the last release supporting Python 3.6 and 3.7.
117
118 Bugs fixed:
119
120 * Fix :func:`pysam.samtools.command(save_stdout=filename) <.samtools.command>`
121 redirection of output to a file. (#677, reported by Haowen Zhang and analysed
122 by Youri Hoogstrate)
123
124 * Reinstate HTTPS/S3/GCS support in pre-built Linux wheels when used on Debian
125 and Ubuntu: these wheels now work around the discrepancy between Red Hat and
126 Debian CA Certificate file locations. (#1257, #1268, reported by Daisie Huang
127 and Li Tai Fang)
128
129 * Calling :meth:`.VariantHeader.new_record` repeatedly with the same
130 :obj:`samples` object now sets GT correctly every time. (#1308, reported
131 by Arthur Gymer)
132
133 * Correct the exception produced when :meth:`.AlignedSegment.set_tags` is
134 used with an invalid value type. (#1233, PR #1235, reported by Weisheng Wu
135 and Marcus Stoiber)
136
137 * Many type hinting corrections. (#1298, #1316, PR #1296, PR #1306, PR #1313,
138 PR #1315, thanks to Victor Epain, Arthur Gymer, @mshunjan, and Matt Stone)
139
140 * The undocumented :func:`!pysam.samtools.import_` alias for invoking
141 ``samtools import`` has been removed;
142 use :func:`pysam.samtools.fqimport() <.samtools.command>` instead.
143
144 * Corrections to several test data files to account for HTSlib 1.20 and later's
145 improved validity checking. (#1291, reported by David Seifert; etc)
146
147 New functionality:
148
149 * :meth:`.AlignedSegment.get_aligned_pairs` now optionally returns the
150 associated CIGAR operator in each position tuple. (#1292, PR #1294,
151 thanks to Lara Fuhrmann and Ivan Blagoev Topolsky)
152
153 * New :meth:`AlignmentFile.flush() <.HTSFile.flush>` and
154 :meth:`VariantFile.flush() <.HTSFile.flush>` methods for flushing buffered
155 output to streams. (#1299, requested by @blex-max)
156
157 * Improved :class:`str() <str>` for :class:`.AlignedSegment` now displays
158 reference sequence names when they are available and uses ``#N`` only when
159 necessary. (#1318, requested by Liu)
160
161 * Implement :func:`repr` for :class:`.AlignedSegment` so that it displays the
162 most useful fields. (PR #1267, thanks to Marcel Martin)
163
164 * Pysam's tests can now run in parallel. (#1284, reported by Yuri Victorovich)
165
166 Documentation improvements:
167
168 * More complete documentation of invoking SAMtools and BCFtools subcommands
169 via Pysam. (#1096, #1241, PR #1261, PR #1275, #1323, et al, reported by
170 Seung-been "Steven" Lee, Robert Baldwin, Michael Hall, Indraniel Das,
171 and @shokrofont)
172
173 * Use the Pysam names for CIGAR operators rather than internal C names.
174 (#1255, reported by Ilya Shlyakhter)
175
176 * Mention :meth:`AlignmentFile.fetch("*") <.AlignmentFile.fetch>` in the
177 FAQ entry on fetching unmapped reads. (#424, reported by Ben Weisburd)
178
179
180 Release 0.22.1
181 ==============
182
183 .. rubric:: 24 April 2024
184
185 Bugfix release, which still wraps htslib/samtools/bcftools 1.18.
186
187 Bugs fixed:
188
189 * Preserve all header field tags defined in the SAM specification (notably TP)
190 in :meth:`.AlignmentHeader.from_dict` and :meth:`.AlignmentHeader.to_dict`.
191 (#1237, PR #1238, thanks to Tim Fennell and Nils Homer)
192
193 * Adjust HTSlib's Makefile so that ``make distclean`` no longer tries to
194 rebuild the htscodecs configury. (PR #1247, reported by Nicola Soranzo)
195
196 * Reinstate S3 support in pre-built Linux wheels: support for this protocol
197 was inadvertently omitted from the pre-built 0.22.0 wheels on Linux.
198 (#1249, #1277, etc varying circumstances; likely it is this that was
199 reported by Mathew Baines, Benjamin Sargsyan, et al)
200
201 * Add missing :attr:`.AlignedSegment.is_mapped` etc properties to type stubs.
202 (PR #1273, thanks to Matt Stone)
203
204 * Fix off-by-one NamedTupleProxy, :class:`.asBed`, etc array bounds check.
205 (#1279, reported by Dan Bolser)
206
207 * Make pysam's klib headers compatible with C++. (reported by Martin Grigorov)
208
209
210 Release 0.22.0
211 ==============
212
213 .. rubric:: 5 October 2023
214
215 This pysam release wraps htslib/samtools/bcftools 1.18 (PR #1208).
216
217 It has been tested with Python versions 3.6 through 3.12, and wheels are
218 available via PyPI_ for all of those Python versions. Python versions 3.6
219 and 3.7 are end-of-life; particularly if you use pysam with either of
220 these versions, please vote in the version survey at issue #1230.
221
222 The final pysam release that supported Python 2.7 was v0.20.0.
223
224 Bugs fixed:
225
226 * Remove Cython from runtime dependencies. (PR #1186, thanks to Nicola Soranzo,
227 also reported by Arya Massarat in PR #1194)
228
229 * Miscellaneous dependency improvements. (PR #1216, #1217, PR #1218, PR #1219,
230 thanks to Martin Larralde and Arthur Vigil)
231
232 * Suppress spurious "Could not retrieve index file" message when opening an
233 AlignmentFile. (#939, #1214, reported by ChengYong Tham and Sebastian Röner)
234
235 * Propagate SAM parsing errors encounted in :meth:`.AlignedSegment.fromstring`.
236 (#1196, reported by DV Klopfenstein)
237
238 * Accept invalid MD:A tagged fields produced by HTSeq instead of crashing
239 in :meth:`AlignedSegment.get_aligned_pairs(with_seq=True)
240 <.AlignedSegment.get_aligned_pairs>`. (#1226, reported by Isaac Vock)
241
242 * Fix multiarch macOS CI builds by removing brewed liblzma. (#1205, reported
243 by Till Hartmann)
244
245 * Fix :attr:`.VariantRecordSample.alleles` type hint. (#1179, reported by
246 David Seifert)
247
248 New functionality:
249
250 * Add optional :meth:`HTSFile.seek(..., whence) <.HTSFile.seek>` parameter
251 and clarify which functions use libc.SEEK_SET vs io.SEEK_SET.
252 (#1185, requested by luyulin)
253
254 * File handling improvements in samtools & bcftools commands. (should improve
255 #1193 and #1195, reported by Rob Bierman and Sam Chorlton)
256
257 * Improve :class:`.FastxFile` performance. (PR #1227, thanks to Fabian Klötzl
258 and Valentyn Bezshapkin)
259
260 * Improve the accuracy of type hints for :class:`.AlignmentFile` iteration.
261 (#1184, PR #1189, reported by @PikalaxALT)
262
263 Documentation improvements:
264
265 * Clarify that :meth:`.AlignedSegment.get_aligned_pairs` results are 0-based.
266 (#1180, reported by Nick Semenkovich)
267
268 * Clarify :meth:`.AlignedSegment.get_reference_positions` documentation.
269 (#836, #838, reported by Liang Ou and Nick Stoler)
270
271 * Clarify that installation via pip usually uses a wheel, and that configuring
272 the build via $HTSLIB_CONFIGURE_OPTIONS etc only applies when installing from
273 an sdist. (#1086, reported by Layne Sadler)
274
275 A message from pysam's founder, Andreas Heger:
276
277 As many of you will have noticed, John Marshall has been effectively
278 maintaining pysam and supporting users over the last few years.
279 I, Andreas, am very grateful for the countless hours he has contributed.
280 Unfortunately, I will not be able to contribute much in the near and
281 intermediate future. To keep pysam going, John has kindly agreed to
282 continue maintaining and supporting pysam as the principal developer
283 of pysam. I am very happy to know that pysam is in good hands and want
284 to thank again John and the wider pysam community for their suggestions,
285 bug reports, code contributions and general support.
286
287 Thank you Andreas for all your work over the years and the solid foundations
288 that pysam enjoys and the useful functionality it provides.
289
290
291 Release 0.21.0
292 ==============
293
294 .. rubric:: 2 April 2023
295
296 This release wraps htslib/samtools/bcftools version 1.17.
297
298 Pysam is now compatible with Python 3.11. We have removed Python 2.x
299 support. Pysam is tested with Python versions 3.6 to 3.11.
300
301 * [#1175] VariantHeader.new_record: set start/stop before alleles
302 * [#1173] Add multiple build improvements in htscodecs on multi-arch macOS
303 * [#1148] Ignore CIGAR-less reads in find_introns.
304 * [#1172] Add new `samtools cram-size` and `samtools reset` commands
305 * [#1169] Fix CRAM index-related crash when using the musl C standard library.
306 * [#1168] Add a minimal pyproject.toml for PEP517.
307 * [#1158] Fix type hints and add FastqProxy type hints.
308 * [#1147] Py3.11 compatibility, get shared object suffix from EXT_SUFFIX.
309 * [#1143] Add mypy symbols for samtools and bcftools.
310 * [#1155] Fix pysam.index() when using recent `samtools index` options.
311 * [#1151] Test suite py3.11 compatibility, work around failing test case.
312 * [#1149] MacOS universal build compatibility.
313 * [#1146] Fix build when CFLAGS/etc environment variables are set.
314
315
316 Release 0.20.0
317 ==============
318
319 .. rubric:: 29 October 2022
320
321 This release wraps htslib/bcftools version 1.16 and samtools version 1.16.1.
322
323 * [#1113] Full compatibility with setuptools v62.1.0's build directory name changes
324 * [#1121] Build-time symbol check portability improved
325 * [#1122] Fix setting sample genotype using .alleles property
326 * [#1128] Fix test suite failure when using a libdeflate-enabled samtools
327
328 Many additional type hints have been provided by the community,
329 thanks!
330
331
332 Release 0.19.1
333 ==============
334
335 .. rubric:: 27 May 2022
336
337 This release wraps htslib/samtools/bcftools version 1.15.1.
338
339 * [#1104] add an add_samples() method to quickly add multiple samples
340 to VCF.
341
342
343 Release 0.19.0
344 ==============
345
346 .. rubric:: 30 March 2022
347
348 This release wraps htslib/samtools/bcftools version 1.15.
349
350 * [#1085] Improve getopt()/getopt_long() resetting when running samtools/bcftools commands
351
352 * [#1078] Support BAM_CPAD in get_aligned_pairs
353
354 * [#1063] Run flake8 and fix some linting issues
355
356 * [#1088] Add AlignedSegment is_mapped/mate_is_mapped/is_forward/mate_is_forward properties
357
358 * Write an absent AlignedSegment.qual as all-bytes-0xff
359
360 * Fix BGZFile.read() behaviour near or at EOF
361
362 * First API for the htslib modified bases interface
363
364
365 Release 0.18.0
366 ==============
367
368 .. rubric:: 17 November 2021
369
370 This release wraps htslib/samtools/bcftools version 1.14.
371
372 * [#1048] and [#1060], clarify documentation of index statistics with CRAM files
373 * Prevent "retval may be used uninitialised" warning.
374 * Add new "samples" subcommand to pysam/samtools.py
375 * Introduce TupleProxyIterator iterator object class
376
377
378 Release 0.17.0
379 ==============
380
381 .. rubric:: 30 September 2021
382
383 This release wraps htslib/samtools/bcftools version 1.13. Corresponding
384 to new samtools commands, `pysam.samtools` now has additional functions
385 `ampliconclip`, `ampliconstats`, `fqimport`, and `version`.
386
387 Bugs fixed:
388
389 * [#447] The maximum QNAME length is fully restored to 254
390 * [#506, #958, #1000] Don't crash the Python interpreter on ``pysam.bcftools.*()`` errors
391 * [#603] count_coverage: ignore reads that have no SEQ field
392 * [#928] Fix ``pysam.bcftools.mpileup()`` segmentation fault
393 * [#983] Add win32/\*.[ch] to MANIFEST.in
394 * [#994] Raise exception in ``get_tid()`` if header could not be parsed
395 * [#995] Choose TBI/CSI in ``tabix_index()`` via both min_shift and csi
396 * [#996] ``AlignmentFile.fetch()`` now works with large chromosomes longer than 2\ :sup:`29` bases
397 * [#1019] Fix Sphinx documentation generation by avoiding Python 2 ``ur'string'`` syntax
398 * [#1035] Improved handling of file iteration errors
399 * [#1038] ``tabix_index()`` no longer leaks file descriptors
400 * [#1040] ``print(aligned_segment)`` now prints the correct TLEN value
401 (it also now prints RNAME/RNEXT more clearly and prints POS/PNEXT 1-based)
402 * *setup.py* longer uses ``setup(use_2to3)`` for compatibility with setuptools >= v58.0.0
403
404 New facilities:
405
406 * [PR #963] Additional VCF classes are exposed to pysam programmers
407 * [#998, PR #1001] Add ``get/set_encoding_error_handler()`` to control UTF-8 conversion
408 * [PR #1012] Running ``python setup.py sdist`` now automatically runs cythonize
409 * Running tests with ``pytest`` now automatically runs ``make`` to generate test data
410
411 Documentation improvements:
412
413 * [#726] Clarify get_forward_sequence/get_forward_qualities documentation
414 * [#865] Improved example
415 * [#968] ``get_index_statstics`` parameters
416 * [#986] Clarify ``VariantFile.fetch`` start/stop region parameters are 0-based and half-open.
417 * [#990] Corrected ``PileupColumn.get_query_sequences`` documentation
418 * [#999] Fix documentation for ``AlignmentFile.get_reference_length()``
419 * [#1002] Document the default min_base_quality for ``pileup()``
420
421
422 Release 0.16.0
423 ==============
424
425 .. rubric:: 8 June 2020
426
427 This release wraps htslib/bcftools version 1.10.2 and samtools version
428 1.10. The following bugs reported against pysam are fixed due to this:
429
430 * [#447] Writing out QNAME longer than 251 characters corrupts BAM
431 * [#640, #734, #843] Setting VariantRecord pos or stop raises error
432 * [#738, #919] FastxFile truncates concatenated plain gzip compressed files
433
434 Additional bugfixes:
435
436 * [#840] Pileup doesn't work on python3 when `index_filename` is used
437 * [#886] FastqProxy raises ValueError when instantiated from python
438 * [#904] VariantFile.fetch() throws ValueError on files with no records
439 * [#909] Fix incorrect quoting in VariantFile contig records
440 * [#915, #916] Implement pileup() for unindexed files and/or SAM files
441
442 Backwards incompatible changes:
443
444 * The `samtools import` command was removed in samtools 1.10, so pysam
445 no longer exports a `samimport` function. Use `pysam.view()` instead.
446
447
448 Release 0.15.4
449 ==============
450
451 Bugfix release. Principal reason for release is to update cython
452 version in order to fix pip install pysam with python 3.8.
453
454 * [#879] Fix add_meta function in libcbcf.pyx, so meta-information
455 lines in header added with this function have double-quoting rules
456 in accordance to rules specified in VCF4.2 and VCF4.3 specifications
457 * [#863] Force arg to bytes to support non-ASCII encoding
458 * [#875] Bump minimum Cython version
459 * [#868] Prevent segfault on Python 2.7 AlignedSegment.compare(other=None)
460 * [#867] Fix wheel building on TravisCI
461 * [#863] Force arg to bytes to support non-ASCII encoding
462 * [#799] disambiguate interpretation of bcf_read return code
463 * [#841] Fix silent truncation of FASTQ with bad q strings
464 * [#846] Prevent segmentation fault on ID, when handling malformed records
465 * [#829] Run configure with the correct CC/CFLAGS/LDFLAGS env vars
466
467
468 Release 0.15.3
469 ==============
470
471 Bugfix release.
472
473 * [#824] allow reading of UTF-8 encoded text in VCF/BCF files.
474 * [#780] close all filehandles before opening new ones in pysam_dispatch
475 * [#773] do not cache VariantRecord.id to avoid memory leak
476 * [#781] default of multiple_iterators=True is changed to False for
477 CRAM files.
478 * [#825] fix collections.abc import
479 * [#825] use bcf_hdr_format instead of bcf_hdr_fmt_text, fix memcpy
480 bug when setting FORMAT fields.
481 * [#804] Use HTSlib's kstring_t, which reallocates and enlarges its
482 memory as needed, rather than a fixed-size char buffer.
483 * [#814] Build wheels and upload them to PyPI
484 * [#755] Allow passing flags and arguments to index methods
485 * [#763] Strip \0 in header check
486 * [#761] Test Tabix index contents, not the compression
487
488 Release 0.15.2
489 ==============
490
491 Bugfix release.
492
493 * [#746] catch pileup itorator out-of-scope segfaults
494 * [#747] fix faixd fetch with region
495 * [#748] increase max_pos to (1<<31)-1
496 * [#645] Add missing macOS stub files in `MANIFEST.in`, @SoapZA
497 * [#737] Fix bug in get_aligned_pairs, @bkohrn
498
499 Release 0.15.1
500 ==============
501
502 Bugfix release.
503
504 * [#716] raise ValueError if tid is out of range when writing
505 * [#697] release version using cython 0.28.5 for python 3.7
506 compatibility
507
508 Release 0.15.0
509 ==============
510
511 This release wraps htslib/samtools/bcftools version 1.9.
512
513 * [#673] permit dash in chromosome name of region string
514 * [#656] Support `text` when opening a SAM file for writing
515 * [#658] return None in get_forward_sequence if sequence not in record
516 * [#683] allow lower case bases in MD tags
517 * Ensure that = and X CIGAR ops are treated the same as M
518
519 Release 0.14.1
520 ==============
521
522 This is mostly a bugfix release, though bcftools has now also been
523 upgraded to 1.7.0.
524
525 * [#621] Add a warning to count_coverage when an alignment has an
526 empty QUAL field
527 * [#635] Speed-up of AlignedSegment.find_intro()
528 * treat border case of all bases in pileup column below quality score
529 * [#634] Fix access to pileup reference_sequence
530
531
532 Release 0.14.0
533 ==============
534
535 This release wraps htslib/samtools versions 1.7.0.
536
537 * SAM/BAM/CRAM headers are now managed by a separate AlignmentHeader
538 class.
539 * AlignmentFile.header.as_dict() returns an ordered dictionary.
540 * Use "stop" instead of "end" to ensure consistency to
541 VariantFile. The end designations have been kept for backwards
542 compatibility.
543
544 * [#611] and [#293] CRAM repeated fetch now works, each iterator
545 reloads index if multiple_iterators=True
546 * [#608] pysam now wraps htslib 1.7 and samtools 1.7.
547 * [#580] reference_name and next_reference_name can now be set to "*"
548 (will be converted to None to indicate an unmapped location)
549 * [#302] providing no coordinate to count_coverage will not count from
550 start/end of contig.
551 * [#325] @SQ records will be automatically added to header if they are
552 absent from text section of header.
553 * [#529] add get_forward_sequence() and get_forward_qualities()
554 methods
555 * [#577] add from_string() and to_dict()/from_dict() methods to
556 AlignedSegment. Rename tostring() to to_string() throughout for
557 consistency
558 * [#589] return None from build_alignment_sequence if no MD tag is set
559 * [#528] add PileupColumn.__len__ method
560
561 Backwards incompatible changes:
562
563 * AlignmentFile.header now returns an AlignmentHeader object. Use
564 AlignmentFile.header.to_dict() to get the dictionary as
565 previously. Most dictionary accessor methods (keys(), values(),
566 __getitem__, ...) have been implemented to ensure some level of
567 backwards compatibility when only reading.
568
569 The rationale for this change is to have consistency between
570 AlignmentFile and VariantFile.
571
572 * AlignmentFile and FastaFile now raise IOError instead of OSError
573
574 Medium term we plan to have a 1.0 release. The pysam
575 interface has grown over the years and the API is cluttered with
576 deprecated names (Samfile, getrname(), gettid(), ...). To work towards
577 this, the next release (0.15.0) will yield DeprecationWarnings
578 for any parts of the API that are considered obsolete and will not be
579 in 1.0. Once 1.0 has been reached, we will use semantic versioning.
580
581 Release 0.13.0
582 ===============
583
584 This release wraps htslib/samtools/bcftools versions 1.6.0 and
585 contains a series of bugfixes.
586
587 * [#544] reading header from remote TabixFiles now works.
588 * [#531] add missing tag types H and A. A python float will now be
589 added as 'f' type instead of 'd' type.
590 * [#543] use FastaFile instead of Fastafile in pileup.
591 * [#546] set is_modified flag in setAttribute so updated attributes
592 are output.
593 * [#537] allow tabix index files to be created in a custom location.
594 * [#530] add get_index_statistics() method
595
596
597 Release 0.12.0.1
598 ================
599
600 Bugfix release to solve compilation issue due to missinge
601 bcftools/config.h file.
602
603 Release 0.12.0
604 ==============
605
606 This release wraps htslib/samtools/bcftools versions 1.5.0 and
607 contains a series of bugfixes.
608
609 * [#473] A new FastxRecord class that can be instantiated from class and
610 modified in-place. Replaces PersistentFastqProxy.
611 * [#521] In AligmentFile, Simplify file detection logic and allow remote index files
612
613 * Removed attempts to guess data and index file names; this is magic left
614 to htslib.
615 * Removed file existence check prior to opening files with htslib
616 * Better error checking after opening files that raise the appropriate
617 error (IOError for when errno is set, ValueError otherwise for backward
618 compatibility).
619 * Report IO errors when loading an index by name.
620 * Allow remote indices (tested using S3 signed URLs).
621 * Document filepath_index and make it an alias for index_filename.
622 * Added a require_index parameter to AlignmentFile
623
624 * [#526] handle unset ref when creating new records
625 * [#513] fix bcf_translate to skip deleted FORMAT fields to avoid
626 segfaults
627 * [#516] expose IO errors via IOError exceptions
628 * [#487] add tabix line_skip, remove 'pileup' preset
629 * add FastxRecord, replaces PersistentFastqProxy (still present for
630 backwards compatibility)
631 * [#496] upgrade to htslib/samtools/bcftools versions 1.5
632 * add start/stop to AlignmentFile.fetch() to be consistent with
633 VariantFile.fetch(). "end" is kept for backwards compatibility.
634 * [#512] add get_index_statistics() method to AlignmentFile.
635
636 Upcoming changes:
637
638 In the next release we are plannig to separate the header information
639 from AlignmentFile into a separate class AlignmentHeader. This layout
640 is similar to VariantFile/VariantHeader. With this change we will
641 ensure that an AlignedSegment record will be linked to a header so
642 that chromosome names can be automatically translated from the numeric
643 representation. As a consequence, the way new AlignedSegment records
644 are created will need to change as the constructor requires a header::
645
646 header = pysam.AlignmentHeader(
647 reference_names=["chr1", "chr2"],
648 reference_lengths=[1000, 1000])
649
650 read = pysam.AlignedSegment(header)
651
652 This will affect all code that instantiates AlignedSegment objects
653 directly. We have not yet merged to allow users to provide feed-back.
654 The pull-request is here: https://github.com/pysam-developers/pysam/pull/518
655 Please comment on github.
656
657 Release 0.11.2.2
658 ================
659
660 Bugfix release to address two issues:
661
662 * Changes in 0.11.2.1 broke the GTF/GFF3 parser. Corrected and
663 more tests have been added.
664 * [#479] Correct VariantRecord edge cases described in issue
665
666 Release 0.11.2.1
667 ================
668
669 Release to fix release tar-ball containing 0.11.1 pre-compiled
670 C-files.
671
672 Release 0.11.2
673 ==============
674
675 This release wraps htslib/samtools/bcfools versions 1.4.1 in response
676 to a security fix in these libraries. Additionally the following
677 issues have been fixed:
678
679 * [#452] add GFF3 support for tabix parsers
680 * [#461] Multiple fixes related to VariantRecordInfo and handling of INFO/END
681 * [#447] limit query name to 251 characters (only partially addresses issue)
682
683 VariantFile and related object fixes
684
685 * Restore VariantFile.\_\_dealloc\_\_
686 * Correct handling of bcf_str_missing in bcf_array_to_object and
687 bcf_object_to_array
688 * Added update() and pop() methods to some dict-like proxy objects
689 * scalar INFO entries could not be set again after being deleted
690 * VariantRecordInfo.__delitem__ now allows unset flags to be deleted without
691 raising a KeyError
692 * Multiple other fixes for VariantRecordInfo methods
693 * INFO/END is now accessible only via VariantRecord.stop and
694 VariantRecord.rlen. Even if present behind the scenes, it is no longer
695 accessible via VariantRecordInfo.
696 * Add argument to issue a warning instead of an exception if input appears
697 to be truncated
698
699 Other features and fixes:
700
701 * Make AlignmentFile \_\_dealloc\_\_ and close more
702 stringent
703 * Add argument AlignmentFile to issue a warning instead of an
704 exception if input appears to be truncated
705
706 Release 0.11.1
707 ==============
708
709 Bugfix release
710
711 * [#440] add deprecated 'always' option to infer_query_length for backwards compatibility.
712
713 Release 0.11.0
714 ==============
715
716 This release wraps the latest versions of htslib/samtools/bcftools and
717 implements a few bugfixes.
718
719 * [#413] Wrap HTSlib/Samtools/BCFtools 1.4
720 * [#422] Fix missing pysam.sort.usage() message
721 * [#411] Fix BGZfile initialization bug
722 * [#412] Add seek support for BGZFile
723 * [#395] Make BGZfile iterable
724 * [#433] Correct getQueryEnd
725 * [#419] Export SAM enums such as pysam.CMATCH
726 * [#415] Fix access by tid in AlignmentFile.fetch()
727 * [#405] Writing SAM now outputs a header by default.
728 * [#332] split infer_query_length(always) into infer_query_length and infer_read_length
729
730 Release 0.10.0
731 ==============
732
733 This release implements further functionality in the VariantFile API
734 and includes several bugfixes:
735
736 * treat special case -c option in samtools view outputs to stdout even
737 if -o given, fixes #315
738 * permit reading BAM files with CSI index, closes #370
739 * raise Error if query name exceeds maximum length, fixes #373
740 * new method to compute hash value for AlignedSegment
741 * AlignmentFile, VariantFile and TabixFile all inherit from HTSFile
742 * Avoid segfault by detecting out of range reference_id and
743 next_reference in AlignedSegment.tostring
744 * Issue #355: Implement streams using file descriptors for VariantFile
745 * upgrade to htslib 1.3.2
746 * fix compilation with musl libc
747 * Issue #316, #360: Rename all Cython modules to have lib as a prefix
748 * Issue #332, hardclipped bases in cigar included by
749 pysam.AlignedSegment.infer_query_length()
750 * Added support for Python 3.6 filename encoding protocol
751 * Issue #371, fix incorrect parsing of scalar INFO and FORMAT fields in VariantRecord
752 * Issue #331, fix failure in VariantFile.reset() method
753 * Issue #314, add VariantHeader.new_record(), VariantFile.new_record() and
754 VariantRecord.copy() methods to create new VariantRecord objects
755 * Added VariantRecordFilter.add() method to allow setting new VariantRecord filters
756 * Preliminary (potentially unsafe) support for removing and altering header metadata
757 * Many minor fixes and improvements to VariantFile and related objects
758
759 Please note that all internal cython extensions now have a lib prefix
760 to facilitate linking against pysam extension modules. Any user cython
761 extensions using cimport to import pysam definitions will need
762 changes, for example::
763
764 cimport pysam.csamtools
765
766 will become::
767
768 cimport pysam.libcsamtools
769
770 Release 0.9.1
771 =============
772
773 This is a bugfix release addressing some installation problems
774 in pysam 0.9.0, in particular:
775
776 * patch included htslib to work with older libcurl versions, fixes #262.
777 * do not require cython for python 3 install, fixes #260
778 * FastaFile does not accept filepath_index any more, see #270
779 * add AlignedSegment.get_cigar_stats method.
780 * py3 bugfix in VariantFile.subset_samples, fixes #272
781 * add missing sysconfig import, fixes #278
782 * do not redirect stdout, but instead write to a separately
783 created file. This should resolve issues when pysam is used
784 in notebooks or other environments that redirect stdout.
785 * wrap htslib-1.3.1, samtools-1.3.1 and bcftools-1.3.1
786 * use bgzf throughout instead of gzip
787 * allow specifying a fasta reference for CRAM file when opening
788 for both read and write, fixes #280
789
790 Release 0.9.0
791 =============
792
793 Overview
794 --------
795
796 The 0.9.0 release upgrades htslib to htslib 1.3 and numerous other
797 enhancements and bugfixes. See below for a detailed list.
798
799 The `Htslib 1.3 <https://github.com/samtools/htslib/releases/tag/1.3>`_
800 release comes with additional capabilities for remote file access which
801 depend on the presence of optional system libraries. As a consequence,
802 the installation script :file:`setup.py` has become more complex. For
803 an overview, see :ref:`installation`. We have tested installation on
804 linux and OS X, but could not capture all variations. It is possible
805 that a 0.9.1 release might follow soon addressing installation issues.
806
807 The :py:class:`~.pysam.VariantFile` class provides access to
808 :term:`vcf` and :term:`bcf` formatted files. The class is certainly
809 usable and interface is reaching completion, but the API and the
810 functionality is subject to change.
811
812 Detailed release notes
813 ----------------------
814
815 * upgrade to htslib 1.3
816 * python 3 compatibility tested throughout.
817 * added a first set of bcftools commands in the pysam.bcftools
818 submodule.
819 * samtools commands are now in the pysam.samtools module. For
820 backwards compatibility they are still imported into the pysam
821 namespace.
822 * samtools/bcftools return stdout as a single (byte) string. As output
823 can be binary (VCF.gz, BAM) this is necessary to ensure py2/py3
824 compatibility. To replicate the previous behaviour in py2.7, use::
825
826 pysam.samtools.view(self.filename).splitlines(True)
827
828 * get_tags() returns the tag type as a character, not an integer (#214)
829 * TabixFile now raises ValueError on indices created by tabix <1.0 (#206)
830 * improve OSX installation and develop mode
831 * FastxIterator now handles empty sequences (#204)
832 * TabixFile.isremote is not TabixFile.is_remote in line with AlignmentFile
833 * AlignmentFile.count() has extra optional argument read_callback
834 * setup.py has been changed to:
835 * install a single builtin htslib library. Previously, each pysam
836 module contained its own version. This reduces compilation time
837 and code bloat.
838 * run configure for the builtin htslib library in order to detect
839 optional libraries such as libcurl. Configure behaviour can be
840 controlled by setting the environment variable
841 HTSLIB_CONFIGURE_OPTIONS.
842 * get_reference_sequence() now returns the reference sequence and not
843 something looking like it. This bug had effects on
844 get_aligned_pairs(with_seq=True), see #225. If you have relied on on
845 get_aligned_pairs(with_seq=True) in pysam-0.8.4, please check your
846 results.
847 * improved autodetection of file formats in AlignmentFile and VariantFile.
848
849 Release 0.8.4
850 =============
851
852 This release contains numerous bugfixes and a first implementation of
853 a pythonic interface to VCF/BCF files. Note that this code is still
854 incomplete and preliminary, but does offer a nearly complete immutable
855 Pythonic interface to VCF/BCF metadata and data with reading and
856 writing capability.
857
858 Potential isses when upgrading from v0.8.3:
859
860 * binary tags are now returned as python arrays
861
862 * renamed several methods for pep8 compatibility, old names still retained for
863 backwards compatibility, but should be considered deprecated.
864
865 * gettid() is now get_tid()
866 * getrname() is now get_reference_name()
867 * parseRegion() is now parse_region()
868
869 * some methods have changed for pep8 compatibility without the old
870 names being present:
871
872 * fromQualityString() is now qualitystring_to_array()
873 * toQualityString() is now qualities_to_qualitystring()
874
875 * faidx now returns strings and not binary strings in py3.
876
877 * The cython components have been broken up into smaller files with
878 more specific content. This will affect users using the cython
879 interfaces.
880
881 Edited list of commit log changes:
882
883 * fixes AlignmentFile.check_index to return True
884 * add RG/PM header tag - closes #179
885 * add with_seq option to get_aligned_pairs
886 * use char * inside reconsituteReferenceSequence
887 * add soft clipping for get_reference_sequence
888 * add get_reference_sequence
889 * queryEnd now computes length from cigar string if no sequence present, closes #176
890 * tolerate missing space at end of gtf files, closes #162
891 * do not raise Error when receiving output on stderr
892 * add docu about fetching without index, closes #170
893 * FastaFile and FastxFile now return strings in python3, closes #173
894 * py3 compat: relative -> absolute imports.
895 * add reference_name and next_reference_name attributes to AlignedSegment
896 * add function signatures to cvcf cython. Added note about other VCF code.
897 * add context manager functions to FastaFile
898 * add reference_name and next_reference_name attributes to AlignedSegment
899 * PileupColumn also gets a reference_name attribute.
900 * add context manager functions to FastaFile
901 * TabixFile.header for remote files raises AttributeError, fixes #157
902 * add context manager interface to TabixFile, closes #165
903 * change ctypedef enum to typedef enum for cython 0.23
904 * add function signatures to cvcf cython, also added note about other VCF code
905 * remove exception for custom upper-case header record tags.
906 * rename VALID_HEADER_FIELDS to KNOWN_HEADER_FIELDS
907 * fix header record tag parsing for custom tags.
908 * use cython.str in count_coverage, fixes #141
909 * avoid maketrans (issues with python3)
910 * refactoring: AlignedSegment now in separate module
911 * do not execute remote tests if URL not available
912 * fix the unmapped count, incl reads with no SQ group
913 * add raw output to tags
914 * added write access for binary tags
915 * bugfix in call to resize
916 * implemented writing of binary tags from arrays
917 * implemented convert_binary_tag to use arrays
918 * add special cases for reads that are unmapped or whose mates are unmapped.
919 * rename TabProxies to ctabixproxies
920 * remove underscores from utility functions
921 * move utility methods into cutils
922 * remove callback argument to fetch - closes #128
923 * avoid calling close in dealloc
924 * add unit tests for File object opening
925 * change AlignmentFile.open to filepath_or_object
926 * implement copy.copy, close #65
927 * add chaching of array attributes in AlignedSegment, closes #121
928 * add export of Fastafile
929 * remove superfluous pysam_dispatch
930 * use persist option in FastqFile
931 * get_tag: expose tag type if requested with `with_value_type`
932 * fix to allow reading vcf record info via tabix-based vcf reader
933 * add pFastqProxy and pFastqFile objects to make it possible to work with multiple fastq records per file handle, unlike FastqProxy/FastqFile.
934 * release GIL around htslib IO operations
935 * More work on read/write support, API improvements
936 * add `phased` property on `VariantRecordSample`
937 * add mutable properties to VariantRecord
938 * BCF fixes and start of read/write support
939 * VariantHeaderRecord objects now act like mappings for attributes.
940 * add VariantHeader.alts dict from alt ID->Record.
941 * Bug fix to strong representation of structured header records.
942 * VariantHeader is now mutable
943
944
945 Release 0.8.3
946 =============
947
948 * samtools command now accept the "catch_stdout" option.
949
950 * get_aligned_pairs now works for soft-clipped reads.
951
952 * query_position is now None when a PileupRead is not aligned
953 to a particular position.
954
955 * AlignedSegments are now comparable and hashable.
956
957 Release 0.8.2.1
958 ===============
959
960 * Installation bugfix release.
961
962 Release 0.8.2
963 =============
964
965 * Pysam now wraps htslib 1.2.1 and samtools version 1.2.
966
967 * Added CRAM file support to pysam.
968
969 * New alignment info interface.
970 * opt() and setTag are deprecated, use get_tag() and set_tag()
971 instead.
972 * added has_tag()
973 * tags is deprecated, use get_tags() and set_tags() instead.
974
975 * FastqFile is now FastxFile to reflect that the latter permits
976 iteration over both fastq- and fasta-formatted files.
977
978 * A Cython wrapper for htslib VCF/BCF reader/writer. The wrapper
979 provides a nearly complete Pythonic interface to VCF/BCF metadata
980 with reading and writing capability. However, the interface is still
981 incomplete and preliminary and lacks capability to mutate the
982 resulting data.
983
984 Release 0.8.1
985 =============
986
987 * Pysam now wraps htslib and samtools versions 1.1.
988
989 * Bugfixes, most notable:
990
991 * issue #43: uncompressed BAM output
992 * issue #42: skip tests requiring network if none available
993 * issue #19: multiple iterators can now be made to work on the same tabix file
994 * issue #24: All strings returned from/passed to the pysam API are now unicode in python 3
995 * issue #5: type guessing for lists of integers fixed
996
997 * API changes for consistency. The old API is still present,
998 but deprecated.
999 In particular:
1000
1001 * Tabixfile -> TabixFile
1002 * Fastafile -> FastaFile
1003 * Fastqfile -> FastqFile
1004 * Samfile -> AlignmentFile
1005 * AlignedRead -> AlignedSegment
1006 * qname -> query_name
1007 * tid -> reference_id
1008 * pos -> reference_start
1009 * mapq -> mapping_quality
1010 * rnext -> next_reference_id
1011 * pnext -> next_reference_start
1012 * cigar -> cigartuples
1013 * cigarstring -> cigarstring
1014 * tlen -> template_length
1015 * seq -> query_sequence
1016 * qual -> query_qualities, now returns array
1017 * qqual -> query_alignment_qualities, now returns array
1018 * tags -> tags
1019 * alen -> reference_length, reference is always "alignment", so removed
1020 * aend -> reference_end
1021 * rlen -> query_length
1022 * query -> query_alignment_sequence
1023 * qstart -> query_alignment_start
1024 * qend -> query_alignment_end
1025 * qlen -> query_alignment_length
1026 * mrnm -> next_reference_id
1027 * mpos -> next_reference_start
1028 * rname -> reference_id
1029 * isize -> template_length
1030 * blocks -> get_blocks()
1031 * aligned_pairs -> get_aligned_pairs()
1032 * inferred_length -> infer_query_length()
1033 * positions -> get_reference_positions()
1034 * overlap() -> get_overlap()
1035
1036 * All strings are now passed to or received from the pysam API
1037 as strings, no more bytes.
1038
1039 Other changes:
1040 * AlignmentFile.fetch(reopen) option is now multiple_iterators. The
1041 default changed to not reopen a file unless requested by the user.
1042 * FastaFile.getReferenceLength is now FastaFile.get_reference_length
1043
1044 Backwards incompatible changes
1045
1046 * Empty cigarstring now returns None (instead of '')
1047 * Empty cigar now returns None (instead of [])
1048 * When using the extension classes in cython modules, AlignedRead
1049 needs to be substituted with AlignedSegment.
1050 * fancy_str() has been removed
1051 * qual, qqual now return arrays
1052
1053 Release 0.8.0
1054 =============
1055
1056 * Disabled features
1057 * IteratorColumn.setMask() disabled as htslib does not implement
1058 this functionality?
1059
1060 * Not implemented yet:
1061 * reading SAM files without header
1062
1063 Tabix files between version 0.7.8 and 0.8.0 are
1064 not compatible and need to be re-indexed.
1065
1066 While version 0.7.8 and 0.8.0 should be mostly
1067 compatible, there are some notable exceptions:
1068
1069 * tabix iterators will fail if there are comments
1070 in the middle or the end of a file.
1071
1072 * tabix raises always ValueError for invalid intervals.
1073 Previously, different types of errors were raised
1074 (KeyError, IndexError, ValueError) depending on
1075 the type of invalid intervals (missing chromosome,
1076 out-of-range, malformatted interval).
1077
1078
1079 Release 0.7.8
1080 =============
1081
1082 * added AlignedRead.setTag method
1083 * added AlignedRead.blocks
1084 * unsetting CIGAR strings is now possible
1085 * empty CIGAR string returns empty list
1086 * added reopen flag to Samfile.fetch()
1087 * various bugfixes
1088
1089 Release 0.7.7
1090 =============
1091
1092 * added Fastafile.references, .nreferences and .lengths
1093 * tabix_iterator now uses kseq.h for python 2.7
1094
1095 Release 0.7.6
1096 =============
1097
1098 * added inferred_length property
1099 * issue 122: MACOSX getline missing, now it works?
1100 * seq and qual can be set None
1101 * added Fastqfile
1102
1103 Release 0.7.5
1104 =============
1105
1106 * switch to samtools 0.1.19
1107 * issue 122: MACOSX getline missing
1108 * issue 130: clean up tempfiles
1109 * various other bugfixes
1110
1111 Release 0.7.4
1112 =============
1113
1114 * further bugfixes to setup.py and package layout
1115
1116 Release 0.7.3
1117 =============
1118
1119 * further bugfixes to setup.py
1120 * upgraded distribute_setup.py to 0.6.34
1121
1122 Release 0.7.2
1123 =============
1124
1125 * bugfix in installer - failed when cython not present
1126 * changed installation locations of shared libraries
1127
1128 Release 0.7.1
1129 =============
1130
1131 * bugfix: missing PP tag PG records in header
1132 * added pre-built .c files to distribution
1133
1134 Release 0.7
1135 ===========
1136
1137 * switch to tabix 0.2.6
1138 * added cigarstring field
1139 * python3 compatibility
1140 * added B tag handling
1141 * added check_sq and check_header options to Samfile.__init__
1142 * added lazy GTF parsing to tabix
1143 * reworked support for VCF format parsing
1144 * bugfixes
1145
1146 Release 0.6
1147 ===========
1148
1149 * switch to samtools 0.1.18
1150 * various bugfixes
1151 * removed references to deprecated 'samtools pileup' functionality
1152 * AlignedRead.tags now returns an empty list if there are no tags.
1153 * added pnext, rnext and tlen
1154
1155 Release 0.5
1156 ===========
1157
1158 * switch to samtools 0.1.16 and tabix 0.2.5
1159 * improved tabix parsing, added vcf support
1160 * re-organized code to permit linking against pysam
1161 * various bugfixes
1162 * added Samfile.positions and Samfile.overlap
1163
1164 Release 0.4
1165 ===========
1166
1167 * switch to samtools 0.1.12a and tabix 0.2.3
1168 * added snp and indel calling.
1169 * switch from pyrex to cython
1170 * changed handling of samtools stderr
1171 * various bugfixes
1172 * added Samfile.count and Samfile.mate
1173 * deprecated AlignedRead.rname, added AlignedRead.tid
1174
1175 Release 0.3
1176 ===========
1177
1178 * switch to samtools 0.1.8
1179 * added support for tabix files
1180 * numerous bugfixes including
1181 * permit simultaneous iterators on the same file
1182 * working access to remote files