-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
When debugging using Pycharm, the objects in the current context are displayed in the debugger window, which calls their str method.
The thing is the str method itself calls the align method, filling the _alseq1 and _alseq2 attributes.
So when we call the self.align manually, both attributes are filled a second time, which creates a bug.
We could make sure the attributes are empty by assigning them to empty lists at the beginning of the _trace_back_alignment method:
def _trace_back_alignment(self, irow: int, jcol: int) -> None:
# FIX
self._alseq1, self._alseq2 = [], []
# !FIX
while True:
if self._pmatrix[irow][jcol] == "diag":
self._alseq1.append(self.seq1[jcol - 1])
self._alseq2.append(self.seq2[irow - 1])
if self.seq1[jcol - 1] == self.seq2[irow - 1]:
self._identity += 1
irow -= 1
jcol -= 1
elif self._pmatrix[irow][jcol] == "up":
self._alseq1.append(Gap(self._gap_character))
self._alseq2.append(self.seq2[irow - 1])
irow -= 1
elif self._pmatrix[irow][jcol] == "left":
self._alseq1.append(self.seq1[jcol - 1])
self._alseq2.append(Gap(self._gap_character))
jcol -= 1
else:
break
self._alseq1 = list(reversed(self._alseq1))
self._alseq2 = list(reversed(self._alseq2))
self._identity = (self._identity / len(self._alseq1)) * 100Metadata
Metadata
Assignees
Labels
No labels