orthonym.rules.cage_numbering#

Note

Internal API. Names and behaviour may change between releases.

The numbering criteria of a von Baeyer cage that follow the detachable prefixes’ locant set.

VonBaeyerAnalyzer._locant_criteria_key ranks the numberings that leaves open on

and on (c) principal groups, (e) unsaturation and (f) the locant set of the

detachable prefixes. When those tie, the Blue Book has four more criteria, (g) to (j), and an engine that stops at (f) leaves the choice to the input atom order, so one molecule gets one name per SMILES spelling (3-bromo-5-chloro... or 5-bromo-3-chloro... for one cage).

NUMBERING (the Blue Book), after (f) “detachable alphabetized prefixes, all considered

together in a series of increasing numerical order” (:3300):

  • (g) (:3307) “lowest locants for the substituent cited first as a prefix in the name”, with 1-methyl-4-nitronaphthalene (PIN) (not 4-methyl-1-nitronaphthalene). The prefixes are cited in alphanumerical order, alpha_sort_key); after the first, the next cited is compared in turn.

  • (h) (:3319) “When a choice is needed between the same skeletal atom in different valence states, the one in a nonstandard valence state is assigned the lower locant… the one in the higher valence state” (the atoms that carry a cited lambda, ring_replacement.vb_lambda_for_atom).

  • (i) (:3340) isotopically modified atoms take the lowest locants considered together as a set, then the higher atomic number, then the higher mass number.

  • (j) (:3346) “the lower locant is assigned to CIP stereodescriptors Z, R, M, and r (pseudoasymmetry) that are preferred to E, S, P, and s” (naming_utils.cip_locant_rank_key).

The Blue Book decides nothing beyond (j); the canonical atom ranks that come last only stop the atom order from deciding. Numberings still tied after (g) to (j) that are related by an automorphism of the whole structure give one name; when they are not, a criterion that is not encoded here (the citation order of the components of a spiro system, say) tells them apart, and the first keeps the choice the analysis made.

(j) reads the stereodescriptors of the branches as well as those of the cage: 1-[(2R)-butan-2-yl]-3-[(2S)-butan-2-yl]benzene (PIN) (:3399, an example of (j)) takes the R prefix to the lower locant. A descriptor of a branch is keyed at the locant of the cage atom that carries the branch, then by its place in the name of the branch ((2R,3S)-... cites 2R before 3S), after the descriptors of the cage atom itself.

Cost. Naming a branch is the full substituent cascade, which can itself analyse a cage (a branch that holds a carbazole, say), so the criteria are applied lazily: (g) needs names only when the tied numberings place DIFFERENT branches differently, which a name-free signature of each branch (its canonical SMILES, the order of the bond to the cage and, for a branch that holds stereo, its isomeric SMILES) tells first; the CIP labels are computed only for numberings that still tie.

What the Blue Book would decide but this module cannot. A branch of more than MAX_NAMED_BRANCH_ATOMS heavy atoms is not named, so (g) (and the descriptors of a branch at (j)) are unknown for that tie; a branch that loops back into the cage (a spiro component) has no prefix name at all; CIP labels may be unavailable. When such a criterion is unknown and the tied numberings are not related by an automorphism of the whole structure, the numbering is chosen by the canonical atom order of the analysis, which does not depend on the input atom order, and the descriptor is marked numbering_certified = False: the name is not a preferred name (the caller records it as a non-PIN fragment) because the Blue Book may prefer the other numbering.

orthonym.rules.cage_numbering.MAX_NAMED_BRANCH_ATOMS = 30#

the cascade that names it is the cost the tie-break must not multiply, and a tie that only (g) could break and that holds such a branch is left to (h) to (j), the canonical atom order of the analysis, and a label that says it is not a preferred name.

Type:

a branch larger than this is not named for (g)

orthonym.rules.cage_numbering.cage_branches(mol, ring_atoms, suffix_pairs, substituent_atoms=None)#

The detachable prefixes of the cage: {cage atom: [(signature, branch atoms, first atom)]}.

A branch is a prefix unless its first atom is the principal characteristic group itself (a (cage atom, first atom) pair of suffix_pairs), or lies outside substituent_atoms (the cage is named as a substituent and that is its parent). signature identifies the branch without naming it: (order of the bond to the cage, canonical SMILES, stereo), so equal signatures are equal branches and two branches that differ only by stereo are two. None when a branch loops back into the ring, a second bond joins it to its cage atom or RDKit cannot write it, so that the caller never ranks a partial set of prefixes.

orthonym.rules.cage_numbering.aromatic_view(mol)#

mol with its aromaticity perceived again: the cage is analysed on a kekulized copy, in which a phenyl branch is a cyclohexatrienyl one and would be cited under c instead of p.

orthonym.rules.cage_numbering.choose_numbering(mol, ring_atoms, candidates, suffix_pairs, substituent_atoms=None)#

The descriptor among the tied candidates that (g), (h), (i), then (j) prefer.

Each candidate has a numbering (atom index to locant). Candidates with one numbering are one. candidates come in the order of the analysis, which the caller makes independent of the input atom order; the first of the numberings that nothing ranks keeps that choice. The chosen descriptor has numbering_certified = False when a criterion the Blue Book ranks could not be evaluated for a tie between numberings that are not an automorphism apart (see the module docstring).