[med-svn] [Git][med-team/python-pymummer][upstream] New upstream version 0.11.0
Steffen Möller
gitlab at salsa.debian.org
Wed Jun 10 01:24:14 BST 2020
Steffen Möller pushed to branch upstream at Debian Med / python-pymummer
Commits:
786112ec by Steffen Moeller at 2020-06-10T02:13:52+02:00
New upstream version 0.11.0
- - - - -
8 changed files:
- + CHANGELOG.md
- README.md
- pymummer/snp.py
- pymummer/tests/alignment_test.py
- pymummer/tests/snp_test.py
- pymummer/tests/variant_test.py
- pymummer/variant.py
- setup.py
Changes:
=====================================
CHANGELOG.md
=====================================
@@ -0,0 +1,135 @@
+# Change Log
+
+## [Unreleased](https://github.com/sanger-pathogens/pymummer/tree/HEAD)
+
+[Full Changelog](https://github.com/sanger-pathogens/pymummer/compare/v0.10.3...HEAD)
+
+**Merged pull requests:**
+
+- update README [\#29](https://github.com/sanger-pathogens/pymummer/pull/29) ([ssjunnebo](https://github.com/ssjunnebo))
+
+## [v0.10.3](https://github.com/sanger-pathogens/pymummer/tree/v0.10.3) (2017-08-21)
+[Full Changelog](https://github.com/sanger-pathogens/pymummer/compare/v0.10.2...v0.10.3)
+
+**Merged pull requests:**
+
+- Add diagfactor \(-d\) and maxgap \(-g\) options for nucmer [\#28](https://github.com/sanger-pathogens/pymummer/pull/28) ([Adamtaranto](https://github.com/Adamtaranto))
+- update LICENSE [\#27](https://github.com/sanger-pathogens/pymummer/pull/27) ([ssjunnebo](https://github.com/ssjunnebo))
+
+## [v0.10.2](https://github.com/sanger-pathogens/pymummer/tree/v0.10.2) (2017-02-02)
+[Full Changelog](https://github.com/sanger-pathogens/pymummer/compare/v0.10.1...v0.10.2)
+
+**Closed issues:**
+
+- MUMmer programs not found in path [\#21](https://github.com/sanger-pathogens/pymummer/issues/21)
+
+**Merged pull requests:**
+
+- Ref qry translate vars not in matches [\#26](https://github.com/sanger-pathogens/pymummer/pull/26) ([martinghunt](https://github.com/martinghunt))
+
+## [v0.10.1](https://github.com/sanger-pathogens/pymummer/tree/v0.10.1) (2016-11-18)
+[Full Changelog](https://github.com/sanger-pathogens/pymummer/compare/v0.10.0...v0.10.1)
+
+**Merged pull requests:**
+
+- Indels bug [\#25](https://github.com/sanger-pathogens/pymummer/pull/25) ([martinghunt](https://github.com/martinghunt))
+
+## [v0.10.0](https://github.com/sanger-pathogens/pymummer/tree/v0.10.0) (2016-11-15)
+[Full Changelog](https://github.com/sanger-pathogens/pymummer/compare/v0.9.0...v0.10.0)
+
+**Merged pull requests:**
+
+- Show snps expose C option [\#24](https://github.com/sanger-pathogens/pymummer/pull/24) ([martinghunt](https://github.com/martinghunt))
+
+## [v0.9.0](https://github.com/sanger-pathogens/pymummer/tree/v0.9.0) (2016-10-17)
+[Full Changelog](https://github.com/sanger-pathogens/pymummer/compare/v0.8.1...v0.9.0)
+
+**Merged pull requests:**
+
+- Expose mincluster [\#23](https://github.com/sanger-pathogens/pymummer/pull/23) ([martinghunt](https://github.com/martinghunt))
+
+## [v0.8.1](https://github.com/sanger-pathogens/pymummer/tree/v0.8.1) (2016-08-23)
+[Full Changelog](https://github.com/sanger-pathogens/pymummer/compare/v0.8.0...v0.8.1)
+
+## [v0.8.0](https://github.com/sanger-pathogens/pymummer/tree/v0.8.0) (2016-08-23)
+[Full Changelog](https://github.com/sanger-pathogens/pymummer/compare/v0.7.1...v0.8.0)
+
+**Merged pull requests:**
+
+- Ref coords from qry coord [\#22](https://github.com/sanger-pathogens/pymummer/pull/22) ([martinghunt](https://github.com/martinghunt))
+
+## [v0.7.1](https://github.com/sanger-pathogens/pymummer/tree/v0.7.1) (2016-04-18)
+[Full Changelog](https://github.com/sanger-pathogens/pymummer/compare/v0.7.0...v0.7.1)
+
+**Merged pull requests:**
+
+- Make \_\_version\_\_ work [\#20](https://github.com/sanger-pathogens/pymummer/pull/20) ([martinghunt](https://github.com/martinghunt))
+
+## [v0.7.0](https://github.com/sanger-pathogens/pymummer/tree/v0.7.0) (2016-02-09)
+[Full Changelog](https://github.com/sanger-pathogens/pymummer/compare/v0.6.1...v0.7.0)
+
+**Merged pull requests:**
+
+- Coords finding in matches [\#19](https://github.com/sanger-pathogens/pymummer/pull/19) ([martinghunt](https://github.com/martinghunt))
+
+## [v0.6.1](https://github.com/sanger-pathogens/pymummer/tree/v0.6.1) (2015-10-19)
+[Full Changelog](https://github.com/sanger-pathogens/pymummer/compare/v0.6.0...v0.6.1)
+
+**Merged pull requests:**
+
+- Remove numpy dependency [\#18](https://github.com/sanger-pathogens/pymummer/pull/18) ([martinghunt](https://github.com/martinghunt))
+
+## [v0.6.0](https://github.com/sanger-pathogens/pymummer/tree/v0.6.0) (2015-10-14)
+[Full Changelog](https://github.com/sanger-pathogens/pymummer/compare/v0.5.0...v0.6.0)
+
+**Merged pull requests:**
+
+- Convert to mspcrunch [\#17](https://github.com/sanger-pathogens/pymummer/pull/17) ([martinghunt](https://github.com/martinghunt))
+
+## [v0.5.0](https://github.com/sanger-pathogens/pymummer/tree/v0.5.0) (2015-10-09)
+[Full Changelog](https://github.com/sanger-pathogens/pymummer/compare/v0.4.0...v0.5.0)
+
+**Merged pull requests:**
+
+- Msp crunch output [\#16](https://github.com/sanger-pathogens/pymummer/pull/16) ([martinghunt](https://github.com/martinghunt))
+- Add TravisCI support [\#15](https://github.com/sanger-pathogens/pymummer/pull/15) ([bewt85](https://github.com/bewt85))
+
+## [v0.4.0](https://github.com/sanger-pathogens/pymummer/tree/v0.4.0) (2015-05-28)
+[Full Changelog](https://github.com/sanger-pathogens/pymummer/compare/v0.3.0...v0.4.0)
+
+**Merged pull requests:**
+
+- Expose diagdiff to nucmer [\#14](https://github.com/sanger-pathogens/pymummer/pull/14) ([martinghunt](https://github.com/martinghunt))
+
+## [v0.3.0](https://github.com/sanger-pathogens/pymummer/tree/v0.3.0) (2015-05-15)
+[Full Changelog](https://github.com/sanger-pathogens/pymummer/compare/v0.2.0...v0.3.0)
+
+## [v0.2.0](https://github.com/sanger-pathogens/pymummer/tree/v0.2.0) (2015-05-15)
+[Full Changelog](https://github.com/sanger-pathogens/pymummer/compare/v0.1.0...v0.2.0)
+
+**Merged pull requests:**
+
+- Reverse alignments [\#13](https://github.com/sanger-pathogens/pymummer/pull/13) ([martinghunt](https://github.com/martinghunt))
+- Fix constructing alignment from promer output [\#12](https://github.com/sanger-pathogens/pymummer/pull/12) ([martinghunt](https://github.com/martinghunt))
+- Add promer option; version bump [\#11](https://github.com/sanger-pathogens/pymummer/pull/11) ([martinghunt](https://github.com/martinghunt))
+
+## [v0.1.0](https://github.com/sanger-pathogens/pymummer/tree/v0.1.0) (2015-03-05)
+[Full Changelog](https://github.com/sanger-pathogens/pymummer/compare/v0.0.2...v0.1.0)
+
+**Merged pull requests:**
+
+- minor version number incremented [\#10](https://github.com/sanger-pathogens/pymummer/pull/10) ([nds](https://github.com/nds))
+- Added --nosimplify toggle to nucmer command [\#9](https://github.com/sanger-pathogens/pymummer/pull/9) ([nds](https://github.com/nds))
+
+## [v0.0.2](https://github.com/sanger-pathogens/pymummer/tree/v0.0.2) (2015-02-02)
+**Merged pull requests:**
+
+- Change to pyfastaq; add to pypi [\#8](https://github.com/sanger-pathogens/pymummer/pull/8) ([martinghunt](https://github.com/martinghunt))
+- put system call code in seprate module [\#7](https://github.com/sanger-pathogens/pymummer/pull/7) ([martinghunt](https://github.com/martinghunt))
+- Add snp\_file to list of modules [\#6](https://github.com/sanger-pathogens/pymummer/pull/6) ([martinghunt](https://github.com/martinghunt))
+- Added documentation in README file [\#5](https://github.com/sanger-pathogens/pymummer/pull/5) ([nds](https://github.com/nds))
+- Add variant calling [\#4](https://github.com/sanger-pathogens/pymummer/pull/4) ([martinghunt](https://github.com/martinghunt))
+- Added some doc lines [\#3](https://github.com/sanger-pathogens/pymummer/pull/3) ([nds](https://github.com/nds))
+- Split into separate files [\#2](https://github.com/sanger-pathogens/pymummer/pull/2) ([martinghunt](https://github.com/martinghunt))
+- Initial commit [\#1](https://github.com/sanger-pathogens/pymummer/pull/1) ([martinghunt](https://github.com/martinghunt))
+
=====================================
README.md
=====================================
@@ -1,51 +1,72 @@
-pymummer
-========
+# pymummer
Python3 wrapper for running MUMmer and parsing the output.
-[![Build Status](https://travis-ci.org/sanger-pathogens/pymummer.svg?branch=master)](https://travis-ci.org/sanger-pathogens/pymummer)
-
-Installation
-------------
-
-###Homebrew/LinuxBrew###
+[![Build Status](https://travis-ci.org/sanger-pathogens/pymummer.svg?branch=master)](https://travis-ci.org/sanger-pathogens/pymummer)
+[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-brightgreen.svg)](https://github.com/sanger-pathogens/pymummer/blob/master/LICENSE)
+[![install with bioconda](https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg?style=flat-square)](http://bioconda.github.io/recipes/pymummer/README.html)
+[![Container ready](https://img.shields.io/badge/container-ready-brightgreen.svg)](https://quay.io/repository/biocontainers/pymummer)
+
+## Contents
+ * [Introduction](#introduction)
+ * [Installation](#installation)
+ * [Required dependencies](#required-dependencies)
+ * [Homebrew/LinuxBrew](#homebrewlinuxbrew)
+ * [Using pip](#using-pip)
+ * [Running the tests](#running-the-tests)
+ * [Usage (for developers)](#usage-for-developers)
+ * [pymummer nucmer class](#pymummer-nucmer-class)
+ * [pymummer coords\_file class](#pymummer-coords_file-class)
+ * [pymummer alignment class](#pymummer-alignment-class)
+ * [License](#license)
+ * [Feedback/Issues](#feedbackissues)
+
+## Introduction
+Runs MUMmer and parses the output.
+
+## Installation
+pymummer has the following dependencies:
+
+### Required dependencies
+* [MUMmer](http://mummer.sourceforge.net/manual/#installation)
+
+There are a number of ways to install pymummer and details are provided below. If you encounter an issue when installing pymummer please contact your local system administrator. If you encounter a bug please log it [here](https://github.com/sanger-pathogens/pymummer/issues) or email us at path-help at sanger.ac.uk.
+
+### Homebrew/LinuxBrew
```
brew tap homebrew/python
brew install pymummer
```
-##Pip
-###Pre-requisites###
-
-The MUMmer package must be installed.
-Instructions to install MUMmer can be found [here](http://mummer.sourceforge.net/manual/#installation)
-
-###Installation###
-
-Install with
-
- pip3 install pymummer
+### Using pip
+```
+pip3 install pymummer
+```
+### Running the tests
+The test can be run from the top level directory:
+```
+python setup.py test
+```
-Usage (for developers)
-----------------------
+## Usage (for developers)
Example showing how pymummer can be used to run nucmer on a fasta file and parse the output file to produce a set of alignment objects:
-
- from pymummer import coords_file, alignment, nucmer
- ...
- runner = nucmer.Runner(reference_file, query_file, results_file)
- runner.run()
- file_reader = coords_file.reader(results_file)
- alignments = [coord for coord in file_reader if not coord.is_self_hit()] #Remove self hits
- ...
-
-###pymummer nucmer class###
+```
+from pymummer import coords_file, alignment, nucmer
+...
+runner = nucmer.Runner(reference_file, query_file, results_file)
+runner.run()
+file_reader = coords_file.reader(results_file)
+alignments = [coord for coord in file_reader if not coord.is_self_hit()] #Remove self hits
+...
+```
+### pymummer nucmer class
Wraps the `nucmer`, `delta-filter`, `show-coords` and `show-snps` commands.
Arguments:
-
+```
__ref__ reference file
__query__ query file
__outfile__ output file
@@ -56,26 +77,18 @@ __coords\_header__ print header in show-coords output (default True)
__maxmatch__ maxmatch for nucmer (default False)
__show\_snps__ run show-snps (default False)
__snps\_header__ print header in show-snps output (default True)
+```
-###pymummer promer class###
-
-[TODO]
-
-###pymummer coords_file class###
+### pymummer coords_file class
Parses the nucmer output and populate an alignment object for each hit in the output
-
-###pymummer alignment class###
+### pymummer alignment class
Check attributes of a hit, swap the reference and query, check if it's a self hit and so on
-Contact
--------
-
-Authors: Martin Hunt, Nishadi De Silva
-
-Affiliation: Wellcome Trust Sanger Institute, Hinxton, UK
+## License
+pymummer is free software, licensed under [GPLv3](https://github.com/sanger-pathogens/pymummer/blob/master/LICENSE).
-Email: path-help at sanger.ac.uk
-
+## Feedback/Issues
+Please report any issues to the [issues page](https://github.com/sanger-pathogens/pymummer/issues) or email path-help at sanger.ac.uk.
\ No newline at end of file
=====================================
pymummer/snp.py
=====================================
@@ -18,6 +18,7 @@ class Snp:
self.qry_pos = int(l[3]) - 1
self.ref_length = int(l[-6])
self.qry_length = int(l[-5])
+ self.reverse = {'1': False, '-1': True}[l[-3]]
self.ref_name = l[-2]
self.qry_name = l[-1]
except:
@@ -36,6 +37,7 @@ class Snp:
self.qry_pos + 1,
self.ref_length,
self.qry_length,
+ '-1' if self.reverse else '1',
self.ref_name,
self.qry_name
]])
=====================================
pymummer/tests/alignment_test.py
=====================================
@@ -159,16 +159,16 @@ class TestNucmer(unittest.TestCase):
def test_qry_coords_from_ref_coord_test_same_strand(self):
'''Test qry_coords_from_ref_coord on same strand'''
aln = alignment.Alignment('\t'.join(['100', '200', '1', '101', '100', '100', '100.00', '300', '300', '1', '1', 'ref', 'qry']))
- snp0 = snp.Snp('\t'.join(['140', 'A', 'T', '40', 'x', 'x', '300', '300', 'x', 'x', 'ref', 'qry'])) # snp
+ snp0 = snp.Snp('\t'.join(['140', 'A', 'T', '40', 'x', 'x', '300', '300', 'x', '1', 'ref', 'qry'])) # snp
snp0 = variant.Variant(snp0)
- snp1 = snp.Snp('\t'.join(['140', 'A', '.', '40', 'x', 'x', '300', '300', 'x', 'x', 'ref', 'qry'])) # del from qry
- snp2 = snp.Snp('\t'.join(['141', 'C', '.', '40', 'x', 'x', '300', '300', 'x', 'x', 'ref', 'qry'])) # del from qry
+ snp1 = snp.Snp('\t'.join(['140', 'A', '.', '40', 'x', 'x', '300', '300', 'x', '1', 'ref', 'qry'])) # del from qry
+ snp2 = snp.Snp('\t'.join(['141', 'C', '.', '40', 'x', 'x', '300', '300', 'x', '1', 'ref', 'qry'])) # del from qry
del1 = variant.Variant(snp1)
del2 = variant.Variant(snp1)
self.assertTrue(del2.update_indel(snp2))
- snp3 = snp.Snp('\t'.join(['150', '.', 'A', '50', 'x', 'x', '300', '300', 'x', 'x', 'ref', 'qry'])) # del from ref
- snp4 = snp.Snp('\t'.join(['150', '.', 'C', '51', 'x', 'x', '300', '300', 'x', 'x', 'ref', 'qry'])) # del from ref
- snp5 = snp.Snp('\t'.join(['150', '.', 'G', '52', 'x', 'x', '300', '300', 'x', 'x', 'ref', 'qry'])) # del from ref
+ snp3 = snp.Snp('\t'.join(['150', '.', 'A', '50', 'x', 'x', '300', '300', 'x', '1', 'ref', 'qry'])) # del from ref
+ snp4 = snp.Snp('\t'.join(['150', '.', 'C', '51', 'x', 'x', '300', '300', 'x', '1', 'ref', 'qry'])) # del from ref
+ snp5 = snp.Snp('\t'.join(['150', '.', 'G', '52', 'x', 'x', '300', '300', 'x', '1', 'ref', 'qry'])) # del from ref
ins1 = variant.Variant(snp3)
ins2 = variant.Variant(snp3)
self.assertTrue(ins2.update_indel(snp4))
@@ -209,16 +209,16 @@ class TestNucmer(unittest.TestCase):
def test_qry_coords_from_ref_coord_test_different_strand(self):
'''Test qry_coords_from_ref_coord on different strand'''
aln = alignment.Alignment('\t'.join(['100', '200', '101', '1', '100', '100', '100.00', '300', '300', '1', '1', 'ref', 'qry']))
- snp0 = snp.Snp('\t'.join(['140', 'A', 'T', '40', 'x', 'x', '300', '300', 'x', 'x', 'ref', 'qry'])) # snp
+ snp0 = snp.Snp('\t'.join(['140', 'A', 'T', '40', 'x', 'x', '300', '300', 'x', '1', 'ref', 'qry'])) # snp
snp0 = variant.Variant(snp0)
- snp1 = snp.Snp('\t'.join(['140', 'A', '.', '40', 'x', 'x', '300', '300', 'x', 'x', 'ref', 'qry'])) # del from qry
- snp2 = snp.Snp('\t'.join(['141', 'C', '.', '40', 'x', 'x', '300', '300', 'x', 'x', 'ref', 'qry'])) # del from qry
+ snp1 = snp.Snp('\t'.join(['140', 'A', '.', '40', 'x', 'x', '300', '300', 'x', '1', 'ref', 'qry'])) # del from qry
+ snp2 = snp.Snp('\t'.join(['141', 'C', '.', '40', 'x', 'x', '300', '300', 'x', '1', 'ref', 'qry'])) # del from qry
del1 = variant.Variant(snp1)
del2 = variant.Variant(snp1)
self.assertTrue(del2.update_indel(snp2))
- snp3 = snp.Snp('\t'.join(['150', '.', 'A', '50', 'x', 'x', '300', '300', 'x', 'x', 'ref', 'qry'])) # del from ref
- snp4 = snp.Snp('\t'.join(['150', '.', 'C', '51', 'x', 'x', '300', '300', 'x', 'x', 'ref', 'qry'])) # del from ref
- snp5 = snp.Snp('\t'.join(['150', '.', 'G', '52', 'x', 'x', '300', '300', 'x', 'x', 'ref', 'qry'])) # del from ref
+ snp3 = snp.Snp('\t'.join(['150', '.', 'A', '50', 'x', 'x', '300', '300', 'x', '1', 'ref', 'qry'])) # del from ref
+ snp4 = snp.Snp('\t'.join(['150', '.', 'C', '51', 'x', 'x', '300', '300', 'x', '1', 'ref', 'qry'])) # del from ref
+ snp5 = snp.Snp('\t'.join(['150', '.', 'G', '52', 'x', 'x', '300', '300', 'x', '1', 'ref', 'qry'])) # del from ref
ins1 = variant.Variant(snp3)
ins2 = variant.Variant(snp3)
self.assertTrue(ins2.update_indel(snp4))
@@ -273,16 +273,16 @@ class TestNucmer(unittest.TestCase):
def test_ref_coords_from_qry_coord_test_same_strand(self):
'''Test ref_coords_from_qry_coord on same strand'''
aln = alignment.Alignment('\t'.join(['1', '101', '100', '200', '100', '100', '100.00', '300', '300', '1', '1', 'ref', 'qry']))
- snp0 = snp.Snp('\t'.join(['40', 'T', 'A', '140', 'x', 'x', '300', '300', 'x', 'x', 'ref', 'qry'])) # snp
+ snp0 = snp.Snp('\t'.join(['40', 'T', 'A', '140', 'x', 'x', '300', '300', 'x', '1', 'ref', 'qry'])) # snp
snp0 = variant.Variant(snp0)
- snp1 = snp.Snp('\t'.join(['40', '.', 'A', '140', 'x', 'x', '300', '300', 'x', 'x', 'ref', 'qry'])) # del from ref
- snp2 = snp.Snp('\t'.join(['40', '.', 'C', '141', 'x', 'x', '300', '300', 'x', 'x', 'ref', 'qry'])) # del from ref
+ snp1 = snp.Snp('\t'.join(['40', '.', 'A', '140', 'x', 'x', '300', '300', 'x', '1', 'ref', 'qry'])) # del from ref
+ snp2 = snp.Snp('\t'.join(['40', '.', 'C', '141', 'x', 'x', '300', '300', 'x', '1', 'ref', 'qry'])) # del from ref
del1 = variant.Variant(snp1)
del2 = variant.Variant(snp1)
self.assertTrue(del2.update_indel(snp2))
- snp3 = snp.Snp('\t'.join(['50', 'A', '.', '150', 'x', 'x', '300', '300', 'x', 'x', 'ref', 'qry'])) # del from qry
- snp4 = snp.Snp('\t'.join(['51', 'C', '.', '150', 'x', 'x', '300', '300', 'x', 'x', 'ref', 'qry'])) # del from qry
- snp5 = snp.Snp('\t'.join(['52', 'G', '.', '150', 'x', 'x', '300', '300', 'x', 'x', 'ref', 'qry'])) # del from qry
+ snp3 = snp.Snp('\t'.join(['50', 'A', '.', '150', 'x', 'x', '300', '300', 'x', '1', 'ref', 'qry'])) # del from qry
+ snp4 = snp.Snp('\t'.join(['51', 'C', '.', '150', 'x', 'x', '300', '300', 'x', '1', 'ref', 'qry'])) # del from qry
+ snp5 = snp.Snp('\t'.join(['52', 'G', '.', '150', 'x', 'x', '300', '300', 'x', '1', 'ref', 'qry'])) # del from qry
ins1 = variant.Variant(snp3)
ins2 = variant.Variant(snp3)
self.assertTrue(ins2.update_indel(snp4))
=====================================
pymummer/tests/snp_test.py
=====================================
@@ -12,13 +12,13 @@ class TestSnp(unittest.TestCase):
'''Test __str__ with format with no -C option'''
l_in = ['187', 'A', 'C', '269', '187', '187', '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'])
+ expected = '\t'.join(['187', 'A', 'C', '269', '654', '853', '1', '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']
+ 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'])
+ expected = '\t'.join(['187', 'A', 'C', '269', '654', '853', '-1', 'ref_name', 'qry_name'])
self.assertEqual(str(s), expected)
=====================================
pymummer/tests/variant_test.py
=====================================
@@ -25,33 +25,33 @@ class TestVariant(unittest.TestCase):
def test_update_indel_no_change(self):
'''Test update_indel does nothing in the right cases'''
initial_vars = [
- snp.Snp('\t'.join(['42', 'A', 'C', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref', 'qry'])),
- snp.Snp('\t'.join(['42', 'A', 'C', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref', 'qry'])),
- snp.Snp('\t'.join(['42', 'A', '.', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref', 'qry'])),
- snp.Snp('\t'.join(['42', 'A', '.', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref', 'qry'])),
- snp.Snp('\t'.join(['42', 'A', '.', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref', 'qry'])),
- snp.Snp('\t'.join(['42', 'A', '.', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref', 'qry'])),
- snp.Snp('\t'.join(['42', 'A', '.', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref', 'qry'])),
- snp.Snp('\t'.join(['42', '.', 'A', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref', 'qry'])),
- snp.Snp('\t'.join(['42', '.', 'A', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref', 'qry'])),
- snp.Snp('\t'.join(['42', '.', 'A', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref', 'qry'])),
- snp.Snp('\t'.join(['42', '.', 'A', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref', 'qry'])),
- snp.Snp('\t'.join(['42', '.', 'A', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref', 'qry'])),
+ snp.Snp('\t'.join(['42', 'A', 'C', '100', 'x', 'x', '300', '400', 'x', '1', 'ref', 'qry'])),
+ snp.Snp('\t'.join(['42', 'A', 'C', '100', 'x', 'x', '300', '400', 'x', '1', 'ref', 'qry'])),
+ snp.Snp('\t'.join(['42', 'A', '.', '100', 'x', 'x', '300', '400', 'x', '1', 'ref', 'qry'])),
+ snp.Snp('\t'.join(['42', 'A', '.', '100', 'x', 'x', '300', '400', 'x', '1', 'ref', 'qry'])),
+ snp.Snp('\t'.join(['42', 'A', '.', '100', 'x', 'x', '300', '400', 'x', '1', 'ref', 'qry'])),
+ snp.Snp('\t'.join(['42', 'A', '.', '100', 'x', 'x', '300', '400', 'x', '1', 'ref', 'qry'])),
+ snp.Snp('\t'.join(['42', 'A', '.', '100', 'x', 'x', '300', '400', 'x', '1', 'ref', 'qry'])),
+ snp.Snp('\t'.join(['42', '.', 'A', '100', 'x', 'x', '300', '400', 'x', '1', 'ref', 'qry'])),
+ snp.Snp('\t'.join(['42', '.', 'A', '100', 'x', 'x', '300', '400', 'x', '1', 'ref', 'qry'])),
+ snp.Snp('\t'.join(['42', '.', 'A', '100', 'x', 'x', '300', '400', 'x', '1', 'ref', 'qry'])),
+ snp.Snp('\t'.join(['42', '.', 'A', '100', 'x', 'x', '300', '400', 'x', '1', 'ref', 'qry'])),
+ snp.Snp('\t'.join(['42', '.', 'A', '100', 'x', 'x', '300', '400', 'x', '1', 'ref', 'qry'])),
]
to_add = [
- snp.Snp('\t'.join(['142', 'A', '.', '1000', 'x', 'x', '2000', '3000', 'x', 'x', 'ref', 'qry'])),
- snp.Snp('\t'.join(['142', '.', 'A', '1000', 'x', 'x', '2000', '3000', 'x', 'x', 'ref', 'qry'])),
- snp.Snp('\t'.join(['43', 'A', '.', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref2', 'qry'])),
- snp.Snp('\t'.join(['43', 'A', '.', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref', 'qry2'])),
- snp.Snp('\t'.join(['44', 'A', '.', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref', 'qry'])),
- snp.Snp('\t'.join(['42', 'A', '.', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref', 'qry'])),
- snp.Snp('\t'.join(['43', '.', 'A', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref', 'qry'])),
- snp.Snp('\t'.join(['43', '.', 'A', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref2', 'qry'])),
- snp.Snp('\t'.join(['43', '.', 'A', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref', 'qry2'])),
- snp.Snp('\t'.join(['44', '.', 'A', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref', 'qry'])),
- snp.Snp('\t'.join(['42', '.', 'A', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref', 'qry'])),
- snp.Snp('\t'.join(['42', 'A', '.', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref', 'qry'])),
+ snp.Snp('\t'.join(['142', 'A', '.', '1000', 'x', 'x', '2000', '3000', 'x', '1', 'ref', 'qry'])),
+ snp.Snp('\t'.join(['142', '.', 'A', '1000', 'x', 'x', '2000', '3000', 'x', '1', 'ref', 'qry'])),
+ snp.Snp('\t'.join(['43', 'A', '.', '100', 'x', 'x', '300', '400', 'x', '1', 'ref2', 'qry'])),
+ snp.Snp('\t'.join(['43', 'A', '.', '100', 'x', 'x', '300', '400', 'x', '1', 'ref', 'qry2'])),
+ snp.Snp('\t'.join(['44', 'A', '.', '100', 'x', 'x', '300', '400', 'x', '1', 'ref', 'qry'])),
+ snp.Snp('\t'.join(['42', 'A', '.', '100', 'x', 'x', '300', '400', 'x', '1', 'ref', 'qry'])),
+ snp.Snp('\t'.join(['43', '.', 'A', '100', 'x', 'x', '300', '400', 'x', '1', 'ref', 'qry'])),
+ snp.Snp('\t'.join(['43', '.', 'A', '100', 'x', 'x', '300', '400', 'x', '1', 'ref2', 'qry'])),
+ snp.Snp('\t'.join(['43', '.', 'A', '100', 'x', 'x', '300', '400', 'x', '1', 'ref', 'qry2'])),
+ snp.Snp('\t'.join(['44', '.', 'A', '100', 'x', 'x', '300', '400', 'x', '1', 'ref', 'qry'])),
+ snp.Snp('\t'.join(['42', '.', 'A', '100', 'x', 'x', '300', '400', 'x', '1', 'ref', 'qry'])),
+ snp.Snp('\t'.join(['42', 'A', '.', '100', 'x', 'x', '300', '400', 'x', '1', 'ref', 'qry'])),
]
assert len(initial_vars) == len(to_add)
@@ -64,8 +64,8 @@ class TestVariant(unittest.TestCase):
def test_update_indel_insertion(self):
'''Test update_indel extends insertions correctly'''
- insertion = variant.Variant(snp.Snp('\t'.join(['42', '.', 'A', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref', 'qry'])))
- to_add = snp.Snp('\t'.join(['42', '.', 'C', '101', 'x', 'x', '300', '400', 'x', 'x', 'ref', 'qry']))
+ insertion = variant.Variant(snp.Snp('\t'.join(['42', '.', 'A', '100', 'x', 'x', '300', '400', 'x', '-1', 'ref', 'qry'])))
+ to_add = snp.Snp('\t'.join(['42', '.', 'C', '101', 'x', 'x', '300', '400', 'x', '-1', 'ref', 'qry']))
expected = copy.copy(insertion)
# coords stored zero-based, so subtract 1 from the real expected coords
expected.ref_start = 41
@@ -84,8 +84,8 @@ class TestVariant(unittest.TestCase):
def test_update_indel_deletion(self):
'''Test update_indel extends deletions correctly'''
- deletion = variant.Variant(snp.Snp('\t'.join(['42', 'A', '.', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref', 'qry'])))
- to_add = snp.Snp('\t'.join(['43', 'C', '.', '100', 'x', 'x', '300', '400', 'x', 'x', 'ref', 'qry']))
+ deletion = variant.Variant(snp.Snp('\t'.join(['42', 'A', '.', '100', 'x', 'x', '300', '400', 'x', '1', 'ref', 'qry'])))
+ to_add = snp.Snp('\t'.join(['43', 'C', '.', '100', 'x', 'x', '300', '400', 'x', '1', 'ref', 'qry']))
expected = copy.copy(deletion)
# coords stored zero-based, so subtract 1 from the real expected coords
expected.ref_start = 41
=====================================
pymummer/variant.py
=====================================
@@ -37,6 +37,7 @@ class Variant:
self.qry_end = snp.qry_pos
self.qry_length = snp.qry_length
self.qry_name = snp.qry_name
+ self.reverse = snp.reverse
def __eq__(self, other):
@@ -54,7 +55,8 @@ class Variant:
str(self.qry_end + 1),
str(self.qry_length),
str(self.qry_name),
- self.qry_base
+ self.qry_base,
+ '-1' if self.reverse else '1',
])
def update_indel(self, nucmer_snp):
@@ -63,7 +65,8 @@ class Variant:
if self.var_type not in [INS, DEL] \
or self.var_type != new_variant.var_type \
or self.qry_name != new_variant.qry_name \
- or self.ref_name != new_variant.ref_name:
+ or self.ref_name != new_variant.ref_name \
+ or self.reverse != new_variant.reverse:
return False
if self.var_type == INS \
and self.ref_start == new_variant.ref_start \
=====================================
setup.py
=====================================
@@ -26,7 +26,7 @@ if not found_all_progs:
setup(
name='pymummer',
- version='0.10.3',
+ version='0.11.0',
description='Wrapper for MUMmer',
packages = find_packages(),
author='Martin Hunt, Nishadi De Silva',
View it on GitLab: https://salsa.debian.org/med-team/python-pymummer/-/commit/786112ec15d531568d96c2a8c829ff889e60b7ed
--
View it on GitLab: https://salsa.debian.org/med-team/python-pymummer/-/commit/786112ec15d531568d96c2a8c829ff889e60b7ed
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/20200610/517cdfa1/attachment-0001.html>
More information about the debian-med-commit
mailing list