Add openclatura enricher for local SMILES-to-IUPAC naming - #87
Open
cmungall wants to merge 3 commits into
Open
Conversation
Adds a new `openclatura` enricher plugin that derives systematic IUPAC names directly from a molecule's structure using the openclatura package (https://github.com/lamalab-org/openclatura), which walks the molecular graph following IUPAC Blue Book 2013 rules. Unlike the existing `pubchem` enricher, this needs no network access and works for structures not present in any database. It fills the IUPAC_name slot, and upgrades `name` only when it still holds a placeholder (e.g. the empirical formula) so a better name from another enricher is never clobbered. Changes: - New OpenclaturaEnricher (src/chemrof/converter/enrichers/openclatura.py) with lazy, graceful import so it is a no-op when the optional package is not installed. - Registered `openclatura` in the enricher registry and documented it in the CLI --enrichers help text. - Declared `openclatura` as an optional dependency (pip install 'chemrof[openclatura]'), marker-gated to python>=3.11 since openclatura requires it while chemrof still supports 3.10. - Tests: dedicated test_enricher_openclatura.py (naming-application logic runs without the optional package) plus registry coverage. Signed-off-by: @dragon-ai-agent Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nkkin3NwvuXRvuS5uka3CP
Contributor
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Add the `openclatura` enricher to the hand-written source docs so it is covered alongside the other enrichers: - src/docs/cli.md: new row in the enricher table. - src/docs/converter.md: new row in the "Available enrichers" table plus a short "Local IUPAC naming (openclatura)" usage section showing install, standalone use, and combined use with pubchem. (docs/ is regenerated from src/docs by `make gendoc`, so only the sources are edited here.) Signed-off-by: @dragon-ai-agent Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nkkin3NwvuXRvuS5uka3CP
Contributor
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Follow-up review pass on the openclatura enricher: - OWL composition: the IUPAC_name slot carries an `owl: AnnotationAssertion` interpretation, so a name derived by the enricher flows straight into OWL output. Add a regression test asserting `AnnotationAssertion(chemrof: IUPAC_name ...)` appears, and document the `--format owl` composition in src/docs/converter.md. No wiring changes were needed for this to work. - Warn-once: when the optional `openclatura` package is not installed, only emit the install hint on the first molecule instead of once per molecule, so batch conversions are not spammed. Point the hint at the extra (`pip install 'chemrof[openclatura]'`). - Add a protocol-conformance test (isinstance check against Enricher). Signed-off-by: @dragon-ai-agent Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nkkin3NwvuXRvuS5uka3CP
Contributor
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
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.
Adds a new
openclaturaenricher plugin that derives systematic IUPACnames directly from a molecule's structure using the openclatura package
(https://github.com/lamalab-org/openclatura), which walks the molecular
graph following IUPAC Blue Book 2013 rules.
Unlike the existing
pubchemenricher, this needs no network access andworks for structures not present in any database. It fills the IUPAC_name
slot, and upgrades
nameonly when it still holds a placeholder (e.g. theempirical formula) so a better name from another enricher is never
clobbered.
Changes:
with lazy, graceful import so it is a no-op when the optional package is
not installed.
openclaturain the enricher registry and documented it inthe CLI --enrichers help text.
openclaturaas an optional dependency (pip install'chemrof[openclatura]'), marker-gated to python>=3.11 since openclatura
requires it while chemrof still supports 3.10.
runs without the optional package) plus registry coverage.
Signed-off-by: @dragon-ai-agent
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01Nkkin3NwvuXRvuS5uka3CP