diff --git a/aphylogeo/alignement.py b/aphylogeo/alignement.py index db7400d1..10884e90 100644 --- a/aphylogeo/alignement.py +++ b/aphylogeo/alignement.py @@ -750,7 +750,8 @@ def slidingWindow(self, heuristicMSA, optimized=True): i = The starting position of the window, relative to the original sequence j = The ending position of the window, relative to the original sequence """ - step = Params.window_size + step = Params.step_size + window = Params.window_size windowed_alignment = dict() seq_len = max([len(h) for h in heuristicMSA.values()]) @@ -760,11 +761,11 @@ def slidingWindow(self, heuristicMSA, optimized=True): if optimized: for i in range(0, seq_len, step): if i + step < seq_len: - windowed_alignment[f"{i}_{i + step - 1}"] = {key: val[i : i + step - 1] for key, val in paddedMSA.items()} - combinations = itertools.combinations(windowed_alignment[f"{i}_{i + step - 1}"].values(), 2) + windowed_alignment[f"{i}_{i + window - 1}"] = {key: val[i : i + window - 1] for key, val in paddedMSA.items()} + combinations = itertools.combinations(windowed_alignment[f"{i}_{i + window - 1}"].values(), 2) df = pd.DataFrame(list(combinations)) if Params.rate_similarity > self.similarity(df): - windowed_alignment.pop(f"{i}_{i + step - 1}") + windowed_alignment.pop(f"{i}_{i + window - 1}") else: windowed_alignment[f"{i}_{seq_len-1}"] = {key: val[i : i + seq_len - 1] for key, val in paddedMSA.items()} combinations = itertools.combinations(windowed_alignment[f"{i}_{seq_len-1}"].values(), 2) @@ -774,7 +775,7 @@ def slidingWindow(self, heuristicMSA, optimized=True): else: for i in range(0, seq_len, step): if i + step < seq_len: - windowed_alignment[f"{i}_{i + step - 1}"] = {key: val[i : i + step - 1] for key, val in paddedMSA.items()} + windowed_alignment[f"{i}_{i + window - 1}"] = {key: val[i : i + window - 1] for key, val in paddedMSA.items()} else: windowed_alignment[f"{i}_{seq_len-1}"] = {key: val[i : i + seq_len - 1] for key, val in paddedMSA.items()}