orthonym.perception.lipids#

Note

Internal API. Names and behaviour may change between releases.

Lipid backbone detection for the backbone-aware assembler (a phase, -01).

detect_lipid_backbone(mol) is a PURE, hard-gated structural deriver: it recognizes the three lipid backbone families and classifies each backbone position, or returns None on any dirty/unrecognized decoration so the molecule defers to the general pipeline (, fail-safe → zero non-lipid regression). It is the acyclic generalization of the Phase-176 recognize_sugar_skeleton ring deriver.

The detector does NOT name anything — it produces a structured BackboneMatch that the Form-B assembler (rules/lipids.py) consumes. The only mutation is the idempotent CIP-label assignment (the accepted sugar-deriver seam).

Families (Blue Book:
  • “glyceride” — propane-1,2,3-triyl core, O’s acylated / phospho / free-OH

  • “phospholipid” — glyceride where one primary O is a phosphate diester to a head group

  • “sphingolipid” — long-chain 2-amino-1,3-diol (sphinganine/sphingosine); N-acyl = ceramide

class orthonym.perception.lipids.BackboneMatch(family, core_atoms, position_locants, sites, backbone_atom_to_locant, cip=<factory>, extra=<factory>)#

Bases: object

Structured result of lipid backbone detection (consumed by rules/lipids.py).

family: str#
core_atoms: tuple#
position_locants: dict#
sites: dict#
backbone_atom_to_locant: dict#
cip: dict#
extra: dict#
orthonym.perception.lipids.detect_lipid_backbone(mol)#

Detect a clean lipid backbone, or return None (hard gate / fail-safe,).