allpy
changeset 1095:f05b08e13072
processors.Needle: also check that sequence name is not empty (needle fails on those too)
author | Daniil Alexeyevsky <dendik@kodomo.fbb.msu.ru> |
---|---|
date | Sat, 02 Jun 2012 22:33:50 +0400 |
parents | 61b61f911a1a |
children | ca0b757452da |
files | allpy/processors.py test/test_realign.py |
diffstat | 2 files changed, 12 insertions(+), 13 deletions(-) [+] |
line diff
1.1 --- a/allpy/processors.py Sat Jun 02 22:15:27 2012 +0400 1.2 +++ b/allpy/processors.py Sat Jun 02 22:33:50 2012 +0400 1.3 @@ -80,16 +80,15 @@ 1.4 cmdline = ' '.join(['needle', '-auto'] + args) 1.5 ExternalCommand.__init__(self, cmdline) 1.6 1.7 + def _check_sequence(self, sequence): 1.8 + assert sequence.name, "Needle does not allow empty sequence names" 1.9 + assert ":" not in sequence.name, \ 1.10 + "Needle does not allow : in sequence names" 1.11 + 1.12 def __call__(self, block): 1.13 - assert len(block.sequences) == 2, ( 1.14 - "Needle can only realign sequence pairs" 1.15 - ) 1.16 - assert ":" not in block.sequences[0].name, ( 1.17 - "Needle does not allow : in sequence names" 1.18 - ) 1.19 - assert ":" not in block.sequences[1].name, ( 1.20 - "Needle does not allow : in sequence names" 1.21 - ) 1.22 + assert len(block.sequences) == 2, "Needle needs exactly two sequences" 1.23 + self._check_sequence(block.sequences[0]) 1.24 + self._check_sequence(block.sequences[1]) 1.25 try: 1.26 orig_command = self.command 1.27 self.command = self.command % {
2.1 --- a/test/test_realign.py Sat Jun 02 22:15:27 2012 +0400 2.2 +++ b/test/test_realign.py Sat Jun 02 22:33:50 2012 +0400 2.3 @@ -50,7 +50,7 @@ 2.4 append_row_from_string("n", name="xxx"). 2.5 append_row_from_string("m", name="")) 2.6 2.7 -#@raises(AssertionError) 2.8 -#def test_needle_empty(): 2.9 -# """`needle` must be unable to deal with sequences with empty name""" 2.10 -# example3.realign(processors.Needle()) 2.11 +@raises(AssertionError) 2.12 +def test_needle_empty(): 2.13 + """`needle` must be unable to deal with sequences with empty name""" 2.14 + example3.realign(processors.Needle())