This is an automated email from the git hooks/post-receive script. satta pushed a commit to branch master in repository circlator.
commit 3a219834e95ab1c62a7cac9259ef7211f64e9b1f Author: Sascha Steinbiss <[email protected]> Date: Wed Jan 31 16:06:36 2018 +0100 New upstream version 1.5.5 --- AUTHORS | 6 +-- LICENSE | 4 ++ circlator/clean.py | 9 +++- circlator/external_progs.py | 15 +++---- circlator/tests/clean_test.py | 15 +++++++ circlator/tests/external_progs_test.py | 82 ++++++++++++++++++++++++++++++++++ setup.py | 2 +- 7 files changed, 118 insertions(+), 15 deletions(-) diff --git a/AUTHORS b/AUTHORS index 31dc516..5846867 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,3 +1,3 @@ -Martin Hunt ([email protected]) - -This small modification to allow replacing Spades with Canu, and different handling of small contigs, has been done by Nicola De Maio ([email protected]) +Martin Hunt ([email protected]) +Nicola De Maio ([email protected]) +Andrew J. Page ([email protected]) diff --git a/LICENSE b/LICENSE index 733c072..8d196cc 100644 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,7 @@ +Copyright (c) 2015 - 2018 by Genome Research Ltd. + +This is free software, licensed under: + GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 diff --git a/circlator/clean.py b/circlator/clean.py index 44b03cd..7e89d6b 100644 --- a/circlator/clean.py +++ b/circlator/clean.py @@ -128,18 +128,23 @@ class Cleaner: return containing - def _get_all_containing(self, containing_contigs, name, exclude=None): + def _get_all_containing(self, containing_contigs, name, exclude=None, max_depth=10): '''containing_contigs is a dict: key=contig name. Value = set of contigs that contain the key. Returns alls contigs called "name" that contain that contig''' contains_name = set() + + # failsafe to prevent infinite recursion + if max_depth < 0: + return contains_name + if name in containing_contigs: for containing_contig in containing_contigs[name]: # if we have a contains b and b contains a, then this stops infinite recursion if containing_contig==exclude: continue contains_name.add(containing_contig) - new_names = self._get_all_containing(containing_contigs, containing_contig, exclude=name) + new_names = self._get_all_containing(containing_contigs, containing_contig, exclude=name,max_depth=max_depth-1) new_names.discard(name) contains_name.update(new_names) return contains_name diff --git a/circlator/external_progs.py b/circlator/external_progs.py index 30a5c59..f6b9f92 100644 --- a/circlator/external_progs.py +++ b/circlator/external_progs.py @@ -7,24 +7,21 @@ import pyfastaq class Error (Exception): pass - prog_to_env_var = { 'samtools': 'CIRCLATOR_SAMTOOLS', 'spades': 'CIRCLATOR_SPADES', 'canu': 'CIRCLATOR_CANU', } - prog_to_version_cmd = { - 'bwa': ('', re.compile('^Version: ([0-9\.]+)')), - 'nucmer': ('--version', re.compile('^NUCmer \(NUCleotide MUMmer\) version ([0-9\.]+)')), - 'prodigal': ('-v', re.compile('^Prodigal V([0-9\.]+):')), - 'samtools': ('', re.compile('^Version: ([0-9\.]+)')), - 'spades': ('', re.compile('^SPAdes genome assembler v.?([0-9][0-9\.]+)')), - 'canu': ('-version', re.compile('^Canu.*v.?([0-9][0-9\.]+)')), + 'bwa': ('', re.compile(r'^Version: ([0-9\.]+)')), + 'nucmer': ('--version', re.compile(r'([0-9\.]+)')), + 'prodigal': ('-v', re.compile(r'^Prodigal V([0-9\.]+):')), + 'samtools': ('', re.compile(r'Version: (\d+\.\d+[\.\d]*)')), + 'spades': ('-v', re.compile(r'v.?([0-9][0-9\.]+)')), + 'canu': ('-version', re.compile(r'^Canu \D*([\d][\d\.]+)')), } - min_versions = { 'bwa': '0.7.12', 'nucmer': '3.1', diff --git a/circlator/tests/clean_test.py b/circlator/tests/clean_test.py index 3e3dcf0..18a7739 100644 --- a/circlator/tests/clean_test.py +++ b/circlator/tests/clean_test.py @@ -156,7 +156,22 @@ class TestClean(unittest.TestCase): got = cleaner._expand_containing_using_transitivity(dict_in) self.assertEqual(expected, got) + + + def test_infinite_recursion(self): + '''test _infinite_recursion''' + cleaner = clean.Cleaner('infile', 'outprefix') + dict_in = { + 'a': {'b'}, + 'b': {'c'}, + 'c': {'a', 'b'}, + } + + expected = {'a': {'b', 'c'}, 'b': {'a', 'c'}, 'c': {'a', 'b'}} + + got = cleaner._expand_containing_using_transitivity(dict_in) + self.assertEqual(expected, got) def test_collapse_list_of_sets(self): '''test _collapse_list_of_sets''' diff --git a/circlator/tests/external_progs_test.py b/circlator/tests/external_progs_test.py new file mode 100644 index 0000000..4c378ed --- /dev/null +++ b/circlator/tests/external_progs_test.py @@ -0,0 +1,82 @@ +import unittest +from circlator import external_progs + +class TestExternalProgs(unittest.TestCase): + + def test_canu_version(self): + '''Test canu version''' + self.assertEqual('1.6', self.check_regex_version_extraction('canu', """ +Canu 1.6 + """ )) + + def test_spades_version(self): + '''Test spades version''' + self.assertEqual('3.11.0', self.check_regex_version_extraction('spades', """ +SPAdes v3.11.0 + """ )) + self.assertEqual('3.7.1', self.check_regex_version_extraction('spades', """ +SPAdes v3.7.1 + """ )) + self.assertEqual('3.5.0', self.check_regex_version_extraction('spades', """ +SPAdes genome assembler v.3.5.0 + """ )) + + def test_prodigal_version(self): + '''Test prodigal version''' + self.assertEqual('2.60', self.check_regex_version_extraction('prodigal', """ + +Prodigal V2.60: October, 2011 + + """ )) + + def test_bwa_version(self): + '''Test bwa version''' + self.assertEqual('0.7.10', self.check_regex_version_extraction('bwa', """ + +Program: bwa (alignment via Burrows-Wheeler transformation) +Version: 0.7.10-r789 +Contact: Heng Li <[email protected]> + + """ )) + self.assertEqual('0.7.12', self.check_regex_version_extraction('bwa', """ + +Program: bwa (alignment via Burrows-Wheeler transformation) +Version: 0.7.12-r1039 +Contact: Heng Li <[email protected]> + """ )) + + def test_nucmer_version(self): + '''Test nucmer version''' + self.assertEqual('3.1', self.check_regex_version_extraction('nucmer', """ +nucmer +NUCmer (NUCleotide MUMmer) version 3.1 + """ )) + self.assertEqual('4.0.0', self.check_regex_version_extraction('nucmer', """ +4.0.0beta1 + """ )) + + def test_samtools_version(self): + '''Test samtools version''' + self.assertEqual('1.6', self.check_regex_version_extraction('samtools', """ + +Program: samtools (Tools for alignments in the SAM format) +Version: 1.6 (using htslib 1.6) +""" )) + + def test_samtools_original_version(self): + '''Test samtools original version''' + self.assertEqual('0.1.19', self.check_regex_version_extraction('samtools', """ +Program: samtools (Tools for alignments in the SAM format) +Version: 0.1.19-44428cd + +Usage: samtools <command> [options]""" )) + + def check_regex_version_extraction(self, prog, raw_version_output ): + cmd, regex = external_progs.prog_to_version_cmd[prog] + raw_output_lines = raw_version_output.splitlines() + for line in raw_output_lines: + hits = regex.search(line) + if hits: + return str(hits.group(1)) + return None + \ No newline at end of file diff --git a/setup.py b/setup.py index 66feaa3..a074aed 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ from setuptools import setup, find_packages setup( name='circlator', - version='1.5.1', + version='1.5.5', description='circlator: a tool to circularise genome assemblies', packages = find_packages(), package_data={'circlator': ['data/*']}, -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/circlator.git _______________________________________________ debian-med-commit mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit
