Aim is to code the theoretical peptic cleavage of protein sequences in Python. The cleavage (cutting) rule for pepsin is: 1234^567
. This is a position, ^
stands for the cleavage point.
There are rules that it mustn't have at all and rules where it must have at least one. The rule for mustn't is in position 2, it mustn't be R, K or H. In position 3 and 7, there can't be a P and in position 4, there mustn't be an R.
If it follows "the must not" rules, then it will check "the must" rules so that if any of one them is met, it will cleave. So if there is a P in position 1 or 2, or if there's an L, W, Y or F in position 4 or 5 then, it will be cleaved (use newline).
This is the code I have so far, but it doesn't work yet:
import re
print('INSERT YOUR PEPTIDE')
X= input();
r=re.findall('(?<=[P])(?<=[P,^R,^K,^H])(?<=([^P])(?<=[L,W,F,Y,^R])(?<=[L,W,Y,F])/D(?<=[^P])',X)
print(r)
My input is:
TTGWMFKGLYQLKSDEARMHNLQRWYVFKVIEFWGINRKDQHDSRYWFSHFCWKLEHGMVPKCFNELLMPPMSTHRSMFNAYSMSFCVQVKEWRGSISRMCDHHQQQCQYWRLMAGGTLI
How can I make this work?