[med-svn] [Git][med-team/python-pysam][master] cope with change to Tabix index format

Michael R. Crusoe gitlab at salsa.debian.org
Wed Feb 20 09:50:29 GMT 2019


Michael R. Crusoe pushed to branch master at Debian Med / python-pysam


Commits:
09438982 by Michael R. Crusoe at 2019-02-20T09:50:11Z
cope with change to Tabix index format

- - - - -


3 changed files:

- debian/changelog
- debian/patches/series
- + debian/patches/test_index_not_compression


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,11 @@
+python-pysam (0.15.2+ds-2) UNRELEASED; urgency=medium
+
+  * Team upload.
+  * For the Tabix tests: test the index contents, not the compression scheme.
+    Closes: #919928, #920250
+
+ -- Michael R. Crusoe <michael.crusoe at gmail.com>  Wed, 20 Feb 2019 01:34:19 -0800
+
 python-pysam (0.15.2+ds-1) unstable; urgency=medium
 
   * Team upload.


=====================================
debian/patches/series
=====================================
@@ -1,3 +1,4 @@
 skip_test_remote.patch
 skip_test_needing_missing_data.patch
 spelling
+test_index_not_compression


=====================================
debian/patches/test_index_not_compression
=====================================
@@ -0,0 +1,70 @@
+From: Michael R. Crusoe <michael.crusoe at gmail.com>
+Subject: Test Tabix index contents, not the compression
+
+Fixes: https://github.com/samtools/htslib/issues/827
+
+--- python-pysam.orig/tests/tabix_test.py
++++ python-pysam/tests/tabix_test.py
+@@ -14,8 +14,6 @@
+ import subprocess
+ import glob
+ import re
+-import copy
+-import tempfile
+ from TestUtils import check_url, load_and_convert, TABIX_DATADIR, get_temp_filename
+ 
+ IS_PYTHON3 = sys.version_info[0] >= 3
+@@ -64,6 +62,17 @@
+     return found
+ 
+ 
++def checkGZBinaryEqual(filename1, filename2):
++    '''return true if the two files are binary equal.'''
++    with gzip.open(filename1, "rb") as infile1:
++        d1 = infile1.read()
++        with gzip.open(filename2, "rb") as infile2:
++            d2 = infile2.read()
++        if d1 == d2:
++            return True
++    return False
++
++
+ class TestIndexing(unittest.TestCase):
+     filename = os.path.join(TABIX_DATADIR, "example.gtf.gz")
+     filename_idx = os.path.join(TABIX_DATADIR, "example.gtf.gz.tbi")
+@@ -77,7 +86,7 @@
+         '''test indexing via preset.'''
+ 
+         pysam.tabix_index(self.tmpfilename, preset="gff")
+-        self.assertTrue(checkBinaryEqual(
++        self.assertTrue(checkGZBinaryEqual(
+             self.tmpfilename + ".tbi", self.filename_idx))
+ 
+     def test_indexing_to_custom_location_works(self):
+@@ -86,7 +95,7 @@
+         index_path = get_temp_filename(suffix='custom.tbi')
+         pysam.tabix_index(self.tmpfilename, preset="gff",
+                           index=index_path, force=True)
+-        self.assertTrue(checkBinaryEqual(index_path, self.filename_idx))
++        self.assertTrue(checkGZBinaryEqual(index_path, self.filename_idx))
+         os.unlink(index_path)
+ 
+     def test_indexing_with_explict_columns_works(self):
+@@ -98,7 +107,7 @@
+                           end_col=4,
+                           line_skip=0,
+                           zerobased=False)
+-        self.assertTrue(checkBinaryEqual(
++        self.assertTrue(checkGZBinaryEqual(
+             self.tmpfilename + ".tbi", self.filename_idx))
+ 
+     def test_indexing_with_lineskipping_works(self):
+@@ -109,7 +118,7 @@
+                           end_col=4,
+                           line_skip=1,
+                           zerobased=False)
+-        self.assertFalse(checkBinaryEqual(
++        self.assertFalse(checkGZBinaryEqual(
+             self.tmpfilename + ".tbi", self.filename_idx))
+ 
+     def tearDown(self):



View it on GitLab: https://salsa.debian.org/med-team/python-pysam/commit/09438982e1cf86c0d4b7e8aa4815ad6fad7e0305

-- 
View it on GitLab: https://salsa.debian.org/med-team/python-pysam/commit/09438982e1cf86c0d4b7e8aa4815ad6fad7e0305
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/20190220/a5131a76/attachment-0001.html>


More information about the debian-med-commit mailing list