Permalink
Browse files

Fix bugs in hmmer2-text parser

Two bugs:

* Incorrect key, value parsing split number
* Incorrect line parsing for files containing multiple queries
  • Loading branch information...
1 parent afb9503 commit 3ceed8fcc06023d9fa317f778d7033ba32ffbdc7 @bow bow committed Dec 9, 2012
Showing with 6 additions and 3 deletions.
  1. +6 −3 Bio/SearchIO/HmmerIO/hmmer2_text.py
@@ -63,7 +63,7 @@ def push_back(self, line):
def parse_key_value(self):
"""Parse key-value pair separated by colon (:)"""
- key, value = self.line.split(':')
+ key, value = self.line.split(':', 1)
return key.strip(), value.strip()
def parse_preamble(self):
@@ -122,8 +122,11 @@ def parse_qresult(self):
self.parse_hsps(hit_placeholders)
self.parse_hsp_alignments()
- while self.read_next() and self.line != '//':
- pass
+ while not self.line.startswith('Query'):
+ self.read_next()
+ if not self.line:
+ break
+ self.buf.append(self.line)
if description is not None:
self.qresult.description = description

0 comments on commit 3ceed8f

Please sign in to comment.