[med-svn] [python-pymummer] 01/03: New upstream version 0.10.1

Sascha Steinbiss satta at debian.org
Fri Nov 18 20:07:39 UTC 2016


This is an automated email from the git hooks/post-receive script.

satta pushed a commit to branch master
in repository python-pymummer.

commit 06a36fc2d981ce5df62ca70ff2c2731d742c0987
Author: Sascha Steinbiss <satta at debian.org>
Date:   Fri Nov 18 19:58:31 2016 +0000

    New upstream version 0.10.1
---
 pymummer/snp.py            | 13 +++++++++----
 pymummer/tests/snp_test.py | 17 ++++++++++++-----
 setup.py                   |  2 +-
 3 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/pymummer/snp.py b/pymummer/snp.py
index eafbd01..b967362 100644
--- a/pymummer/snp.py
+++ b/pymummer/snp.py
@@ -3,18 +3,23 @@ class Error (Exception): pass
 
 class Snp:
     def __init__(self, line):
+        # Without the -C option to show-snps, looks like this:
         #[P1] [SUB] [SUB]  [P2] [BUFF] [DIST] [LEN R] [LEN Q] [FRM]   [TAGS]
         #187  A     C      269  187    187    654     853     1       1   ref_name  qry_name
+
+        # With the -C option to show-snps, looks like this:
+        #[P1] [SUB] [SUB] [P2] [BUFF] [DIST] [R] [Q] [LEN R] [LEN Q] [FRM] [TAGS]
+        #187  A     C     269  187    187    0   0   654     853     1     1   ref_name  qry_name
         try:
             l = line.rstrip().split('\t')
             self.ref_pos = int(l[0]) - 1
             self.ref_base = l[1]
             self.qry_base = l[2]
             self.qry_pos = int(l[3]) - 1
-            self.ref_length = int(l[6])
-            self.qry_length = int(l[7])
-            self.ref_name = l[10]
-            self.qry_name = l[11]
+            self.ref_length = int(l[-6])
+            self.qry_length = int(l[-5])
+            self.ref_name = l[-2]
+            self.qry_name = l[-1]
         except:
             raise Error('Error constructing pymummer.snp.Snp from mummer show-snps output at this line:\n' + line)
 
diff --git a/pymummer/tests/snp_test.py b/pymummer/tests/snp_test.py
index 8f15553..d5d54e9 100644
--- a/pymummer/tests/snp_test.py
+++ b/pymummer/tests/snp_test.py
@@ -8,10 +8,17 @@ data_dir = os.path.join(modules_dir, 'tests', 'data')
 
 
 class TestSnp(unittest.TestCase):
-    def test_str(self):
-        '''Test __str__'''
+    def test_str_no_c_option(self):
+        '''Test __str__ with format with no -C option'''
         l_in = ['187', 'A', 'C', '269', '187', '187', '654', '853', '1', '1', 'ref_name', 'qry_name']
-        # only use columns 0-3, 6-7, 10-11
-        l_out = l_in[:4] + l_in[6:8] + l_in[10:]
         s = snp.Snp('\t'.join(l_in))
-        self.assertEqual(str(s), '\t'.join(l_out))
+        expected = '\t'.join(['187', 'A', 'C', '269', '654', '853', 'ref_name', 'qry_name'])
+        self.assertEqual(str(s), expected)
+
+
+    def test_str_with_c_option(self):
+        '''Test __str__ with format with -C option'''
+        l_in = ['187', 'A', 'C', '269', '187', '187', '0', '0', '654', '853', '1', '1', 'ref_name', 'qry_name']
+        s = snp.Snp('\t'.join(l_in))
+        expected = '\t'.join(['187', 'A', 'C', '269', '654', '853', 'ref_name', 'qry_name'])
+        self.assertEqual(str(s), expected)
diff --git a/setup.py b/setup.py
index db64baf..2c6b48b 100644
--- a/setup.py
+++ b/setup.py
@@ -26,7 +26,7 @@ if not found_all_progs:
 
 setup(
     name='pymummer',
-    version='0.10.0',
+    version='0.10.1',
     description='Wrapper for MUMmer',
     packages = find_packages(),
     author='Martin Hunt, Nishadi De Silva',

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/python-pymummer.git



More information about the debian-med-commit mailing list