orthonym.assembly.halogen_drawing#
Note
Internal API. Names and behaviour may change between releases.
A chlorine or bromine with a nonstandard bonding number, named through its iodine drawing.
RDKit gives chlorine and bromine the bonding number 1 only, and none to their anions, so it reads no SMILES of a
λ3-chlorane (CC(C)(C)Cl=C) or of a two-bond chloranuide (C[Cl-]C), and the engine has no molecule to name.
Iodine has the bonding numbers 1, 3, 5 and 7 in RDKit, and the producers of the λ-iodanes, the iodanuides and the
iodine rings name its drawing.:func:iodine_drawing_row names the molecule drawn with iodine in place of every such
atom and writes the chlorine or bromine stem for each iodine stem of that name. An input with iodine of its own
(HalogenDrawing.own_iodine) gives a name whose iodine stems are not all drawn atoms: each choice of stems to
respell is read back, and the first that OPSIN reads to the input’s drawing ships.
What the element changes, and how each is kept out of a shipped name:
Parent and numbering: none. The halogens stand together in every seniority order these follow: “For naming and numbering purposes, the following decreasing order of element seniority is followed: F > Cl > Br > I > At > O >…” (the Blue Book), the classes of (“λ7, λ5 and λ3 halogen compounds in the order F > Cl > Br > I”,:18215), the heteroatoms of rings and chains:8484,:9765).
Alphanumerical order and the lowest locants it decides (g)): the stem is a letter of a prefix’s name.:func:stem_may_change_the_spelling declines a name where the stem begins a prefix, or where another part of the name shares the letters of the stem’s prefix up to the stem.
Elision: a vowel elided before the ‘i’ of ‘iod’ (‘benziodoxole’, is not elided before ‘chlor’ or ‘brom’; a stem right after other letters is declined, except after ‘yl’ or a multiplying prefix.
CIP rule 1a,:44850) ranks I above Br and Se, Cl below them: a descriptor can differ. The read-back compares the full standard InChIKey, stereo layer included, so such a name is declined, never shipped.
The name ships only when OPSIN reads it back to the full standard InChIKey of the input, with the label systematic_verified: the input is drawn with chlorine or bromine, and the name of another drawing is never certified as its PIN. The default tier declines it (NO_VERIFIED_PIN); a wider tier with no name to ship declines UNNAMEABLE.
Kept out of namer.py so that file stays within its size budget.
- class orthonym.assembly.halogen_drawing.HalogenDrawing(iodine_smiles, stem, key, radical, smiles, own_iodine)#
Bases:
NamedTuple- iodine_smiles: str#
Alias for field number 0
- stem: str#
Alias for field number 1
- key: str#
Alias for field number 2
- radical: bool#
Alias for field number 3
- smiles: str#
Alias for field number 4
- own_iodine: bool#
Alias for field number 5
- orthonym.assembly.halogen_drawing.relaxed_mol(smiles)#
smilesread without RDKit’s valence check (every other sanitization step runs), or None.
- orthonym.assembly.halogen_drawing.halogen_drawing(smiles)#
The iodine drawing of
smiles, or None: not a string, no Cl or Br in it, RDKit reads it (nothing to draw again), unreadable atoms not all chlorine or all bromine, a charge other than -1, 0 or +1 on one, or an iodine drawing RDKit does not read with the hydrogens and radical electrons of the input.
- orthonym.assembly.halogen_drawing.unpaired_electrons(atom)#
1 when the halogen
atomhas an odd number of nonbonding electrons, else 0: seven valence electrons, less its formal charge and its bonds (hydrogens included). “Nonstandard bonding numbers”: a neutral chlorine with two bonds is the λ3 radical (‘1λ3-chlorinan-1-yl’, read by OPSIN asCl1CCCCC1with -r); RDKit, which reads the atom without its valence check, gives it none.
- orthonym.assembly.halogen_drawing.stem_may_change_the_spelling(iodine_name)#
True when writing ‘chlor’ or ‘brom’ for an ‘iod’ of
iodine_namecould need another spelling. Errs on the side of True.A letter right before the stem, other than the ‘yl’ of a substituent or a multiplying prefix: a vowel may be elided before ‘iod’ (‘benziodoxol’) that is kept before a consonant.
The stem in a substituent prefix – inside an enclosing mark, or a substituent form (‘iodyl’, ‘iodanyl’) – when it begins the prefix (after a locant, a multiplying prefix or an opening mark): the prefix sorts by the stem and may move.
The stem after other letters of its prefix (‘difluoro-λ3-iodanyl’) when another part of the name begins with the same letters (‘difluoroethyl’): the comparison of the two reaches the stem.
A stem in the parent (the hydride, the ring, an ‘a’ prefix of the parent) is in no prefix.
- orthonym.assembly.halogen_drawing.stem_risk(iodine_name, i)#
Why respelling the ‘iod’ at offset
iofiodine_namecould need another spelling (stem_may_change_the_spelling()): ‘elision’ (a letter before the stem), ‘order’ (the stem sorts a prefix), or None.
- orthonym.assembly.halogen_drawing.prefix_order_kept(iodine_name, name)#
True when the respelled
namecites its detachable prefixes in the order of the iodine drawing’s name, unit by unit, and that order is still the alphanumerical one: the spelling parser (validation.spelling.units) reads both names into the same units with as many prefixes each, and the prefixes’ keys sort the same way.“Simple prefixes… are arranged alphabetically” (the Blue Book) and (g) (the lowest locants
to the prefix cited first) then give the respelled name the iodine name’s citation order and numbering. A prefix the parser misreads (‘iodosyl’ as ‘iodo’) keeps a key that sorts on the same side of every prefix cited before it; a prefix cited after the stem’s sorts after ‘iod’, hence after ‘chlor’ and ‘brom’.
- orthonym.assembly.halogen_drawing.iodine_drawing_row(namer, smiles)#
The
name_tieredrow of an input RDKit cannot read because of a chlorine or bromine with a nonstandard bonding number, or None for any other input (the caller names it as before).The row is the iodine drawing’s row with the chlorine or bromine name, read back by OPSIN to the input’s full standard InChIKey, labelled systematic_verified, with the iodine drawing’s name under
iodine_name; or a decline (_declined()).
- orthonym.assembly.halogen_drawing.halogen_drawing_scope(fn)#
The decorator of
Orthonym.name,name_tieredandname_with_confidencethat names a caller’s input through:func:iodine_drawing_row (or a substituted metallocene through its cyclopentyl drawing, or a charge-separated drawing that gets no name as drawn through a fallback ofdecline_fallback); any other input, and a nested call, runsfnas before.name_tieredreturns the row,name_with_confidenceits record,nameits name; a decline gives the label (nameraises the limit withraise_on_limit).