orthonym.rules.isotope_offsets#
Note
Internal API. Names and behaviour may change between releases.
Where in the skeleton name of a mixture an isotope descriptor can stand.
The placement search of rules.isotopes builds a candidate for every offset of the skeleton name and reads each
back with OPSIN. A descriptor is read onto the part of the name that follows it, in the one component of a mixture
name (‘ethan-1-ol—(2H1)methane (1/1)’,: the components are named one after the other, joined by long dashes,
and the amounts follow in a bracket), and a component of amount n is read as n identical molecules (OPSIN 2.9.0:
‘(2H2)ethan-1-ol—propane—methane (1/1/2)’ is read as C.CCC.C(C)(O)([2H])[2H].C). So two things hold of every candidate
that the search builds from ONE descriptor, and a candidate that breaks one of them cannot be read back to the
labelled input:
the labelled fragments of the input are all one species (the same labelled structure): the descriptor labels the copies of one component and nothing else;
the descriptor stands in a component whose structure is the structure of a labelled fragment, without its labels.
A search over a mixture of a dozen components, labelled in two of them, built every pair of an offset of the whole name and a locant up to the heavy atoms of the whole mixture (a CD3 of a five-component mixture: 42,098 OPSIN parses in 90 s, none of them read to the input).:func:restrict_offsets leaves out the offsets that cannot give a candidate that is read back, and asks nothing of the search beyond it: where the name is no mixture, or the structure of a component cannot be decided, every offset stays.
The locants are bounded the same way. A locant is looked up among the atoms of the part that follows the descriptor
(Fragment.getAtomByLocantOrThrow), and OPSIN names the locant of every atom it reads (-o extendedsmi, $_AV), so a
locant above the highest one it gives the atoms of the component is refused (“Could not find the atom with locant N.”).
locant_limit() is that highest locant and a margin for the gaps in the numbering of OPSIN’s own fragments
(isotope_search.GAP_WINDOW): the search asks for no locant above it, where it asked for one for every heavy atom of
the whole mixture.
- orthonym.rules.isotope_offsets.labelled_species(original)#
The labelled fragments of
original, one per species (the same canonical SMILES, isotopes kept); None when the fragments cannot be read.
- orthonym.rules.isotope_offsets.restrict_offsets(offsets, skel, original)#
The offsets of
offsets(the insertion offsets ofskel) at which a descriptor of the labels oforiginalcan be read back tooriginal;offsetsitself when that cannot be decided (see the module docstring).
- orthonym.rules.isotope_offsets.search_space(skel, original, offsets, n_pos)#
([0] + the offsets, the locants 1..n)that the placement search asks forskel: the offsets ofrestrict_offsets(), andn_pos(the heavy atoms of the whole molecule) lowered to the highest locant of the parts of the name that can take a descriptor, with the margin of the gaps in OPSIN’s numbering.