schrodinger.application.jaguar.structure_isomorphism module

Implementation of structure isomorphism used by AutoTS

schrodinger.application.jaguar.structure_isomorphism.label_indexes(st, label)

store atom indexes in property label

Parameters:st (Structure) – structure to add labels to
schrodinger.application.jaguar.structure_isomorphism.hash_of_list(lst)

Hash an iterable of strings, order independent.

This is done by hashing each item, sorting and hashing a concatenation of the list.

Parameters:lst (list of strings) – list of strings to hash as one item
schrodinger.application.jaguar.structure_isomorphism.num_bonds(at, inclusions)

count number of bonds from at to atoms with indexes in list inclusions

Parameters:
  • at (_StructureAtom) – atom to search around
  • inclusions (list of ints) – atom indexes to include in returned list
Returns:

int, the number of bonded neighbors in the inclusions list

schrodinger.application.jaguar.structure_isomorphism.fill_map(atom_map)

Fill in a partial map, the empty locations are indicated by Nones in the atom_map. These entries are filled in by unmapped atoms.

class schrodinger.application.jaguar.structure_isomorphism.BaseAtomMapper(optimize_mapping, debug=False)

Bases: object

Base class for an atom mapper which reorders atoms in a Structure instance using graph isomorphism as implemented in networkx.

This class can be used to easily construct atom mapping algorithms and/or to determine if two structures are conformers. The essential features of implementing a new algorithm are to define an atom type (graph invariant) which identifies nodes and a method to score particular atom mappings. For more control one can also define methods to define new methods for creating and comparing graphs.

Once the abstract methods have been implemented in a subclass (call this MyAtomMapper for example) the mapper can be used reorder the atoms of two structure instances:

mapper = MyAtomMapper(optimize_mapping=True) st1, st2 = mapper.reorder_atoms(st1, range(1, st1.atom_total + 1), st2, range(st2.atom_total + 1))

or two determine if the two structures are conformers: are_conformers = mapper.are_conformers(st1, range(1, st1.atom_total + 1), st2, range(st2.atom_total + 1))

MAPPER_INDEX = 'i_m_atom_mapper_index'
initialize_atom_types(st)

Initialize the atom types

Parameters:st (Structure) – structure containing atoms to initial type of
get_atom_type(at)

get the value of an atom type

Parameters:at (_StructureAtom) – atom that we want a descriptor for
Returns:string
set_atom_type(at, value)

Set the value of the atom type

Parameters:
  • at (_StructureAtom) – atom that we want to set/modify a descriptor for
  • value (string) – value to set atom type to
score_mapping(st1, st2, atlist)

Scores a particular atom reordering.

Parameters:
@pararm atlist: the atoms which have been mapped. This may be a subset
of the atoms in the two structures as we test partial as well as full maps.
Returns:any metric which measures the goodness of a particular relative atom ordering in st1 and st2. Can be any type that has the less than operator implemented.
st_to_graph(st, atlist)

Convert Structure instance to a networkx Graph using _StructureAtom instances as nodes and adding an atom type property

Parameters:
  • st (Structure) – the structure to convert
  • atlist (list of ints) – a list of atoms to use to create the graph
Returns:

networkx Graph

comparator(d1, d2)

Comparison function to be used to determine if two nodes on graph are equivalent.

Parameters:
  • d1 (dict) – key=value dictionary from graph returned from st_to_graph which represents node 1
  • d1 – key=value dictionary from graph returned from st_to_graph which represents node 2
Returns:

boolean indicating equilvalence

isomeric_atom_lists(st1, atlist1, st2, atlist2)

Check that the atom types in atlist1 are the same as those in atlist2. If not, the two structures cannot be conformers.

Parameters:
  • st1 (Structure) – the first structure
  • atlist1 (list of ints) – list of atom indexes defining the first substructure
  • st2 (Structure) – the second structure
  • atlist2 (list of ints) – list of atom indexes defining the second substructure
Returns:

a boolean indicating if these atom lists are isomeric

are_conformers(st1, atlist1, st2, atlist2)

Determine if the two substructures, as defined by the atom lists, are conformers but do not explore isomorphisms.

Parameters:
  • st1 (Structure) – the first structure
  • atlist1 (list of ints) – list of atom indexes defining the first substructure
  • st2 (Structure) – the second structure
  • atlist2 (list of ints) – list of atom indexes defining the second substructure
Returns:

boolean indicating whether or not the two structures are conformers

reorder_structures(st1, atlist1, st2, atlist2)

Reorder the atoms in the two structures.

Parameters:
  • st1 (Structure) – the first structure
  • atlist1 (list of ints) – list of atom indexes defining the first substructure
  • st2 (Structure) – the second structure
  • atlist2 (list of ints) – list of atom indexes defining the second substructure
Returns:

the two structures with structure 2 having had atoms reordered

class schrodinger.application.jaguar.structure_isomorphism.AutoTSAtomMapper(optimize_mapping, use_chirality, debug=False)

Bases: schrodinger.application.jaguar.structure_isomorphism.BaseAtomMapper

Atom mapper used by AutoTS for reordering atoms of conformers. Uses element types and optionally chirality to equate atoms and all bonds are considered equivalent.

Usage example: mapper = AutoTSAtomMapper(optimize_mapping=True, use_chirality=False) st1, st2 = mapper.reorder_atoms(st1, range(1, st1.atom_total + 1), st2, range(st2.atom_total + 1))

ATOM_TYPE = 's_m_custom_atom_type'
initialize_atom_types(st)

Initialize the atom types

Parameters:st (Structure) – structure containing atoms
get_atom_type(at)

This value is used as an atom property

Parameters:at (_StructureAtom) – atom we wish to obtain a type for
Returns:string which identifies atom type
set_atom_type(at, value)

Set the value of the atom type

Parameters:
  • at (_StructureAtom) – atom we wish to set type for
  • value (string) – set the type of atom to this
score_mapping(st1, st2, atlist)

Score a mapping over the atoms listed in atlist. This returns a number of chirality mis-alignments and an rms

Parameters:
  • st1 (Structure) – first structure
  • st2 (Structure) – second structure
  • atlist (list of ints) – list of atoms that have been mapped (indexes refer to both structures)
Returns:

a integer indicating the number of misaligned atom numbering stereocenters and a real representing the rmsd