From 7197e9ce4c3b6be51553bc7c975436cc1227301a Mon Sep 17 00:00:00 2001 From: Amos Raphenya Date: Tue, 28 Aug 2018 11:21:24 -0400 Subject: [PATCH] fix index error --- app/Base.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/Base.py b/app/Base.py index 806485f..829e22d 100644 --- a/app/Base.py +++ b/app/Base.py @@ -276,6 +276,7 @@ def nudge_strict_to_perfect(self, strict): orf_dna_sequence_ = "" orf_end_ = "" orf_start_ = "" + _partial_protein = "" # Missing n-terminus or c-terminus if len(query) < len(reference) and query in reference: length_nucleotides = (len(reference) - len(strict[s]["match"]))*3 @@ -290,7 +291,7 @@ def nudge_strict_to_perfect(self, strict): # check if partial_bases are multiples of 3 if len(partial_bases) % 3 == 0: - # logger.info("Missing part: {}".format(partial_bases)) + logger.info("Missing part: [{}]".format(partial_bases)) if strict[s]["orf_strand"] == "-": # update orf_end strict[s]["orf_end_possible"] = orf_end_ + 1 @@ -306,11 +307,12 @@ def nudge_strict_to_perfect(self, strict): partial_protein = str(Seq(partial_bases, generic_dna).translate(table=11)) # logger.info("Forward strand: {}".format(partial_protein)) - # logger.info("Translated protein: {}".format(partial_protein)) + logger.info("Translated protein: [{}]".format(partial_protein)) # update start codon to M for all other alternate start codons - _partial_protein = partial_protein[0] - if partial_protein[0] in ["L","M","I","V"]: - _partial_protein = "M"+partial_protein[1:] + if len(_partial_protein) > 0: + _partial_protein = partial_protein[0] + if partial_protein[0] in ["L","M","I","V"]: + _partial_protein = "M"+partial_protein[1:] combine = _partial_protein + strict[s]["match"]