From e92657fdf715afb2113b2fd4c0299e4a83817c77 Mon Sep 17 00:00:00 2001 From: Stefan Bienert <stefan.bienert@unibas.ch> Date: Mon, 25 Feb 2019 17:50:10 +0100 Subject: [PATCH] Fix the HHblits parser for large alignments where the format slightly changes. --- modules/bindings/pymod/hhblits.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/bindings/pymod/hhblits.py b/modules/bindings/pymod/hhblits.py index a203a2920..34efe86af 100644 --- a/modules/bindings/pymod/hhblits.py +++ b/modules/bindings/pymod/hhblits.py @@ -254,21 +254,27 @@ def ParseHHblitsOutput(output): if line[1:].startswith(' ss_dssp'): continue if line.startswith('T '): - end_pos = line.find(' ', 22) + for start_pos in range(22, len(line)): + if line[start_pos].isalpha() or line[start_pos] == '-': + break + end_pos = line.find(' ', start_pos) # this can fail if we didn't skip all other "T ..." lines if end_pos == -1: error_str = "Unparsable line '%s' for entry No %d" \ % (line.strip(), entry_index + 1) raise AssertionError(error_str) - templ_str += line[22:end_pos] + templ_str += line[start_pos:end_pos] if line.startswith('Q '): - end_pos = line.find(' ', 22) + for start_pos in range(22, len(line)): + if line[start_pos].isalpha() or line[start_pos] == '-': + break + end_pos = line.find(' ', start_pos) # this can fail if we didn't skip all other "Q ..." lines if end_pos == -1: error_str = "Unparsable line '%s' for entry No %d" \ % (line.strip(), entry_index + 1) raise AssertionError(error_str) - query_str += line[22:end_pos] + query_str += line[start_pos:end_pos] except StopIteration: if len(query_str) > 0: hits[entry_index][0].aln = _MakeAln(query_id, -- GitLab