Migrate parser to BRENDA 2026 JSON format#14
Merged
Merged
Conversation
BRENDA now distributes the database as a structured JSON document (schema 2.0.0) instead of the legacy flat text file. Reimplement BRENDA/Reaction to parse the JSON while preserving the public API, and surface the newly available structure (UniProt/GenBank accessions, structured citations with PMIDs, reversibility, synonyms, etc.). - parser.py: JSON-based BRENDA/Reaction; loader accepts .json/.json.gz/.json.tar.gz - constants.py: map fields to JSON schema names; add DATA_FIELDS - tests: re-baseline against committed tests/fixtures/brenda_sample.json - toolchain: Python ^3.10, numpy>=1.24, pandas>=1.5, drop importlib-metadata, bump to 0.1.0, refresh CI matrix (3.10-3.12) - docs: README, examples notebook, JOSS paper, CITATION.cff Behavior changes: Reaction(...) takes the per-EC dict (not text); Reaction.name is verbatim (no more str.capitalize()); BRENDA.fields describes JSON field names; Reaction.references returns citation strings (structured records via the new .bibliography). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
BRENDA's JSON still embeds legacy annotations inside reaction-string
values. Splitting reaction sides on a bare "+" dropped ion charges
(H+ -> H, NAD+ -> NAD), and |...| pipe comments and <ref> tags leaked
into compound names.
- add _clean_reaction_string(): strips |...| comments, {...} reversibility
and numeric <n,n> reference tags, preserving chemical notation such as
glycosidic "(1->4)" bonds and polymer subscripts ([...]n+m)
- split reaction sides on " + " so ionic charges and polymer "+" stay
attached to the compound name (fixes filter_by_substrate/product/compound
for ions, e.g. "NAD+")
- fold substrates_products pipe comments into `comment` instead of
discarding them
Re-addresses the parsing issues reported in #13 against the JSON parser
(ion-charge loss and |...| comment leakage). The parentheses issue (#12)
is already handled by the structured JSON `comment` field.
Co-authored-by: Clark Pohl <clarklettuce@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jun 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BRENDA now distributes the database as a structured JSON document (schema 2.0.0) instead of the legacy flat text file. Reimplement BRENDA/Reaction to parse the JSON while preserving the public API, and surface the newly available structure (UniProt/GenBank accessions, structured citations with PMIDs, reversibility, synonyms, etc.).
Behavior changes: Reaction(...) takes the per-EC dict (not text); Reaction.name is verbatim (no more str.capitalize()); BRENDA.fields describes JSON field names; Reaction.references returns citation strings (structured records via the new .bibliography).