orthonym.rules.oligosaccharides#

Note

Internal API. Names and behaviour may change between releases.

disaccharide / oligosaccharide whole-structure assembler (a phase, -04,).

A NEW module that reasons over the WHOLE multi-ring sugar structure to emit the IUPAC 2013 carbohydrate-specific name forms the generic decomposition path cannot produce:

  • glycosylglycose when a unit’s anomeric carbon bears a free hemiacetal -OH (the reducing end) -> reducing unit is the glycose parent (-ose), the other unit(s) are glycosyl substituents (-osyl): alpha-D-glucopyranosyl-(1->4)-D-glucopyranose (maltose);

  • glycosyl glycoside when NO unit has a free hemiacetal (both anomeric carbons are in the glycosidic linkage, e.g. sucrose): parent chosen by , cited -oside: beta-D-fructofuranosyl alpha-D-glucopyranoside.

The assembler does NOT route through decomposition/ (which emits the substitutive bis(glycosyloxy)... form, structurally wrong for sugars). It detects the units + the inter-unit glycosidic bond directly with a RING-RESTRICTED SMARTS over the whole structure (Pitfall 4 — the aglycone carbon must be in a SECOND recognized sugar ring, so a single monoglycoside (a phase) is NOT pulled in), splits each unit with the proven conjugate_controller._extract_capped_sugar primitive (FragmentOnBonds + restore the anomeric -OH; a rules/ sibling, not a decomposition/ import), names each per its OWN ring via the lookup_sugar -> recognize_sugar_skeleton -> name_monosaccharide_systematic cascade (/ — never inherit an anomer across units), derives the directional (c->c') ASCII linkage locants by ring-walking from each unit’s anomeric carbon , enforces the no-silent-drop completeness invariant over the ORIGINAL mol’s heavy atoms reconciling the single shared bridging O (, Pitfall 7), and gates the assembled name on an OPSIN round-trip fallback before shipping – fail-OPEN when Java/OPSIN is absent on the PIN/default tier (unchanged), fail-CLOSED on the best-effort tier (.1: that tier has no downstream backstop, so this gate is the only thing standing between an unverified name and output).

Root-cause-only (the contributor guide): no postprocessor, no regex / string surgery on any derived base, no per-molecule hardcode. Every gate failure returns None so the molecule cascade-continues to the existing pipeline (fail-closed,). The input mol is never mutated (the unit split copies via the reused capper).

Blue Book: , glycosyl glycoside ,

glycosylglycose , parent choice , glycosyl groups -ose -> -osyl .

orthonym.rules.oligosaccharides.name_disaccharide(mol)#

Public entry : name a linear di/oligo-saccharide by the form.

Tries the proven binary disaccharide assembler first (byte-identical to the prior behaviour); if it declines, falls back to the general linear oligosaccharide namer (W6B-T11) which handles 3+ unit reducing chains and the 1->6 links the binary ring-restricted SMARTS misses. None (fail-closed) for any out-of-scope topology.

orthonym.rules.oligosaccharides.name_linear_oligosaccharide(mol)#

Name a LINEAR reducing oligosaccharide (>=2 units) by: glycosyl-(1->c')-[glycosyl-(1->c')-]n-glycose (maltotriose -> alpha-D-glucopyranosyl-(1->4)-alpha-D-glucopyranosyl-(1->4)-D-glucopyranose; isomaltose 1->6). Fail-closed (None) on: a BRANCHED chain (a unit accepts >1 glycosyl), a NON-reducing chain (no free-hemiacetal parent -> glycoside, deferred), >1 reducing unit, an unrecognized unit, a dropped atom, or an RT-fail. Each unit is recognized from its OWN isolated ring ; the whole name is OPSIN-RT gated .

orthonym.rules.oligosaccharides.name_branched_oligosaccharide(mol)#

Name a BRANCHED reducing oligosaccharide (>=3 units, where a single unit accepts MORE THAN ONE glycosyl, e.g. alpha-D-glucopyranosyl-(1->4)-[alpha-D-glucopyranosyl-(1->6)]-D-glucopyranose.

Builds the glycosyl TREE rooted at the unique free-hemiacetal reducing unit and renders it recursively: at each branch point the highest-locant child continues the main chain inline, every other child is a bracketed side chain cited before it. Fail-closed (None) on: no reducing parent (non-reducing -> the glycoside namer), a cycle, an unrecognized unit, a dropped atom, or an RT-fail. 0-wrong via the OPSIN-RT gate ; it only fires where the linear namer already declined (a branch), so it cannot regress a passing name.

orthonym.rules.oligosaccharides.name_nonreducing_oligosaccharide(mol)#

Name a LINEAR NON-REDUCING oligosaccharide of >=3 units, e.g. raffinose -> alpha-D-galactopyranosyl-(1->6)-alpha-D-glucopyranosyl beta-D-fructofuranoside.

Scope (slice 1, fail-closed outside it): exactly ONE glycosyl-glycoside central bond (an anomeric<->anomeric bridge), of whose two units exactly one is a LEAF (no other glycosidic link) -> the glycoside PARENT; the other roots a single LINEAR glycosyl chain covering every remaining unit. Both the completeness invariant (every heavy atom consumed) and the OPSIN-RT gate (0-wrong) must pass. Branched chains, >1 central bond, or both-central-units-branched decline here.