Skip to content

feat: add native glycan SMILES parser - #63

Open
fubin1999 wants to merge 4 commits into
mainfrom
feat/native-smiles
Open

fubin1999 wants to merge 4 commits into
mainfrom
feat/native-smiles

Conversation

@fubin1999

Copy link
Copy Markdown
Member

Summary

  • Add parse_smiles() using native R/C++ without an external chemistry runtime.
  • Decode atom-order-aware tetrahedral stereochemistry, sugar rings, O-linked glycan trees, supported modifications and reducing-end alditols; retain unknown stereochemistry rather than guessing it.
  • Handle equivalent atom traversals and symmetric alditol numbering deterministically. Reject unsupported chemistry rather than dropping atoms.
  • Add documentation, provenance, 543 real GlyGen paired fixtures, 230 equivalent-SMILES fixtures, 162 symmetric-alditol regression expressions, and a reproducible full-dataset validation script.

Validation

  • Full test suite passed.
  • Complete R CMD check: 0 errors, 0 warnings, 0 notes. After a network interruption the final check used installed dependencies and a local empty repository index; remote repository availability was not checked.
  • GlyGen 2.12.1: 15,788 same-accession SMILES/WURCS pairs; parse_wurcs() accepts 15,712 and parse_smiles() accepts 15,710 (99.987% of the WURCS-success set).
  • 15,708 paired results have equivalent residue graphs, accounting for conventional roots and symmetric alditol numbering. The other two (G20934UH/G71958ED) have an explicit relative anomer in source WURCS but unspecified stereochemistry in source SMILES; tests ensure no anomer is invented.
  • Randomized equivalent SMILES across the full dataset preserve acceptance and output.

Deliberate limits

This is a defined glycan subset, not a general-purpose chemical SMILES reader. Charges, isotopes, separate explicit hydrogen atoms, aromatic atoms, disconnected salts, aglycones, unsupported open-chain structures, non-O links, cyclic residue graphs, and unknown modifications are rejected. SMILES is not added to automatic format detection.

Two WURCS-success records remain rejected rather than copied lossily: G27289CV needs non-root alditol state, and G89097YO contains a non-anomeric C2–O–C3 bridge. Correct support needs a representation-model extension. Existing WURCS parsing is unchanged.

Data: GlyGen 2.12.1 GLY_000291/GLY_000292, CC BY 4.0; attribution and source URLs are included with fixtures. No data lookup or external chemistry runtime is required at runtime.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 289 complexity · 0 duplication

Metric Results
Complexity 289
Duplication 0

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.

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T14:43:42.525184Z 50d32f2 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 50d32f2dac

ℹ️ 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 tools/validate-smiles-glygen.R Resolved
Comment thread .Rbuildignore Resolved
Comment thread DESCRIPTION Resolved
Comment thread NEWS.md Resolved
Comment thread NEWS.md Resolved
Comment thread README.md Resolved
Comment thread README.md Resolved

This branch has not been deployed

No deployments
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