From e48a68b57039636167c5a59e868856b7035f0e94 Mon Sep 17 00:00:00 2001 From: Julien Date: Thu, 6 Jun 2024 12:25:46 +0200 Subject: [PATCH] Fix __str__ call to remove self.align and make sure both _alseq lists are empty --- minineedle/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/minineedle/core.py b/minineedle/core.py index 736a600..bebca51 100644 --- a/minineedle/core.py +++ b/minineedle/core.py @@ -38,8 +38,6 @@ def __init__(self, seq1: Sequence[ItemToAlign], seq2: Sequence[ItemToAlign]) -> self._is_iterable(self.seq2) def __str__(self) -> str: - if not self._alseq1: - self.align() return "Alignment of {} and {}:\n\t{}\n\t{}\n".format( "SEQUENCE 1", "SEQUENCE 2", @@ -213,6 +211,8 @@ def _fill_matrices(self) -> None: self._check_best_score(diagscore, topscore, leftscore, irow, jcol) def _trace_back_alignment(self, irow: int, jcol: int) -> None: + self._alseq1, self._alseq2 = [], [] + while True: if self._pmatrix[irow][jcol] == "diag": self._alseq1.append(self.seq1[jcol - 1])