Skip to content

feat: add GlyCAM IUPAC parser - #25

Merged
fubin1999 merged 7 commits into
mainfrom
glycan-iupac
Jul 1, 2026
Merged

feat: add GlyCAM IUPAC parser#25
fubin1999 merged 7 commits into
mainfrom
glycan-iupac

Conversation

@fubin1999

@fubin1999 fubin1999 commented Jul 1, 2026

Copy link
Copy Markdown
Member

Summary

Add parse_glycam_iupac() for GlyCAM IUPAC strings and export it from glyparse.

Details

  • Normalize GlyCAM IUPAC residue tokens into IUPAC-condensed notation, including D/L configuration markers, pyranose/furanose ring markers, terminal -OH, and residue modifiers such as [6S] and [9A].
  • Delegate graph construction to the existing IUPAC-condensed parser after normalization.
  • Accept explicit alphabetic reducing-end caps such as -OME; these are normalized to the regular reducing-end form because glyrepr does not represent the terminal moiety separately.
  • Accept comma-separated modifier lists inside one GlyCAM bracket, such as [2NAc,6S], and normalize them into IUPAC-condensed modifier suffixes.
  • Add focused parser tests for simple, branched, modified, representative corpus-derived examples, and NA behavior.
  • Use only successful GlyCAM test sequences that have exact non-NA reference answers in docs/glycan_sequences_iupac_condensed.csv.
  • Add representative fixed test cases for sialylated LacNAc, core fucose, uronic acid, pyranose Xyl, polysialic branching, Xyl chains, GlcNAc-7-linked Neu5Ac, and Gal-8/Gal-9-linked Neu5Ac patterns.
  • Add a NEWS.md entry for the new parser.

Verification

  • Rscript -e 'devtools::document()'
  • Local provenance audit against docs/glycan_sequences_glycam_iupac.csv and docs/glycan_sequences_iupac_condensed.csv -> all 15 successful GlyCAM test sequences have exact non-NA IUPAC-condensed references
  • Local manual syntax check for review-only forms absent from the CSVs: DGlcpb1-4DGlcpb1-OME, DGlcp[2NAc,6S]b1-OH, and DGalpNAc[4S,6S]b1-OH
  • air format R/parse-glycam-iupac.R tests/testthat/test-parse-glycam-iupac.R
  • Rscript -e 'devtools::test(filter = "parse-glycam-iupac")' -> 7 passed, 0 failed, 0 warnings, 0 skipped
  • Rscript -e 'devtools::test()' -> 953 passed, 0 failed, 0 warnings, 0 skipped

Copilot AI review requested due to automatic review settings July 1, 2026 04:56
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class support for parsing GlyCAM IUPAC glycan strings by normalizing them into IUPAC-condensed notation and then reusing the existing IUPAC-condensed parser, with accompanying documentation and regression tests against the published GlyCAM corpus.

Changes:

  • Introduces parse_glycam_iupac() (plus internal conversion helpers) that converts GlyCAM residue tokens/modifiers and delegates graph construction to parse_iupac_condensed().
  • Adds unit tests for simple/branched/modified glycans and corpus-level regression coverage including NA and on_failure semantics.
  • Exports the new API and ships generated Rd docs and an initial (header-only) parse-failures report CSV.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/testthat/test-parse-glycam-iupac.R Adds focused unit tests plus a chunked corpus regression test ensuring GlyCAM parses and matches IUPAC-condensed references.
R/parse-glycam-iupac.R Implements parse_glycam_iupac() and normalization from GlyCAM IUPAC to IUPAC-condensed prior to parsing.
NAMESPACE Exports parse_glycam_iupac.
man/parse_glycam_iupac.Rd Generated documentation for the new exported function.
docs/glycam_iupac_parse_failures.csv Adds the expected parse-failures report file (currently header-only).
Files not reviewed (1)
  • man/parse_glycam_iupac.Rd: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fubin1999

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bd45e6add7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread R/parse-glycam-iupac.R Outdated
Comment thread R/parse-glycam-iupac.R Outdated
@fubin1999
fubin1999 merged commit a251a5f into main Jul 1, 2026
13 checks passed
@fubin1999
fubin1999 deleted the glycan-iupac branch July 1, 2026 05:50
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.

2 participants