Skip to content
Commits on Source (4)
......@@ -17,6 +17,7 @@ tests/cbcf_data
tests/tabix_data
samtools/config.h
bcftools/config.g
htslib/config.status
htslib/config.h
htslib/config.log
......
......@@ -5,10 +5,19 @@ http://pysam.readthedocs.io/en/latest/release.html
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
......
/* empty config.h created by pysam */
/* conservative compilation options */
python-pysam (0.15.1+ds-1) UNRELEASED; urgency=medium
* New upstream version.
- Removes autogenerated config.h - [many thanks!]
https://github.com/pysam-developers/pysam/issues/714
- Explicit compatibility with Python 3.7
* Removed patch skipping test that complained on missing file
-- Steffen Moeller <moeller@debian.org> Fri, 14 Sep 2018 10:44:51 +0200
python-pysam (0.15.0.1+ds-2) UNRELEASED; urgency=medium
* Remove ancient fields X-Python*-Version
......
skip_test_needing_missing_data.patch
skip_test_remote.patch
#skip_test_needing_missing_data.patch
......@@ -2,9 +2,11 @@ Author: Andreas Tille <tille@debian.org>
Last-Update: Tue, 11 Sep 2018 14:12:55 +0200
Description: Skip tests trying to access remote site
--- a/tests/AlignmentFile_test.py
+++ b/tests/AlignmentFile_test.py
@@ -1596,6 +1596,7 @@ class TestDoubleFetchCRAMWithReference(T
Index: python-pysam/tests/AlignmentFile_test.py
===================================================================
--- python-pysam.orig/tests/AlignmentFile_test.py
+++ python-pysam/tests/AlignmentFile_test.py
@@ -1623,6 +1623,7 @@ class TestDoubleFetchCRAMWithReference(T
reference_filename = os.path.join(BAM_DATADIR, 'ex1.fa')
......@@ -12,8 +14,10 @@ Description: Skip tests trying to access remote site
class TestRemoteFileFTP(unittest.TestCase):
'''test remote access.
--- a/tests/tabix_test.py
+++ b/tests/tabix_test.py
Index: python-pysam/tests/tabix_test.py
===================================================================
--- python-pysam.orig/tests/tabix_test.py
+++ python-pysam/tests/tabix_test.py
@@ -1039,6 +1039,7 @@ for vcf_file in vcf_files:
globals()[n] = type(n, (TestVCFFromVariantFile,), dict(filename=vcf_file,))
......
......@@ -52,7 +52,7 @@ clean-tests: pysam_data.clean cbcf_data.clean
#find . -name "tmp_*" -delete # This deletes samtools/tmp_file.* which is needed to build successfully
find . -name "*.bai*" -delete
find . -name "*.cram*" -delete
find . -name "*.bam" -delete
#find . -name "*.bam" -delete # which deletes files tested
rm -rf tests/pysam_test_work \
tests/example_htslib.gtf.gz.tbi \
tests/log.txt \
......@@ -66,4 +66,5 @@ clean-tests: pysam_data.clean cbcf_data.clean
tests/pysam_data/ex1.fa.gz \
tests/pysam_data/ex1.fa.gz.gzi \
tests/pysam_data/ex1_csi.bam.csi
rm -rf .pytest_cache/
......@@ -2,6 +2,15 @@
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
==============
......
......@@ -1713,8 +1713,13 @@ cdef class AlignmentFile(HTSFile):
if not self.is_open:
return 0
cdef int ret
if self.header.ptr.n_targets <= read._delegate.core.tid:
raise ValueError(
"AlignedSegment refers to reference number {} that "
"is larger than the number of references ({}) in the header".format(
read._delegate.core.tid, self.header.ptr.n_targets))
cdef int ret
with nogil:
ret = sam_write1(self.htsfile,
self.header.ptr,
......
......@@ -121,7 +121,6 @@ class TestHeaderConstruction(unittest.TestCase):
self.compare_headers(header, self.header_without_text)
self.check_name_mapping(header)
class TestHeaderSAM(unittest.TestCase):
"""testing header manipulation"""
......
......@@ -1259,7 +1259,7 @@ class TestWrongFormat(unittest.TestCase):
'rb')
class TestRegionParsiong(unittest.TestCase):
class TestRegionParsing(unittest.TestCase):
def test_dash_in_chr(self):
with pysam.AlignmentFile(
......@@ -1408,6 +1408,29 @@ class TestEmptyHeader(unittest.TestCase):
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.'''
......@@ -1436,7 +1459,7 @@ class TestTruncatedBAM(unittest.TestCase):
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)
......
......@@ -91,6 +91,7 @@ clean:
rm -fr *.bam *.bai *.fai *.pileup* *.cram \
*~ calDepth *.dSYM pysam_*.sam \
ex2.sam ex2.sam.gz ex1.sam \
with_md.sam.gz \
*.fq.gz
%.fq.gz: %.fq
......
......@@ -266,7 +266,8 @@ class SamtoolsTest(unittest.TestCase):
# ignore commands that exit or cause other failures
# TODO: check - if reheader or phase is run in testStatements, sort fails
# here
if command in ("view", "sort", "bam2fq", "flagstat", "reheader", "stats"):
if command in ("view", "sort", "bam2fq", "flagstat", "reheader",
"stats", "idxstats"):
continue
mapped_command = self.get_command(statement, map_to_internal=True)
pysam_method = getattr(self.module, mapped_command)
......