orthonym.perception.lone_pair_reading#

Note

Internal API. Names and behaviour may change between releases.

The standard reading of a SMILES string at a lone-pair stereocentre, as an RDKit Mol.

A lone pair is an implicit hydrogen to the SMILES standard (OpenSMILES), which centres (CDK) and OPSIN follow. RDKit reads a lone-pair stereocentre otherwise in some positions of a string (the atom written first, a ring-closure digit at P(III) and at an aziridine N), and its InChI reads the Mol RDKit made of the string, so RDKit’s InChIKey of a string depends on where the centre stands in it. A round trip compares RDKit’s InChIKey of the input with that of OPSIN’s SMILES of the name, each as RDKit reads it, and the two strings put the centre in positions RDKit reads differently: a right name is rejected and the mirror image accepted (OPSIN’s own StdInChIKey of ‘(1R,2S)-1,2-diphenylphospholane’ is that of the input ‘C1C[C@H]([P@@](C1)c1ccccc1)c1ccccc1’; RDKit’s key of OPSIN’s SMILES of that name, ‘c1ccccc1[P@]1[C@@H](CCC1)c1ccccc1’, is the key of the (1S,2S) isomer).

standard_reading_mol() is the Mol a round trip compares both sides as: RDKit’s reading of a string with the tag of each lone-pair stereocentre set so that rdCIPLabeler, the labeller that reads the Mol and not a string of it, gives the label the standard reading of the string gives (centres on the string as written). Its InChIKey is the key of the configuration the string means, whatever the position of the centre in it, for the centres below. Without a lone-pair stereocentre it is RDKit’s reading.

What it holds, and what it does not:

  • centres labels N (in a three-membered ring), P, S and Se, and gives no label to As, Sb, Bi, Te or Po. The parity rule of a string does not depend on the element, so such an atom is read through a stand-in of the same valence, P for As, Sb and Bi and S for Te and Po (stand_in_string(), written into the string in place and audited: the stand-in must read as the same atoms, bonds and tags): both labellers read the stand-in, and the flip they decide is applied to the atom of the element. The labels of a stand-in are labels of the stand-in, to be compared with one another and with nothing else.

  • RDKit drops the chirality of some lone-pair centres at parsing (N of an N-aryl aziridine, Sb, Bi, Te, Po) that centres and the standard InChI keep.:func:raw_reading is the reading that keeps them, for the checks that must see everything the string defines.

  • A pseudoasymmetric (r/s) label is never flipped on, a label centres or rdCIPLabeler does not give leaves RDKit’s own tag, and so does rdCIPLabeler past its bound: nothing is then shown, and every check that needs the label fails closed.

orthonym.perception.lone_pair_reading.STAND_IN = {'As': 'P', 'Bi': 'P', 'Po': 'S', 'Sb': 'P', 'Te': 'S'}#

The elements centres gives no label at a lone-pair stereocentre, and the element of the same valence it reads in their place (measured: As, Sb, Bi, Te and Po centres get no label from centres; N, P, S and Se do).

orthonym.perception.lone_pair_reading.lone_pair_centres(mol)#

Indices of the atoms of mol the lone-pair check compares: a tetrahedral stereocentre (namer._lone_pair_compared_atom) with three ligands in all, the fourth position being the lone pair. An atom with an unpaired electron is no such centre: the fourth position holds the radical electron (‘C[C@@H]1CC[P@@](=O)C1’ is a phospholanyl radical, whose P the standard InChI does not see).

orthonym.perception.lone_pair_reading.dropped_centres_invisible_to_inchi(smiles)#

True iff smiles writes a lone-pair centre RDKit drops when it parses (raw_reading) and the standard InChI of the Mol with the centre’s tag and without it is one InChI: no key, of any reader of the structure, tells the two configurations apart (Sb, Bi, Te, Po; not the N of an N-aryl aziridine, whose configuration the InChI holds). Such a configuration cannot be confirmed or refuted by a round trip.

orthonym.perception.lone_pair_reading.raw_reading(smiles)#

RDKit’s reading of smiles (hydrogens removed) with the tag of every lone-pair stereocentre the string writes, also of the ones RDKit drops when it parses: Chem.MolFromSmiles ends with a stereo clean-up that removes the tag of a lone-pair centre it does not take for a stereocentre (the N of an N-aryl aziridine, Sb, Bi, Te, Po), which centres (the N) and the standard InChI keep. The tag is restored there, for the elements of a lone-pair centre; every other atom is RDKit’s own reading. Each atom carries _lp_pos, its 1-based position in the string, which is the position centres labels. None when RDKit cannot read the string.

orthonym.perception.lone_pair_reading.stand_in_string(smiles)#

smiles with each bracketed As, Sb and Bi written P and each Te and Po written S, in place, so that the position of every atom in the string stays what it was; smiles itself when it has none of them; None when the stand-in is not shown to read as the same atoms, bonds and tags.

orthonym.perception.lone_pair_reading.standard_centres_labels(smiles)#

centres’ labels of smiles as written, keyed by 1-based position in the string, with As, Sb, Bi, Te and Po read through their stand-ins (stand_in_string()); None when centres is unavailable or the stand-in cannot be shown. A label of a stand-in is a label of the stand-in.

orthonym.perception.lone_pair_reading.geometry_labels(mol, atoms)#

rdCIPLabeler’s labels of atoms of mol (an atom of an element with a stand-in is labelled as its stand-in), keyed by atom index; an atom it gives none is left out.

orthonym.perception.lone_pair_reading.canonical_smiles_keeping_the_reading(smiles)#

RDKit’s canonical SMILES of smiles, None when RDKit cannot read it; a string with a lone-pair stereocentre comes back as it is. RDKit writes its canonical SMILES for its own reading, and the string it writes can be read as the other configuration by a standard reader (centres, OPSIN) at a lone-pair centre, so what a string with such a centre means is kept by keeping the string.

orthonym.perception.lone_pair_reading.standard_reading_flips(smiles)#

_flips(), empty where nothing can be shown (no centres).

orthonym.perception.lone_pair_reading.standard_reading_mol(smiles)#

RDKit’s reading of smiles with the tag of each lone-pair stereocentre set to the standard reading (see the module docstring); None when RDKit cannot read smiles.

orthonym.perception.lone_pair_reading.standard_reading_inchikey(smiles)#

The full standard InChIKey of:func:standard_reading_mol, or None when smiles has none.