Release notes
=============
+Release 0.15.1
+==============
+
+Bugfix release.
+
+* [#716] raise ValueError if tid is out of range when writing
+* [#697] release version using cython 0.28.5 for python 3.7
+ compatibility
+
Release 0.15.0
==============
-This release wraps htslib/samtools/bcftools version 1.9.0.
+This release wraps htslib (and friends) version 1.9.
* [#673] permit dash in chromosome name of region string
* [#656] Support `text` when opening a SAM file for writing
The rationale for this change is to have consistency between
AlignmentFile and VariantFile.
-
+
* AlignmentFile and FastaFile now raise IOError instead of OSError
Medium term we plan to have a 1.0 release. The pysam
interface has grown over the years and the API is cluttered with
deprecated names (Samfile, getrname(), gettid(), ...). To work towards
-this, the next release (0.15.0) will yield DeprecationWarnings
+this, the next release (0.15.0) will yield DeprecationWarnings
for any parts of the API that are considered obsolete and will not be
in 1.0. Once 1.0 has been reached, we will use semantic versioning.
header = pysam.AlignmentHeader(
reference_names=["chr1", "chr2"],
reference_lengths=[1000, 1000])
-
+
read = pysam.AlignedSegment(header)
This will affect all code that instantiates AlignedSegment objects
This release wraps the latest versions of htslib/samtools/bcftools and
implements a few bugfixes.
-* [#413] Wrap HTSlib/Samtools/BCFtools 1.4
+* [#413] Wrap HTSlib/Samtools/BCFtools 1.4
* [#422] Fix missing pysam.sort.usage() message
* [#411] Fix BGZfile initialization bug
* [#412] Add seek support for BGZFile
* binary tags are now returned as python arrays
-* renamed several methods for pep8 compatibility, old names still retained for
+* renamed several methods for pep8 compatibility, old names still retained for
backwards compatibility, but should be considered deprecated.
* gettid() is now get_tid()
* getrname() is now get_reference_name()
names being present:
* fromQualityString() is now qualitystring_to_array()
* toQualityString() is now qualities_to_qualitystring()
-
+
* faidx now returns strings and not binary strings in py3.
* The cython components have been broken up into smaller files with
with reading and writing capability. However, the interface is still
incomplete and preliminary and lacks capability to mutate the
resulting data.
-
+
Release 0.8.1
=============
* issue #42: skip tests requiring network if none available
* issue #19: multiple iterators can now be made to work on the same tabix file
* issue #24: All strings returned from/passed to the pysam API are now unicode in python 3
- * issue #5: type guessing for lists of integers fixed
-
+ * issue #5: type guessing for lists of integers fixed
+
* API changes for consistency. The old API is still present,
but deprecated.
In particular:
* qstart -> query_alignment_start
* qend -> query_alignment_end
* qlen -> query_alignment_length
- * mrnm -> next_reference_id
+ * mrnm -> next_reference_id
* mpos -> next_reference_start
* rname -> reference_id
* isize -> template_length
* Empty cigarstring now returns None (intstead of '')
* Empty cigar now returns None (instead of [])
* When using the extension classes in cython modules, AlignedRead
- needs to be substituted with AlignedSegment.
+ needs to be substituted with AlignedSegment.
* fancy_str() has been removed
* qual, qqual now return arrays
Release 0.7.4
=============
-
+
* further bugfixes to setup.py and package layout
Release 0.7.3
=============
-
+
* further bugfixes to setup.py
* upgraded distribute_setup.py to 0.6.34
Release 0.7.2
=============
-
+
* bugfix in installer - failed when cython not present
* changed installation locations of shared libraries
'rb')
-class TestRegionParsiong(unittest.TestCase):
+class TestRegionParsing(unittest.TestCase):
def test_dash_in_chr(self):
with pysam.AlignmentFile(
def setUp(self):
header = pysam.AlignmentHeader.from_dict(self.header)
-
+
a = pysam.AlignedSegment(header)
a.query_name = "read_28833_29006_6945"
a.query_sequence = "AGCTTAGCTAGCTACCTATATCTTGGTCTTGGCCG"
self.assertTrue("SQ" in s.header.to_dict())
self.assertTrue("@SQ" in str(s.header))
-
+
+class TestMismatchingHeader(unittest.TestCase):
+ '''see issue 716.'''
+
+ def testMismatchingHeader(self):
+ # Note: no chr2
+ header = {
+ 'SQ': [{'SN': 'chr1', 'LN': 1575}],
+ 'PG': [{'ID': 'bwa', 'PN': 'bwa', 'VN': '0.7.15', 'CL': 'bwa mem xx -'}],
+ }
+
+ dest = get_temp_filename("tmp_ex3.bam")
+ with pysam.AlignmentFile(os.path.join(BAM_DATADIR, 'ex3.bam')) as inf:
+ with pysam.AlignmentFile(dest, mode="wb", header=header) as outf:
+ for read in inf:
+ if read.reference_name == "chr1":
+ outf.write(read)
+ else:
+ self.assertRaises(ValueError,
+ outf.write,
+ read)
+ os.unlink(dest)
+
+
class TestHeaderWithProgramOptions(unittest.TestCase):
'''see issue 39.'''
pysam.AlignmentFile,
os.path.join(BAM_DATADIR, 'ex2_truncated.bam'))
- def testTruncatedBam2(self):
+ def testTruncatedBamIterator(self):
s = pysam.AlignmentFile(os.path.join(BAM_DATADIR, 'ex2_truncated.bam'),
ignore_truncation=True)