I am looking for an R based solution to the following problem:
Trypsin does not cleave perfectly in proteomics experiments. So starting from a protein sequence FASTA I want to generate all possible peptides which COULD be generated if trypsin was allowed n number of "missed cleavages"
In informatics terms I would describe this as skipping a split during a strsplit()
function
Example to clarify:
We start out with the protein sequence: GRGKA
which is usually split by strsplit()
(digested by trypsin) after every K and R
"GRGKA" %>% strsplit(., "(?<=K|R)", perl = TRUE)
[[1]]
[1] "GR" "GK" "A"
now imagine that trypsin did not cleave perfectly, for example missing always one K or R
"GRGK" "GKA"
would be generated in this case. Or if trypsin digested this protein really badly and would end up missing two cleavages we would end up with the sequence:
"GRGKA"
I would love to have a generalizable solution that allows to generate all combinations of sequences that arise with n number of missed cleavages.
If you need any more information please feel free to ask, sorry if I missed something!
jay.sf's requested example:
"FLGERTCTRNERQP"
perfect digest:
"FLGER" "TCTR" "NER" "QP"
one missed cleavage all combinations:
"FLGERTCTR" "TCTRNER" "NERQP"
two missed cleavages all combinations:
"FLGERTCTRNER" "QP" "FLGER" "TCTRNERQP"
three missed cleavages (there are a total of three K and Rs so trypsin would miss all)
"FLGERTCTRNERQP"
For longer sequences I think this becomes a frameshift like problem: If we count the K and Rs in the sequence:
FLGERTCTRNERQPFLGERTCTRNERQP
FLGE1TCT2NE3QPFLGE4TCT5NE6QP
FLGER_TCTR_NER_QPFLGER_TCTR_NER_QP (perfect digest)
FLGERTCTR_NERQPFLGER_TCTRNER_QP (one missed cleavage and always the uneven R and Ks)
FLGER_TCTRNER_QPFLGERTCTR_NERQP (one missed cleavage and always the even R and Ks)
So I think for 1 missed cleavage we have two frames over the whole sequence and for two missed cleavages we would have three frames and so on....
"FLGERTCTRNERQP"
would be a candidate, it has three possible splits. Can you show all possible results for 1, 2, and 3 skipped splits? $\endgroup$