feature: add proforma.modify_with#196
Conversation
|
Thank you! I noticed a couple places that seemed to need fixing (I hope this makes sense, otherwise feel free to flag/roll back) and then I wanted to add some tests. >>> for pf in proforma.ProForma.parse('[Oxidation|Position:M]^2?PEMPTIMDE').peptidoforms():
...: print(pf)
...:
PEM[Oxidation|Position:M]PTIM[Oxidation|Position:M]DE
PEM[Oxidation|Position:M]PTIM[Oxidation|Position:M]DEThis shows why a test I added is currently failing. I think the reason is simply that the Proforma parser supports the unclocalized modification count by adding multiple copies of the modification tag to the properties, and then the combinator treats them as distinct. Do you see a way to fix this? This is not a problem with the new function, as you can see, but rather with the interplay of However, what I was initially trying to do was to see if we can support the count in the |
|
Well, that's a reminder to me to refresh my fork more often. Keeping proper track of repeated configurations was simple enough. The memory burden of tracking seen configurations should be small outside of some high complexity cases like trying to place dozens of different modifications on a full length protein sequence, but that's a bad case either way. I think the tests are failing due to a network timeout unrelated to ProForma. |
|
Thanks! This is indeed a simple solution (I was thinking along the lines of building a So with this change the semantics of In [6]: seq = "[Phospho|Position:S|Position:T]^3?EMEVTSESPEK"
In [7]: pf = ProForma.parse(seq)
In [8]: for ppf in pf.proteoforms(include_unmodified=True):
...: print(ppf)
...:
EMEVTSESPEK
EMEVT[Phospho|Position:S|Position:T]SESPEK
EMEVTS[Phospho|Position:S|Position:T]ESPEK
EMEVTSES[Phospho|Position:S|Position:T]PEK
EMEVT[Phospho|Position:S|Position:T]S[Phospho|Position:S|Position:T]ESPEK
EMEVT[Phospho|Position:S|Position:T]SES[Phospho|Position:S|Position:T]PEK
EMEVTS[Phospho|Position:S|Position:T]ES[Phospho|Position:S|Position:T]PEK
EMEVT[Phospho|Position:S|Position:T]S[Phospho|Position:S|Position:T]ES[Phospho|Position:S|Position:T]PEKThis is great and perhaps One thing that puzzles me is that this behavior does not seem to extend to In [16]: seq = "[Phospho|Position:S|Position:T|comup|Limit:2]^2?EMEVTESPEK"
...: pf = ProForma.parse(seq)
In [17]: for ppf in pf.proteoforms(include_unmodified=False):
...: print(ppf)
...:
EMEVT[Phospho|Position:S|Position:T|CoMUP|Limit:2][Phospho|Position:S|Position:T|CoMUP|Limit:2]ESPEK
EMEVT[Phospho|Position:S|Position:T|CoMUP|Limit:2]ES[Phospho|Position:S|Position:T|CoMUP|Limit:2]PEK
EMEVTES[Phospho|Position:S|Position:T|CoMUP|Limit:2][Phospho|Position:S|Position:T|CoMUP|Limit:2]PEK
In [18]: for ppf in pf.proteoforms(include_unmodified=True):
...: print(ppf)
...:
EMEVTESPEK
EMEVT[Phospho|Position:S|Position:T|CoMUP|Limit:2]ESPEK
EMEVTES[Phospho|Position:S|Position:T|CoMUP|Limit:2]PEK
EMEVT[Phospho|Position:S|Position:T|CoMUP|Limit:2]ES[Phospho|Position:S|Position:T|CoMUP|Limit:2]PEKIn this case including the unmodified peptidoform also excludes the two colocalized peptidoforms. |
|
Thank you for adding those extra test cases. I'll think about how I can improve the API for your first point about flexible upper bound on the number of times a rule is applied. To your point about a |
|
The refactor to use a I added a new |
|
Thank you! I am totally fine leaving the co-localization case for later as long as this limitation is documented. I am still getting results contrary to my intuition playing around with the free So two questions about this are:
Perhaps with the dict input we should just assume P.S. The current assertions in the test don't have to stay this way, that was just me trying to reason about this. |
|
I see your point. I'll implement what you suggested originally and see how it goes. |
…lein/pyteomics into feature/more_combinators
|
Moving Strange that the PROXI test failure is still not processed, I can try to look into that but it should not deter us. |
|
I agree. When I tried to push that logic into the I'm still not completely happy with how |
part of #194