Splitting a peptide (splitting a long string between certain letters)

Hi guys,

I wonder is there any function in Mathematica can split a string like “MERASLIQKAKLAEQAERYEDMAAFMKGAV” , “GDYYRYLAEVETGDDKKRIIDSARSA”, and “EKKQQMAREYREKIYETELRDICNDVLSLEYKFLIPNASQ” into sub-strings between the letters “Y” and “E”. I found the documentation for string and text manipulation functions but they do not seem to work..

For example, turing XXXYEXXX, and AAAEYBBB into “XXXY”, “EXXX”, “AAAE”, and “YBBB”.

Thanks!

There are a thousand different ways to skin this cat:

Insert a special character between Y and E and then split the string by that character:

StringSplit[StringReplace["XXXYEXXX", {"YE" -> "Y-E", "YE" -> "Y-E"}], "-"]

Or maybe it’s best to treat this like a List instead of a String:

Split[Characters["XXXYEXXX"], Sort[{#1, #2}] != {"E", "Y"} &]

or

Map[StringJoin]@Split[Characters@"XXXYEXXX", Sort@{#1, #2} != {"E", "Y"} &]

These would be okay if you didn’t care about speed.