schrodinger.livedesign.molhash module

class schrodinger.livedesign.molhash.HashLayer(value)[source]

Bases: enum.Enum

An enumeration.

CANONICAL_SMILES = 1
ENHANCED_STEREO_LABEL = 2
ESCAPE = 3
FORMULA = 4
NO_STEREO_SMILES = 5
NO_STEREO_TAUTOMER_HASH = 6
SGROUP_DATA = 7
TAUTOMER_HASH = 8
class schrodinger.livedesign.molhash.HashScheme(value)[source]

Bases: enum.Enum

An enumeration.

ALL_LAYERS = (<HashLayer.CANONICAL_SMILES: 1>, <HashLayer.ENHANCED_STEREO_LABEL: 2>, <HashLayer.ESCAPE: 3>, <HashLayer.FORMULA: 4>, <HashLayer.NO_STEREO_SMILES: 5>, <HashLayer.NO_STEREO_TAUTOMER_HASH: 6>, <HashLayer.SGROUP_DATA: 7>, <HashLayer.TAUTOMER_HASH: 8>)
NO_STEREO_LAYERS = (<HashLayer.ESCAPE: 3>, <HashLayer.FORMULA: 4>, <HashLayer.NO_STEREO_SMILES: 5>, <HashLayer.NO_STEREO_TAUTOMER_HASH: 6>)
TAUTOMERIC_LAYERS = (<HashLayer.ESCAPE: 3>, <HashLayer.FORMULA: 4>, <HashLayer.NO_STEREO_TAUTOMER_HASH: 6>, <HashLayer.TAUTOMER_HASH: 8>)
schrodinger.livedesign.molhash.get_molhash(all_layers, hash_scheme: schrodinger.livedesign.molhash.HashScheme = HashScheme.ALL_LAYERS)[source]

Generates a molecular hash using a specified set of layers. See https://docs.google.com/document/d/13MLGoCPAjD6VhytcJp-F9MHhiEdmNmpjG5blraAtI8s/edit?usp=sharing for explanation the layer idea.

Parameters
  • mol – the molecule to generate the hash for

  • hash_scheme – a tuple containing the information layers to be considered for the hash

schrodinger.livedesign.molhash.get_mol_layers(original_molecule, sgroup_data='', escape='')[source]

returns a NamedTuple with the layers for a molecule that might be useful in a hash

NOTE the enhanced_stereo_label layer produced by this code uses the atom numbers from the canonical_smiles layer. It is not suitable for combining with the tautomer layer!

TODOs:
  • The sgroup_data layer is just being treated as a string (i.e. not canonicalized) here

schrodinger.livedesign.molhash.strip_atom_map_labels(molecule)[source]
schrodinger.livedesign.molhash.get_stereo_tautomer_hash(molecule)[source]
schrodinger.livedesign.molhash.get_canonical_smiles(cxsmiles)[source]
schrodinger.livedesign.molhash.get_no_stereo_layers(molecule, canonical_smiles, tautomer)[source]
schrodinger.livedesign.molhash.get_canonical_atom_ranks_and_bonds(mol, useSmilesOrdering=True)[source]

returns a 2-tuple with:

  1. the canonical ranks of a molecule’s atoms

  2. the bonds expressed as (canonical_atom_rank_1,canonical_atom_rank_2) where canonical_atom_rank_1 < canonical_atom_rank_2

If useSmilesOrdering is True then the atom indices here correspond to the order of the atoms in the canonical SMILES, otherwise just the canonical atom order is used. useSmilesOrdering=True is a bit slower, but it allows the output to be linked to the canonical SMILES, which can be useful.

schrodinger.livedesign.molhash.canonicalize_data_sgroup(sg, atRanks, bndOrder, fieldNames=None, sortAtomOrder=True)[source]

NOTES: if sortAtomOrder is true then the atom list will be sorted. This assumes that the order of the atoms in that list is not important

schrodinger.livedesign.molhash.getCanonicalBondRep(bond, atomRanks)[source]
schrodinger.livedesign.molhash.canonicalize_sru_sgroup(mol, sg, atRanks, bndOrder, sortAtomAndBondOrder)[source]

NOTES: if sortAtomAndBondOrder is true then the atom and bond lists will be sorted. This assumes that the ordering of those lists is not important

schrodinger.livedesign.molhash.canonicalize_cop_sgroup(mol, sg, atRanks, bndOrder, sortAtomAndBondOrder)[source]

NOTES: if sortAtomAndBondOrder is true then the atom and bond lists will be sorted. This assumes that the ordering of those lists is not important

schrodinger.livedesign.molhash.canonicalize_sgroups(mol, dataFieldNames=None, sortAtomAndBondOrder=True)[source]

NOTES: if sortAtomAndBondOrder is true then the atom and bond lists will be sorted. This assumes that the ordering of those lists is not important

class schrodinger.livedesign.molhash.EnhancedStereoUpdateMode(value)[source]

Bases: enum.Enum

An enumeration.

ADD_WEIGHTS = 1
REMOVE_WEIGHTS = 2
schrodinger.livedesign.molhash.update_enhanced_stereo_group_weights(mol, mode)[source]
schrodinger.livedesign.molhash.canonicalize_stereo_groups(mol)[source]

Returns canonical CXSmiles and the corresponding molecule with the stereo groups canonicalized.

The RDKit canonicalization code does not currently take stereo groups into account. We work around that by using EnumerateStereoisomers() to generate all possible instances of the molecule’s stereogroups and then lexically compare the CXSMILES of those.