Skip to content

Add offline WURCS-to-SMILES glycan translator and wire it into both pipelines - #10

Draft
m-crown wants to merge 1 commit into
feature/kegg-bulk-source-priorityfrom
feature/offline-glycan-translation
Draft

Add offline WURCS-to-SMILES glycan translator and wire it into both pipelines#10
m-crown wants to merge 1 commit into
feature/kegg-bulk-source-priorityfrom
feature/offline-glycan-translation

Conversation

@m-crown

@m-crown m-crown commented Aug 9, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds nextflow/bin/wurcs_to_iupac.py: an offline translator from WURCS glycan notation to GlyLES-compatible IUPAC-condensed notation, built on glypy's structured WURCS parse.
  • Adds get_smiles_from_wurcs_offline() to utils.py, wrapping the translator + glyles conversion with a timeout guard (GlyLES is known to hang on malformed input instead of failing fast).
  • Wires it into both glycan-resolution paths:
    • get_ec_information.py (cognate-ligand master set, GlyTouCan-sourced): added as a fallback after the existing live glycoct/CSDB chain — that live chain is confirmed dead (0% success, GlyTouCan's API stopped returning glycoct).
    • process_all_pdb_contacts.py (PDB bound-entity glycans): made the primary path, live chain now only runs as fallback — the live chain still works here but carries real reliability risk (unthrottled, no retry, HTML-scraped CSDB endpoint).
  • Adds glypy/glyles to nextflow/envs/procoggraph.yaml.

Benchmarked against real data (see docs/iupac_translator_plan.md for full methodology): 0% → 89.1% on the real cognate-ligand master set glycans with a GlyTouCan ID; 96% on a real sample of PDB-deposited glycan structures.

Stacked on #9 (feature/kegg-bulk-source-priority) — this PR's diff is scoped to just the glycan translation work.

Test plan

  • nextflow/bin/tests/test_wurcs_to_iupac.py — translator regression tests (13 assertions across known-good structures, furanose-suffix handling, undefined-anomer handling, and confirmed-unsupported substituents)
  • nextflow/bin/tests/test_utils_glycan_offline.py — offline helper + Context B fallback-wiring tests (mocked, no live network calls)
  • nextflow/bin/tests/test_get_ec_information_glycan_fallback.py — Context A backfill-masking logic validated in isolation
  • Full pipeline run against real data to confirm the benchmarked success rates hold in production

🤖 Generated with Claude Code

…ipelines

Replaces the currently-broken live GlyTouCan glycoct chain (confirmed 0%
success, GlyTouCan's API stopped returning glycoct) with an offline
glypy -> IUPAC-condensed -> GlyLES route for the cognate-ligand master set
(get_ec_information.py), added as a fallback after the existing live
chain. For PDB bound-entity glycans (process_all_pdb_contacts.py), where
the live chain still works but carries real reliability risk (unthrottled,
no retry, HTML-scraped CSDB endpoint), the offline route is used as the
primary path instead, falling back to the live chain only on failure.

Benchmarked (see docs/iupac_translator_plan.md for full methodology):
- cognate-ligand master set: 0% live chain -> 89.1% offline (of glycans
  with a GlyTouCan ID at all)
- PDB-deposited glycans: 96% offline vs. a working-but-fragile live chain

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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