[med-svn] [Git][med-team/python-pysam][master] 4 commits: New upstream version 0.15.1+ds

Steffen Möller gitlab at salsa.debian.org
Fri Sep 14 11:56:13 BST 2018


Steffen Möller pushed to branch master at Debian Med / python-pysam


Commits:
3aa47fe7 by Steffen Moeller at 2018-09-14T08:43:38Z
New upstream version 0.15.1+ds
- - - - -
2a7f1331 by Steffen Moeller at 2018-09-14T08:43:58Z
Update upstream source from tag 'upstream/0.15.1+ds'

Update to upstream version '0.15.1+ds'
with Debian dir b8a01b512d8ab6cf38b25d1319264293cb43bac7
- - - - -
12011a34 by Steffen Moeller at 2018-09-14T10:12:50Z
New upstream version

- - - - -
3e769c45 by Steffen Moeller at 2018-09-14T10:53:24Z
Adjustments

- - - - -


13 changed files:

- .gitignore
- NEWS
- − bcftools/config.h
- debian/changelog
- debian/patches/series
- debian/patches/skip_test_remote.patch
- debian/rules
- doc/release.rst
- pysam/libcalignmentfile.pyx
- tests/AlignmentFileHeader_test.py
- tests/AlignmentFile_test.py
- tests/pysam_data/Makefile
- tests/samtools_test.py


Changes:

=====================================
.gitignore
=====================================
@@ -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


=====================================
NEWS
=====================================
@@ -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
@@ -67,13 +76,13 @@ Backwards incompatible changes:
 
   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.
 
@@ -142,7 +151,7 @@ are created will need to change as the constructor requires a header::
     header = pysam.AlignmentHeader(
         reference_names=["chr1", "chr2"],
         reference_lengths=[1000, 1000])
-        
+
     read = pysam.AlignedSegment(header)
 
 This will affect all code that instantiates AlignedSegment objects
@@ -212,7 +221,7 @@ Release 0.11.0
 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
@@ -355,7 +364,7 @@ Potential isses when upgrading from v0.8.3:
 
 * 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()
@@ -365,7 +374,7 @@ Potential isses when upgrading from v0.8.3:
   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
@@ -474,7 +483,7 @@ Release 0.8.2
   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
 =============
 
@@ -485,8 +494,8 @@ 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:
@@ -516,7 +525,7 @@ Release 0.8.1
      * 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
@@ -539,7 +548,7 @@ Backwards incompatible changes
 * 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
 
@@ -603,18 +612,18 @@ Release 0.7.5
 
 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
 


=====================================
bcftools/config.h deleted
=====================================
@@ -1,2 +0,0 @@
-/* empty config.h created by pysam */
-/* conservative compilation options */


=====================================
debian/changelog
=====================================
@@ -1,3 +1,13 @@
+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 at 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


=====================================
debian/patches/series
=====================================
@@ -1,2 +1,2 @@
-skip_test_needing_missing_data.patch
 skip_test_remote.patch
+#skip_test_needing_missing_data.patch


=====================================
debian/patches/skip_test_remote.patch
=====================================
@@ -2,9 +2,11 @@ Author: Andreas Tille <tille at 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,))
  


=====================================
debian/rules
=====================================
@@ -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/
 


=====================================
doc/release.rst
=====================================
@@ -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
 ==============
 


=====================================
pysam/libcalignmentfile.pyx
=====================================
@@ -1713,8 +1713,13 @@ cdef class AlignmentFile(HTSFile):
         if not self.is_open:
             return 0
 
+        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,


=====================================
tests/AlignmentFileHeader_test.py
=====================================
@@ -120,8 +120,7 @@ class TestHeaderConstruction(unittest.TestCase):
             reference_lengths=[1575, 1584])
         self.compare_headers(header, self.header_without_text)
         self.check_name_mapping(header)
-        
-        
+
 class TestHeaderSAM(unittest.TestCase):
     """testing header manipulation"""
 


=====================================
tests/AlignmentFile_test.py
=====================================
@@ -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(
@@ -1290,7 +1290,7 @@ class TestDeNovoConstruction(unittest.TestCase):
     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"
@@ -1407,7 +1407,30 @@ class TestEmptyHeader(unittest.TestCase):
         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.'''
@@ -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)
 


=====================================
tests/pysam_data/Makefile
=====================================
@@ -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


=====================================
tests/samtools_test.py
=====================================
@@ -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)



View it on GitLab: https://salsa.debian.org/med-team/python-pysam/compare/0004b93eb49ac7a146b7f8012fe0d395a31c9a0a...3e769c4528231e39d8c02211cf59fba392236ddc

-- 
View it on GitLab: https://salsa.debian.org/med-team/python-pysam/compare/0004b93eb49ac7a146b7f8012fe0d395a31c9a0a...3e769c4528231e39d8c02211cf59fba392236ddc
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20180914/a4a93f4a/attachment-0001.html>


More information about the debian-med-commit mailing list