orthonym.rules.steroid_stereo#

Note

Internal API. Names and behaviour may change between releases.

Steroid ring-face α/β configurational descriptors (IUPAC, a phase -02).

Generate ring-face α/β descriptors (3beta, 5alpha) for steroid scaffolds by INVERTING OPSIN’s own forward parser. OPSIN parses α/β names by applying a parity to a ring stereocentre from its alphaBetaClockWiseAtomOrdering (ABO) — see opsin StereochemistryHandler.applyAlphaBetaStereochemistryToStereoCentre (Java 842-918) and SMILESWriter.atomParityToSmiles (880-952). This module runs that algorithm backwards: read the molecule’s RDKit chiral parity at each ABO ring locant and map it back to α/β. Because it inverts OPSIN’s own data + algorithm, the emitted descriptor round-trips through OPSIN by construction .

Sign convention : empirically pinned this build — OPSIN parity +1 → beta, -1 → alpha. The 6-structure parity unit test is the tripwire; if a future RDKit upgrade flips neighbour-ordering semantics it fails loudly and _SIGN is flipped ONCE, globally — never per-molecule.

Root-cause-only : no postprocessor, no regex on the existing (3R,5S,...) string, no seniority/dispatch edit. All logic is parity arithmetic + dict lookups + set math.

orthonym.rules.steroid_stereo.alpha_beta_at(mol, locant, loc2idx, idx2loc, ringorder)#

Return ‘alpha’/’beta’ for the ring stereocentre at IUPAC locant, or None if it is not a tetrahedral centre / unresolvable (→ triggers no-mix fallback if cited).

Inverts opsin StereochemistryHandler.applyAlphaBetaStereochemistryToStereoCentre: atomRefs4 = [prev-in-ABO, classified-neighbour, classified-neighbour, next-in-ABO]; parity +1 → beta, −1 → alpha.

orthonym.rules.steroid_stereo.collect_steroid_alpha_beta(mol, scaffold_info, numbering)#

Return {‘ring_ab’: {locant: ‘alpha’/’beta’}, ‘side_rs’: [(locant, cip),…]} for a steroid, or None to signal the per-molecule no-mix fallback .

  • ring_ab cites: C-5 when chiral (D-04a) ∪ substituent/suffix-bearing ring stereocentres (D-04b) ∪ ring stereocentres inverted vs the implied parent (D-04c). Natural-config fixed stereocentres (bridgeheads C-8/9/10/13/14, C-17, etc.) are suppressed.

  • side_rs keeps acyclic side-chain stereocentres (C-20/22/24/25 — NOT in the ABO) as R/S, a separate leading block ; ring atoms are never passed into this collection.

  • Returns None (whole-molecule R/S fallback) iff any DEFINED ring stereocentre cannot be resolved to α/β — never mixes ring α/β with ring R/S. An sp2 C-5 (Δ5) or sp2 ketone carbon is not a defined stereocentre → never a fallback trigger (Pitfall 1).