orthonym.assembly.stereo_composed_offer#

Note

Internal API. Names and behaviour may change between releases.

The flat name of a molecule with the input’s stereo composed on it: the last offer of the best-effort tier.

A molecule with stereo is sometimes left without a name by every path of the best-effort tier although the same structure without its stereo is named (a ring system with stereocentres that the producers decline, where the run on the stereo-free drawing names it). The stereo-free name is a name of the constitution; the stereo of the input can be composed onto it in OPSIN’s own numbering of that name (namer._try_compose_input_stereo, the stereo-omission reclaim), and the composed name is a name of the input when OPSIN reads it back to the input’s full InChIKey.

It is an offer, not a return (a project rule): it is made only when every other path of the best-effort tier, the other offers of assembly/default_tier_offer.py included, has left the molecule without a name, so no name that ships changes. It runs once for the caller’s own call, after the retries of that call, as the other offers do (default_tier_offer.default_tier_row_for calls:func:stereo_composed_row), so name, name_compound, name_with_confidence and name_tiered agree.

The stereo-free structure is named by an engine of the tier of the caller (general_tier_engine), an outermost run of its own with the hang budgets of one compound, and the whole offer runs inside the caller’s own wall-clock limit (--time-limit: WallClockTimeout is a BaseException and is not caught here). The stereo-free structure has no stereo, so it is offered nothing of this kind.

What ships is checked more than the composition checks it: OPSIN reads the composed name back to the input’s full InChIKey with the radical graph and the protonation site of the input (namer._shipped_name_round_trip), the exact isomeric comparison of the canonical SMILES that the other composed names pass (namer.Orthonym._rt_match: it sees the E/Z and ring-ylidene configurations the key cannot), for an input with a lone-pair stereocentre the configuration check of the exit (namer._lone_pair_configuration_verified), and the exit check of every other name (Orthonym._exit_round_trip_check: a name OPSIN reads as ambiguous is withdrawn, validation.opsin_ambiguity), which the offer must pass itself because name_with_confidence does not apply it to an offered name. An input with enhanced stereo groups (an AND or OR group of CXSMILES, |&1:1|) is never offered: its centres are not absolute, and a descriptor would assert that they are. Any other outcome leaves the abstention as it was, with the provenance and the abstention record of the caller.

The name is not the PIN: NAMING OF STEREOISOMERS (the Blue Book), sentence:44643, “In preferred IUPAC names, stereodescriptors are placed immediately at the front of the part of the name to which they relate”, and “They are preceded by a numerical or letter locant to describe the position of the stereogenic unit”. The composed name cites every descriptor at the front of the complete name, in the locants of the stereo-free name (when that name does not read back, this offer, and only this one, has rules/prefix_stereo.py place each descriptor at the front of the part it relates to instead), so a descriptor of a substituent can repeat a locant of the parent. A repeated locant does not give the position of a stereogenic unit, and the name then rests on the order in which OPSIN reads the descriptors: (3S,3R,...) is read to the input, and (3R,3S,...) to a diastereomer. A composed name that cites a locant more than once is therefore offered only when (1) every descriptor at that locant is the same (4S,4S,4S: whichever unit takes which descriptor, the structure is one) and (2) the descriptors state every stereo unit of the input, which has no unspecified one (repeated_locants_are_one_structure(): an unspecified centre that shares the locant would make the equal descriptors ambiguous). Any other name with a repeated locant is declined, and the molecule keeps its abstention. The row is labelled by the rules of Orthonym._tier_row_and_pin_form for a name of the general engine whose gate outcome is stereo_omission_full_key_recomposed (systematic_verified, is_pin False), and the producer is the one that built the stereo-free name.

orthonym.assembly.stereo_composed_offer.stereo_groups(name)#

The groups of stereodescriptors of name: each parenthesised group all of whose comma-separated items are (locant, descriptor) pairs, as the list of its pairs, in the order of the name. Any other group (a substituent name, an indicated hydrogen) is not one.

orthonym.assembly.stereo_composed_offer.repeated_locants_are_one_structure(name, smiles)#

False when name cites a locant more than once in a group of stereodescriptors and does not name one structure by it: True when no locant is repeated; else only when every descriptor at each repeated locant is the same and the descriptors of the name are as many as the stereo units of smiles, all of which are specified (the module docstring:, the Blue Book).

orthonym.assembly.stereo_composed_offer.has_stereo_groups(structure)#

True when structure (a SMILES string, CXSMILES included, or an RDKit molecule) has an enhanced stereo group (AND, OR): its centres are not absolute.

orthonym.assembly.stereo_composed_offer.stereo_free_smiles(smiles)#

The canonical SMILES of smiles with every stereo element removed, or None when that is the SMILES of the input as it stands (a molecule with no stereo, and so the stereo-free run itself) or when RDKit cannot read smiles. Isotopes and charges stay: only stereo is removed.

orthonym.assembly.stereo_composed_offer.stereo_composed_row(namer, smiles)#

The row namer offers a molecule it left without a name: the name of the stereo-free structure with the stereo of smiles composed on it, when that name reads back to the input (see the module docstring); else None. smiles is a SMILES string or an RDKit molecule, as for name_tiered. Best-effort tier only. Never raises (the abstention stands).