Skip to content

Migrate parser to BRENDA 2026 JSON format#14

Merged
Robaina merged 2 commits into
masterfrom
brenda-json
Jun 14, 2026
Merged

Migrate parser to BRENDA 2026 JSON format#14
Robaina merged 2 commits into
masterfrom
brenda-json

Conversation

@Robaina

@Robaina Robaina commented Jun 14, 2026

Copy link
Copy Markdown
Owner

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).

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>
@Robaina Robaina self-assigned this Jun 14, 2026
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>
@Robaina
Robaina merged commit 8810733 into master Jun 14, 2026
8 checks passed
@Robaina
Robaina deleted the brenda-json branch June 14, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant