From 7803c43a86a79a8856bf8a5d7126e9245b4b101c Mon Sep 17 00:00:00 2001
From: schne <leo.schneider@ecl19.ec-lyon.fr>
Date: Tue, 19 Dec 2023 15:54:34 +0100
Subject: [PATCH] trypsine seq cutting routine

---
 seq_cutting.py | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/seq_cutting.py b/seq_cutting.py
index e69de29..6e9879b 100644
--- a/seq_cutting.py
+++ b/seq_cutting.py
@@ -0,0 +1,41 @@
+ALPHABET_UNMOD = {
+    "A": 1,
+    "C": 2,
+    "D": 3,
+    "E": 4,
+    "F": 5,
+    "G": 6,
+    "H": 7,
+    "I": 8,
+    "K": 9,
+    "L": 10,
+    "M": 11,
+    "N": 12,
+    "P": 13,
+    "Q": 14,
+    "R": 15,
+    "S": 16,
+    "T": 17,
+    "V": 18,
+    "W": 19,
+    "Y": 20,
+}
+
+
+# trypsin cut after A or L (if not followed by P)
+
+def cut(seq, format):
+    cuts = []
+    l = len(seq)
+    if format == 'alphabetical':
+        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)
+
+    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)
+    return cuts
-- 
GitLab