Closed MatthewThe closed 5 months ago
The behaviour has changed since you opened this issue. There is an AssertionError
raised now after the return value of _get_modifications
has been checked. https://github.com/wilhelm-lab/spectrum_fundamentals/blob/4d587fd4831f7079a3d37fa756fa1d4431f1318c/spectrum_fundamentals/fragments.py#L111-L127
The reason you got this TypeError
is because the function returns None
in case of an unknown modification.
In order to fix this everywhere, I propose moving the check into the function itself instead of returning None
.
Skipping in the parent functions is a question of whether you want the program to exit entirely or process the remainder of the sequences. We can handle this by wrapping the required parent functions into try except blocks and handle this accordingly in the except/finally block while raising the exception in _get_modifications
. This would be the proper way of handling this. We can still keep the logger output, but it should definitely be an error level and not just info, as it is right now.
Describe the bug
_get_modifications()
infragments.py
returnsNone
when it encounters a sequence with an unknown modification:https://github.com/wilhelm-lab/spec_fundamentals/blob/3407711ab5b2d46f3c5702433bb869d251219340/fundamentals/fragments.py#L30-L34
It does raise a
logger.info
message, but the upstream functions do not handle this behavior, e.g. the functioninitialize_peaks()
infragments.py
errors out without a useful error.To Reproduce
Steps to reproduce the behavior:
MODIFIED_SEQUENCE
column, e.g.AALDSIN(as)ELPENIL
Expected behavior
We can either skip such sequences in the parent functions or raise an exception inside
_get_modifications()
that the parent function can choose to deal with or not.System [please complete the following information]: