Skip to content

Commit

Permalink
Add satellite ion series to parser and grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
mobiusklein committed Aug 31, 2024
1 parent 77d2382 commit b81952f
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion implementations/python/mzpaf/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
r"""
^(?P<is_auxiliary>&)?
(?:(?P<analyte_reference>\d+)@)?
(?:(?:(?P<series>[axbyczdvw]\.?)(?P<ordinal>\d+)(?:\{(?P<sequence_ordinal>.+)\})?)|
(?:(?:(?P<series>(?:da|db|wa|wb)|[axbyczdwv]\.?)(?P<ordinal>\d+)(?:\{(?P<sequence_ordinal>.+)\})?)|
(?P<series_internal>[m](?P<internal_start>\d+):(?P<internal_end>\d+)(?:\{(?P<sequence_internal>.+)\})?)|
(?P<precursor>p)|
(:?I(?P<immonium>[ARNDCEQGHKMFPSTWYVIL])(?:\[(?P<immonium_modification>(?:[^\]]+))\])?)|
Expand Down
6 changes: 6 additions & 0 deletions implementations/python/tests/test_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ def test_parse_unannotated(self):
assert isinstance(x, Unannotated)
self._matches_schema(x)

def test_satellite_ion_series(self):
base = "da32"
parsed = parse_annotation(base)[0]
assert parsed.series == "da"
assert parsed.position == 32

def test_parse_annotation_complex(self):
base = "b14"
parsed = parse_annotation(base)[0]
Expand Down
2 changes: 1 addition & 1 deletion specification/annotation-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"series": {
"description": "The peptide ion series this ion belongs to",
"type": "string",
"enum": ["b", "y", "a", "x", "c", "z", "d", "v", "w"]
"enum": ["b", "y", "a", "x", "c", "z", "d", "v", "w", "da", "db", "wa", "wb"]
},
"position": {
"description": "The position from the appropriate terminal along the peptide this ion was fragmented at (starting with 1)",
Expand Down
2 changes: 1 addition & 1 deletion specification/grammars/annotation.lark
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ is_auxiliary : "&"

analyte_reference_ : (ANALYTE_REFERENCE) "@"

PEPTIDE_SERIES_SYMBOL : "a" | "x" | "b" | "y" | "c" | "z" | "d" | "v" | "w"
PEPTIDE_SERIES_SYMBOL : "da" | "db" | "wa" | "wb" | "a" | "x" | "b" | "y" | "c" | "z" | "d" | "v" | "w"

ORDINAL : (DIGIT)+

Expand Down
2 changes: 1 addition & 1 deletion specification/grammars/grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@

PeptideIon = Group(
Sequence(
Choice(0, *list(map(Terminal, ("a", "b", "c", "x", "y", "z", "d", "v", "w")))),
Choice(0, *list(map(Terminal, ("a", "b", "c", "x", "y", "z", "da", "db", "v", "wa", "wb")))),
NonTerminal("ORDINAL"),
Optional(
Sequence(
Expand Down
2 changes: 1 addition & 1 deletion specification/grammars/regex_ecma.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion specification/grammars/regex_sre.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
r"""
^(?P<is_auxiliary>&)?
(?:(?P<analyte_reference>\d+)@)?
(?:(?:(?P<series>[axbyczdvw]\.?)(?P<ordinal>\d+)(?:\{(?P<sequence_ordinal>.+)\})?)|
(?:(?:(?P<series>(?:da|db|wa|wb)|[axbyczdwv]\.?)(?P<ordinal>\d+)(?:\{(?P<sequence_ordinal>.+)\})?)|
(?P<series_internal>[m](?P<internal_start>\d+):(?P<internal_end>\d+)(?:\{(?P<sequence_internal>.+)\})?)|
(?P<precursor>p)|
(:?I(?P<immonium>[ARNDCEQGHKMFPSTWYVIL])(?:\[(?P<immonium_modification>(?:[^\]]+))\])?)|
Expand Down
2 changes: 1 addition & 1 deletion specification/grammars/schema_images/Annotation.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b81952f

Please sign in to comment.