From e75d9ee83fec96fd3af5adaa5074553900ccf3ab Mon Sep 17 00:00:00 2001 From: schne <leo.schneider@ecl19.ec-lyon.fr> Date: Wed, 20 Dec 2023 11:46:51 +0100 Subject: [PATCH] cutting routine --- seq_cutting.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/seq_cutting.py b/seq_cutting.py index 6e9879b..620503f 100644 --- a/seq_cutting.py +++ b/seq_cutting.py @@ -31,11 +31,24 @@ def cut(seq, format): for i in range(l): if seq[i] == 'A' or seq[i] == 'L': if i < l - 1 and seq[i + 1] != 'P': - cuts.append(i) + cuts.append(i + 1) if format == 'numerical': for i in range(l): if seq[i] == 1 or seq[i] == 10: if i < l - 1 and seq[i + 1] != 13: - cuts.append(i) + cuts.append(i + 1) return cuts + + +def cut_with_ind(seq, ind_list): + l = [] + size = len(seq) + ind_list.append(size) + + for i in range(len(ind_list) - 1): + if i == 0: + l.append(seq[:ind_list[i]]) + l.append(seq[ind_list[i]:ind_list[i + 1]]) + + return l -- GitLab