schrodinger.structure module

A module containing the central interface for reading and editing chemical structures.

Structure is a pythonic, object oriented wrapper for the mmct library that provides access to atoms, bonds, and their properties. It provides common methods for inspecting and editing coordinates, e.g. Structure.measure, Structure.adjust, and Structure.merge. The schrodinger.structutils package provides additional functions and classes that operate on Structure objects.

StructureReader provides a convenient iterator to read structures from files, and StructureWriter provides an efficient means of writing many files.

PropertyName provides translation between m2io datanames and user friendly names.

MultiFileStructureReader iterates through all the structure in multiple files using StructureReader.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.structure.update_once()

A context manager to enable manual update mode to update the structure by calling update only once before exiting , and then restores the original manual update state.

schrodinger.structure.suppress_error_reporting(error_handler)
schrodinger.structure.get_atom_names_for_chi_angle(res_type, angle_name)

Return atom names for the specified Chi angle in the given residue type.

Parameters:
  • res_type (str) – Residue type (e.g. “ALA “)
  • angle_name (str) – Chi angle name. One of: Chi1, Chi2, Chi3, Chi4, Chi5. See CHI_DIHEDRAL_NAMES.
:raises ValueError if the given angle is invalid, or is not defined for the
given residue.
class schrodinger.structure.BondType

Bases: enum.Enum

These represent varying bond types, which are independent from bond orders.

Zero = 0
Dative = 1
Single = 2
Double = 3
Triple = 4
__class__

alias of enum.EnumMeta

__members__ = mappingproxy(OrderedDict([('Zero', <BondType.Zero: 0>), ('Dative', <BondType.Dative: 1>), ('Single', <BondType.Single: 2>), ('Double', <BondType.Double: 3>), ('Triple', <BondType.Triple: 4>)]))
__module__ = 'schrodinger.structure'
exception schrodinger.structure.UndefinedStereochemistry

Bases: Exception

Raised by SmilesStructure.getStructure() when atoms with undefined chirality are present.

__cause__

exception cause

__class__

alias of builtins.type

__context__

exception context

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n Raised by SmilesStructure.getStructure() when atoms with undefined\n chirality are present.\n ', '__weakref__': <attribute '__weakref__' of 'UndefinedStereochemistry' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init__

Initialize self. See help(type(self)) for accurate signature.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__setstate__()
__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__suppress_context__
__traceback__
__weakref__

list of weak references to the object (if defined)

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception schrodinger.structure.AtomsInRingError

Bases: ValueError

Raised by Structure.adjust() when atoms are in a ring, so adjustment can’t be made without distorting the structure.

__cause__

exception cause

__class__

alias of builtins.type

__context__

exception context

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': "\n Raised by Structure.adjust() when atoms are in a ring, so adjustment can't\n be made without distorting the structure.\n ", '__weakref__': <attribute '__weakref__' of 'AtomsInRingError' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init__

Initialize self. See help(type(self)) for accurate signature.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__setstate__()
__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__suppress_context__
__traceback__
__weakref__

list of weak references to the object (if defined)

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class schrodinger.structure.Structure(handle, error_handler=None)

Bases: object

A general chemical structure object, which may contain multiple molecules. Structure is an object-oriented wrapper for the underlying MMCT library, where all state is stored.

There are several ways to create Structure instances. The structure.StructureReader provides a way to read Structures from a file, and the schrodinger.maestro.maestro.workspace_get function returns the workspace Structure from a Maestro session. The schrodinger.project module provides access to Structures in a Maestro project.

Properties of the Structure entry can be accessed from the property dictionary using the mae file data name. For example, the Glide score of a docked pose may be accessed as:

glide_score = st.property['r_i_glide_gscore']

A few additional Structure attributes are available as instance attributes (actually, as python properties). For example, the title of the structure can be accessed (and assigned) via the title attribute. See the Structure properties documentation for a full list.

Atom objects are accessed from the list-like schrodinger.structure.Structure.atom attribute. Each atom is an instance of the _StructureAtom class. See the “Properties” section of the schrodinger.structure._StructureAtom documentation for a list of available attributes (implemented again as python properties). For example, the atomic number of the first atom in a structure is accessed as:

atomic_num = st.atom[1].atomic_number

Note that indices used to access atoms and bonds start at 1, not 0 as with regular python lists. Iteration over the atoms and bonds works as expected.

Structure atom properties may also be accessed from the atom’s property dictionary. For example, the x-coordinate of the first atom may be accessed as:

x_coord = st.atom[1].property['r_m_x_coord']

(However, it is preferable to simply use the x attribute - i.e. st.atom[1].x.)

Bond objects are instances of the schrodinger.structure._StructureBond class and are usually accessed via atoms using the schrodinger.structure._StructureAtom.bond attribute. Like atoms, bonds have some built-in attributes and a general property dictionary. Bonds can also be accessed from the schrodinger.structure.Structure.bond iterator, which iterates over all bonds in the Structure.

Iterators for various substructures can be accessed from the molecule, chain, residue, and ring attributes. Each of these yields an object that has a getAtomIndices method to get a list of atom indices, and an extractStructure method that can be used to create a separate Structure instance corresponding to the substructure.

Please see the Python Module Overview for a non-technical introduction and additional examples.

__init__(handle, error_handler=None)

Initialize an object with an existing MMCT handle or a C++ Structure object.

__repr__()

Return repr(self).

__copy__()

Allows the structure to be copied by copy.copy

__int__()

Return the underlying mmct handle when coerced to an integer.

copy()

Returns a copy of the structure.

__eq__(other)

Check for equality with other Structure instances based on the MMCT handle.

__hash__()

Return hash(self).

__ne__(other)

Check for inequality with other Structure instances based on the MMCT handle.

__getstate__()

Return a string representation for use by pickle.

__setstate__(state)

Allows Structure to be unpickled by reading in a string representation

getXYZ(copy=True)

Get a numpy array of the xyz coordinates of all atoms in the molecule with shape (atom_total, 3). Note that numpy arrays are indexed starting with 0.

You can avoid copying the underlying data by specifying copy=False, in which case modifying any values will modify the coordinate values in the Structure.

Note that if coordinates are retrieved with copy=False they will become invalid after their source Structure has been garbage collected. Any use of them after this point will likely cause a core dump. This is because the python numpy array provides access directly to the underlying C data.

setXYZ(xyz)

Set all xyz coordinates for the molecule from a numpy array.

findResidue(query)

Returns a _Residue object matching the given string (e.g. “A:123”). Currently only protein residues are supported.

If no residues were found that match the given string, or if the given string is of improper format, ValueError is raised.

Note:If the structure has more than one matching residue, then only the first match will be returned.
atom

An iterable of structure atoms, each of which is a _StructureAtom instance.

Example usage, where st is a Structure instance:

# Access an atom (indices start at 1)
atomobj = st.atom[n]

# Delete an atom
del st.atom[n]

# Find the number of atoms
len(st.atom)

# Iterate over all atoms
for atom in st.atom:
    take_some_action(atom)
Note:As with many other collections, the contents of the atom list should not be modified through additions or deletions while you are iterating over it.
bond

An iterable of structure bonds, each of which is a _StructureBond instance.

To iterate over bonds:

for bond in st.bond:
    take_some_action(bond)
Note:Atoms and bonds should not be added or deleted while you are iterating over bonds.
Note:Bonds are not accessible by index.
molecule

An iterable of molecules in the structure, each of which is a _Molecule instance.

Example usage:

# Find the number of molecules in the structure
len(st.molecule)

# Retrieve a molecule by number (indices start at 1)
mol = st.molecule[molnum]

# Iterate over all molecules
for mol in st.molecule:
    take_some_action(mol)
Note:Atoms and bonds should not be added or deleted while you are iterating over molecules.
chain

An iterable of chains in the structure, each of which is a _Chain instance.

Example usage:

# Find the number of chains in the structure
len(st.chain)

# Retrieve a _Chain instance by letter
chain = st.chain[letter]

# Iterate over chains
for chain in st.chain:
    take_some_action(chain)
Note:Atoms and bonds should not be added or deleted while you are iterating over chains.
ring

An iterable of rings in the structure, each of which is a _Ring instance.

To iterate over rings:

for ring in st.ring:
    take_some_action(ring)
Note:Atoms and bonds should not be added or deleted while you are iterating over rings.
title

Get the title for this structure

atom_total

Get total number of atoms in this structure

mol_total

Get total number of molecules in this structure

formal_charge

Get the sum of formal charges for the structure.

Accessing this property is an O(N) operation.

total_weight

The sum of atomic weights for the whole structure.

The weight of implicit hydrogens is automatically included.

Accessing this property is an O(N) operation.

residue

An iterable of residues in the structure, each of which is a _Residue instance.

To iterate over all residues:

for residue in st.residue:
    take_some_action(residue)
Note:Atoms and bonds should not be added or deleted while you are iterating over residues.
Note:residues are not accessible by index. See Structure.findResidue()
property

Dictionary-like container of Structure-level properties. Keys are strings of the form type_family_name as described in the PropertyName documentation.

retype()

Reassign all the MacroModel atom types based on the bond orders and formal charges. This function should be called after either of these have been changed.

static read(filename, index=1, error_handler=None, format=None, ignore_errors=False)

Read a single structure from file ‘filename’, returning a Structure instance.

Parameters:
  • index (int) – For multi-structure formats, the index of the structure to read.
  • error_handler (int) – Handle of the mmerr object to use for error logging. Defaults to schrodinger.infra.mm.error_handler.
  • format (str) – Format of the file, either ‘pdb’, ‘sd’, ‘mol2’, ‘maestro’ or ‘maestro_text’ (determined from file extension by default).
  • ignore_errors (bool) – If True, bad structures will be skipped instead of raising an exception. Currently only used by the SD reader.
writeToString(format)

Write the structure to a string representation and return the string. The format parameter is required.

write(filename, format=None)

Write the structure to a file, overwriting any previous content. Format is determined from the file suffix if None is specified, otherwise an explicit value of maestro, sd, pdb, or smiles can be used.

append(filename, format=None)

Append the structure to the named file.

This method should provided acceptable performance if you are writing a small number of structures, but if you need to write a large number of structures (more than a few hundred) to a file, the StructureWriter class will provide better performance.

Parameters:format (str) – By default, the file format is determined from the filename suffix, but this can be specified explicitly. Supported option values are one of the PDB, MOL2, SD, MAESTRO, SMILES, SMILESCSV module-level constants.
putToM2ioFile(filehandle)

Used by the Maestro writer - put a single structure to the (already open) filehandle

closeBlockIfNecessary(filehandle)

Used by the Maestro writer to leave the header block if necessary. For Structure objects this is not needed so it only returns

deleteAtoms(indices, renumber_map=False)

Delete multiple atoms from the Structure. The argument indices must be a sequence or an iterable, and able to be interpreted as ints.

After deletion, indices are renumbered from 1 to len(atoms). Pre-existing references to Structure atoms will not be correct, as they store index values.

If renumber_map is set to True, will return a renumbering dictionary. Keys are atom numbers before deleting, and value for each is the new atom number, or None if that atom was deleted.

addAtom(element, x, y, z, color=None, atom_type=None)

Add a new atom to the structure. Return the created _StructureAtom object.

addAtoms(num_atoms)

Add the specified number of atoms to this structure.

The following atom attributes will have to be set for each atom afterwards:

  • element
  • x, y, z
  • color
  • atom_type
extract(indices, copy_props=False)

Return a new structure object which contains the atoms of the current structure that appear in the specified list. The argument indices must be a sequence or an iterable, and able to be interpreted as ints.

After extractions, indices are renumbered from 1 to len(atoms). Pre-existing references to Structure atoms will not be correct, as they store index values.

If copy_props is set to True, then the new structure object will inherit Structure-level properties from the source object.

extend(other_structure)

Add the atoms in other_structure to the end of the current structure. The other_structure is left unchanged.

Extending a structure with itself is not allowed.

merge(other_structure, copy_props=False)

Return a new structure object which contains the atoms of the current structure and the atoms of other_structure.

If copy_props is True, properties from the current structure and other_structure will be added to the new structure. If the same property is specifed in both the current structure and other_structure, the current value will take precedence.

areBound(atom1, atom2)

Returns True if atom1 and atom2 have a bond of any order between them and False is there is no bond.

getBond(atom1, atom2)

Returns a _StructureBond object for the bond between atom1 and atom2. The atom parameters can be _StructureAtom objects or integer indices from 1 to the number of atoms in the structure.

addBond(atom1, atom2, bond_type)

Add a bond of the specified type between the two atoms atom1 and atom2. The atom parameters can be _StructureAtom objects or integer indices from 1 to the number of atoms in the structure. If the two atoms are already bound then the bond type is just changed.

:param bond_type bond type (legacy integer 0-3 bond order)

addBonds(bonds_list)

Add multiple bonds to this structure. This is much faster than multiple calls to addBond() method when many bonds need to be added. Bonds are specified by a list of integer lists: (atom1, atom2, bond_type).

Example::
st.addBonds([(10, 11, 1), (12, 13, 2)])

This will add a single-order bond between atoms 10 and 11, and a double-order bond between atoms 12 and 13.

deleteBond(atom1, atom2)

Delete the bond between atom1 and atom2. Raises an Exception if there is no bond between these two.

measure(atom1, atom2, atom3=None, atom4=None)

Return the measurement for the provided atoms. If atom3 is None, return the distance between atom1 and atom2. If atom4 is None, return the angle with atoms 1 through 3, and if all atoms are provided, return the dihedral angle.

All atom arguments can be integers or _StructureAtom objects.

If Periodic Boundary Condition CT-level properties are defined, uses the PBC measurement.

See also the structutil.measure module, which has functions to make measurements between atoms in different structures, and can also measure angles between planes.

adjust(value, atom1, atom2, atom3=None, atom4=None)

Adjust a distance, angle or dihedral angle. If atom3 is None then the distance between atom1 and atom2 will be set to value, atom2 and all atoms attached to that atom will be moved. If atom4 is None then the angle between atom1, atom2 and atom3 will set to value, atom3 and all other atoms attached to that will be moved. If all atoms are specified then the dihedral angle made by atom1, atom2, atom3 and atom4 will be set to value and atom4 and all other atoms attached to that will be moved. All distances are specified in Angstroms, all angles in degrees.

All atom arguments can be integers or _StructureAtom objects. There is no return value for this function.

Raises:AtomsInRingError – if specified atoms are within a ring system. If ring distortion from an adjustment is not an issue, then the moving bitset can be manually created and passed to mmct_atom_set_distance(), mmct_atom_set_bond_angle(), or mmct_atom_set_dihedral_angle().
getMovingAtoms(fixed_atom, moving_atom)

Returns all atoms that would move if <moving_atom> is moved while <fixed_atom> is frozen. This effectively returns all atoms in the same molecule substructure as <moving_atom> (atoms in the same substructure as fixed_atom are excluded).

In other words, if the bond between the moving_atom and fixed_atom (or towards the direction of fixed_atom) were to be broken, the atoms that would be in the same molecule as moving_atom are returned. Can be used for detecting things like residue side-chain atoms, etc.

Note:

If fixed_atom and moving_atom are part of different molecules, then all atoms in the moving_atom’s molecule will be returned. If fixed_atom and moving_atom are not bound directly, the intervening atoms will not be included in the result. If fixed_atom and moving_atom are connected with more than one path (are in a ring), then ValueError is raised.

Parameters:
  • fixed_atom (Atom index or _StructureAtom.) – Atom which is part of the molecule that is to be excluded from the result (frozen, not being moved).
  • moving_atom (Atom index or _StructureAtom.) – Atom of interest (atom to be moved); a set of atoms that would be moved with it (connected to it) will be returned.
Return type:

Set of ints

Returns:

Set of atom indices for atoms “connected” to moving_atom - those atoms that would be moved with it if it was moved. For example, if called with alpha carbon and beta carbon atoms of a protein residue, then all side-chain atoms would be returned. Atom moving_atom will also be included.

Raises ValueError if the given atoms are part of a ring (in other words, moving_atom is connected to fixed_atom via more than one path). This may happen if part of the moving_atom’s “chain” is bonded to something unexpected; e.g. ZOBed to metals, or involved in a di-sulfide bond.

getResidueAtoms(atom)

Return a list of atom objects that are in the same residue as ‘atom’.

getMoleculeAtoms(atom)

Return a list of atom objects that are in the same molecule as ‘atom’.

getChainAtoms(atom)

Return a list of atom objects that are in the same chain as ‘atom’.

getAtomIndices()

Return a list of all atom indices in this structure.

isEquivalent(struct, check_stereo=True)

Return True if the 2 structures are equivalent Return False if the 2 structures are different

struct: Another structure class object

check_stereo: Specifies whether or not to check stereo chemistry.

find_rings(sort=True)

Find all rings in the structure using SSSR.

Each ring is returned in connectivity order.

Parameters:sort (bool) – Deprecated and unused
Returns:A list of lists of integers corresponding to the atom indices of the rings.
applyStyle(atoms=3, bonds=3, atom_list=None)

Applies the given display styles to the atoms and bonds of the entire structure (by default) or to the atoms (and their bonds) given in atom_list.

Parameters:
  • atoms (int) – Display style for atoms, given by structure module constants ATOM_NOSTYLE, ATOM_CIRCLE, ATOM_CPK, ATOM_BALLNSTICK. Default is ATOM_BALLNSTICK.
  • atoms – Display style for bonds, given by structure module constants BOND_NOSTYLE, BOND_WIRE, BOND_TUBE, BOND_BALLNSTICK. Default is BOND_BALLNSTICK.
  • atom_list (iterable) – An iterable of atom objects or atom indices to apply the given styles to. If not included the styles are applied to all atoms in the structure. Possible examples include:: [1, 3, 5] ring.atom schrodinger.structutils.analyze.evalulate_asl(asl_expr) [structure.atom[x] for x in xrange(50)] maestro.selected_atoms_get()
has3dCoords()

Returns True if any atom in the structure has a non-zero z-coordinate.

get3dStructure(require_stereo=True)
Deprecated:Use generate3dConformation() instead.
generate3dConformation(require_stereo=True)

Generate new 3D coordinates for the current structure, and add hydrogens if any are missing. This method is useful for “volumizing” a 2D structure into 3D. NOTE: For 2D inputs, annotation properties must be present for chiral centers to be processed correctly.

Parameters:require_stereo (bool) – Whether to require all chiral centers to have defined stereochemistry via annotation properties. Defaults to True. UndefinedStereochemistry exception is raised if any chiral atom has ambiguous chirality. If set to False, ambiguous chiralities will be expanded arbitrarily.
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n A general chemical structure object, which may contain multiple\n molecules. Structure is an object-oriented wrapper for the underlying\n MMCT library, where all state is stored.\n\n There are several ways to create Structure instances. The\n structure.StructureReader provides a way to read Structures from a file,\n and the `schrodinger.maestro.maestro.workspace_get` function returns\n the workspace Structure from a Maestro session. The\n `schrodinger.project` module provides access to Structures in a Maestro\n project.\n\n Properties of the Structure entry can be accessed from the `property`\n dictionary using the `.mae` file data name. For example, the Glide\n score of a docked pose may be accessed as::\n\n glide_score = st.property[\'r_i_glide_gscore\']\n\n A few additional Structure attributes are available as instance\n attributes (actually, as python properties). For example, the title of\n the structure can be accessed (and assigned) via the `title` attribute.\n See the Structure properties documentation for a full list.\n\n Atom objects are accessed from the list-like\n `schrodinger.structure.Structure.atom` attribute. Each atom is an\n instance of the `_StructureAtom` class. See the "Properties" section of\n the `schrodinger.structure._StructureAtom` documentation for a list of\n available attributes (implemented again as python properties). For\n example, the atomic number of the first atom in a structure is accessed\n as::\n\n atomic_num = st.atom[1].atomic_number\n\n Note that indices used to access atoms and bonds start at 1, not 0 as\n with regular python lists. Iteration over the atoms and bonds works as\n expected.\n\n Structure atom properties may also be accessed from the atom\'s\n `property` dictionary. For example, the x-coordinate of the first atom\n may be accessed as::\n\n x_coord = st.atom[1].property[\'r_m_x_coord\']\n\n (However, it is preferable to simply use the `x` attribute - i.e.\n `st.atom[1].x`.)\n\n Bond objects are instances of the\n `schrodinger.structure._StructureBond` class and are usually accessed\n via atoms using the `schrodinger.structure._StructureAtom.bond`\n attribute. Like atoms, bonds have some built-in attributes and a general\n `property` dictionary. Bonds can also be accessed from the\n `schrodinger.structure.Structure.bond` iterator, which iterates over\n all bonds in the Structure.\n\n Iterators for various substructures can be accessed from the\n `molecule`, `chain`, `residue`, and `ring` attributes. Each of these\n yields an object that has a `getAtomIndices` method to get a list of atom\n indices, and an `extractStructure` method that can be used to create a\n separate `Structure` instance corresponding to the substructure.\n\n Please see the Python Module Overview for a non-technical introduction\n and additional examples.\n\n ', '__init__': <function Structure.__init__>, '__repr__': <function Structure.__repr__>, '__copy__': <function Structure.__copy__>, '__int__': <function Structure.__int__>, 'copy': <function Structure.copy>, '__eq__': <function Structure.__eq__>, '__hash__': <function Structure.__hash__>, '__ne__': <function Structure.__ne__>, '__getstate__': <function Structure.__getstate__>, '__setstate__': <function Structure.__setstate__>, 'getXYZ': <function Structure.getXYZ>, 'setXYZ': <function Structure.setXYZ>, 'findResidue': <function Structure.findResidue>, '_createProxy': <function Structure._createProxy>, '_proxy': <schrodinger.infra.util.CreateWhenNeeded object>, '_doc': '\n An iterable of rings in the structure, each of which is a `_Ring`\n instance.\n\n To iterate over rings::\n\n for ring in st.ring:\n take_some_action(ring)\n\n :note: Atoms and bonds should not be added or deleted while you are\n iterating over rings.\n\n ', '_createAtomContainer': <function Structure._createAtomContainer>, 'atom': <schrodinger.infra.util.CreateWhenNeeded object>, '_createBondContainer': <function Structure._createBondContainer>, 'bond': <schrodinger.infra.util.CreateWhenNeeded object>, '_createStructureMoleculeIterator': <function Structure._createStructureMoleculeIterator>, 'molecule': <schrodinger.infra.util.CreateWhenNeeded object>, '_createStructureChainIterator': <function Structure._createStructureChainIterator>, 'chain': <schrodinger.infra.util.CreateWhenNeeded object>, '_createStructureRingIterator': <function Structure._createStructureRingIterator>, 'ring': <schrodinger.infra.util.CreateWhenNeeded object>, 'title': <property object>, 'atom_total': <property object>, 'mol_total': <property object>, 'formal_charge': <property object>, 'total_weight': <property object>, 'residue': <property object>, 'property': <property object>, 'retype': <function Structure.retype>, 'read': <staticmethod object>, 'writeToString': <function Structure.writeToString>, 'write': <function Structure.write>, 'append': <function Structure.append>, 'putToM2ioFile': <function Structure.putToM2ioFile>, 'closeBlockIfNecessary': <function Structure.closeBlockIfNecessary>, 'deleteAtoms': <function Structure.deleteAtoms>, 'addAtom': <function Structure.addAtom>, 'addAtoms': <function Structure.addAtoms>, 'extract': <function Structure.extract>, 'extend': <function Structure.extend>, 'merge': <function Structure.merge>, 'areBound': <function Structure.areBound>, 'getBond': <function Structure.getBond>, 'addBond': <function Structure.addBond>, 'addBonds': <function Structure.addBonds>, 'deleteBond': <function Structure.deleteBond>, 'measure': <function Structure.measure>, 'adjust': <function Structure.adjust>, 'getMovingAtoms': <function Structure.getMovingAtoms>, 'getResidueAtoms': <function Structure.getResidueAtoms>, 'getMoleculeAtoms': <function Structure.getMoleculeAtoms>, 'getChainAtoms': <function Structure.getChainAtoms>, 'getAtomIndices': <function Structure.getAtomIndices>, 'isEquivalent': <function Structure.isEquivalent>, 'find_rings': <function Structure.find_rings>, 'applyStyle': <function Structure.applyStyle>, 'has3dCoords': <function Structure.has3dCoords>, 'get3dStructure': <function Structure.get3dStructure>, 'generate3dConformation': <function Structure.generate3dConformation>, '__dict__': <attribute '__dict__' of 'Structure' objects>, '__weakref__': <attribute '__weakref__' of 'Structure' objects>})
__dir__() → list

default dir() implementation

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.structure.MaestroTextReader(filename, index=1, error_handler=None)

Bases: schrodinger.structure._ReaderWriterContextManager

A class for reading structures from a Maestro format file. The structures returned are TextualStructure objects. These allow read-only access to the Structure-level properties but not to atoms or any properties which rely on atoms.

read_mode = 16
__init__(filename, index=1, error_handler=None)

Initialize the reader.

Parameters:
  • filename (string) – The filename to read.
  • index (int) – The index of the first structure to read.
  • error_handler (int) – The handle of the mmerr object to use for error logging. Defaults to schrodinger.infra.mm.error_handler.
__del__()
__iter__()
__next__()

Return the next Structure object from the file.

close()

Close the file.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n A class for reading structures from a Maestro format file. The structures\n returned are TextualStructure objects. These allow read-only access to the\n Structure-level properties but not to atoms or any properties which\n rely on atoms.\n ', 'read_mode': 16, '__init__': <function MaestroTextReader.__init__>, '__del__': <function MaestroTextReader.__del__>, '__iter__': <function MaestroTextReader.__iter__>, '_m2io_open_file': <function MaestroTextReader._m2io_open_file>, '__next__': <function MaestroTextReader.__next__>, 'close': <function MaestroTextReader.close>})
__dir__() → list

default dir() implementation

__enter__()
__eq__

Return self==value.

__exit__(type, value, tb)
__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.structure.FormatReader(error_handler)

Bases: schrodinger.structure._ReaderWriterContextManager

This is a base class for all file format readers.

It currently handles the queueing of error messages generated by the underlying file reading libraries.

__init__(error_handler)

Initialize self. See help(type(self)) for accurate signature.

getErrorHandler()

This method will return the current error handler. It should be defined in any derived class in order to query the appropriate mmlib and return the error handler if there is one.

getReadErrors()

Returns the list of error messages generated from the reading operations since the most recent clearReadErrors() call. Note that this could be an empty list if now errors have beenn encountered.

clearReadErrors()

Clears the list of read errors.

startErrorQueuing()

Queue error messages and suppress printing to the stream.

stopErrorQueuing()

Turn off error queueing and add any error messages to the error_queue attribute. And restore printing to the stream.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n This is a base class for all file format readers.\n\n It currently handles the queueing of error messages generated by\n the underlying file reading libraries.\n\n ', '__init__': <function FormatReader.__init__>, 'getErrorHandler': <function FormatReader.getErrorHandler>, 'getReadErrors': <function FormatReader.getReadErrors>, 'clearReadErrors': <function FormatReader.clearReadErrors>, 'startErrorQueuing': <function FormatReader.startErrorQueuing>, 'stopErrorQueuing': <function FormatReader.stopErrorQueuing>, '_errorQueueing': <function FormatReader._errorQueueing>})
__dir__() → list

default dir() implementation

__enter__()
__eq__

Return self==value.

__exit__(type, value, tb)
__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.structure.InfraReader(filename)

Bases: schrodinger.structure.FormatReader

Reader which use c++ reader implementation.

NOTE: This is just tested for CIF format for now.

__init__(filename)

Initialize self. See help(type(self)) for accurate signature.

__iter__()
__next__()
close()
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n Reader which use c++ reader implementation.\n\n NOTE: This is just tested for CIF format for now.\n ', '__init__': <function InfraReader.__init__>, '__iter__': <function InfraReader.__iter__>, '__next__': <function InfraReader.__next__>, 'close': <function InfraReader.close>})
__dir__() → list

default dir() implementation

__enter__()
__eq__

Return self==value.

__exit__(type, value, tb)
__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

clearReadErrors()

Clears the list of read errors.

getErrorHandler()

This method will return the current error handler. It should be defined in any derived class in order to query the appropriate mmlib and return the error handler if there is one.

getReadErrors()

Returns the list of error messages generated from the reading operations since the most recent clearReadErrors() call. Note that this could be an empty list if now errors have beenn encountered.

startErrorQueuing()

Queue error messages and suppress printing to the stream.

stopErrorQueuing()

Turn off error queueing and add any error messages to the error_queue attribute. And restore printing to the stream.

class schrodinger.structure.MaestroReader(filename, index=1, error_handler=None, input_string=None)

Bases: schrodinger.structure.FormatReader

A class for reading structures from a Maestro (M2io) format file.

read_mode = 16
__init__(filename, index=1, error_handler=None, input_string=None)

Initialize the reader.

Parameters:
  • filename (string) – The filename to read.
  • index (int) – The index of the first structure to read.
  • error_handler (int) – The handle of the mmerr object to use for error logging. Defaults to schrodinger.infra.mm.error_handler.
  • input_string (string) – A string with the contents of a Maestro format file. If provided, the filename argument is ignored.
__del__(_mmct_terminate=<wrapped function mmct_terminate>, _m2io_terminate=<wrapped function m2io_terminate>)
__iter__()
getErrorHandler()

Returns the error handler by querying the m2io library and if the refcount is > 0 then return the error handler that is in use by m2io. Otherwise None is returned.

seek(position)

Set the file position to the given position. This raise an exception for zero size file.

read(position=None)

Return the next Structure object. If position is given, this will be honoured. Otherwise the current position is taken. This raise an exception for zero size file, reading structure beyond end of file indicator and m2io errors.

Raises:
  • EOFError – on EOF or zero size file.
  • Exception – otherwise.
__next__()

Return the next Structure object from the file. Set self.last_position to the file offset just before it was read.

Raises:
  • StopIteration – on EOF or zero size file.
  • mm.MmException or Exception – otherwise.
close()

Close the file.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': ' A class for reading structures from a Maestro (M2io) format file. ', 'read_mode': 16, '__init__': <function MaestroReader.__init__>, '__del__': <function MaestroReader.__del__>, '__iter__': <function MaestroReader.__iter__>, 'getErrorHandler': <function MaestroReader.getErrorHandler>, '_open': <function MaestroReader._open>, 'seek': <function MaestroReader.seek>, 'read': <function MaestroReader.read>, '__next__': <function MaestroReader.__next__>, 'close': <function MaestroReader.close>})
__dir__() → list

default dir() implementation

__enter__()
__eq__

Return self==value.

__exit__(type, value, tb)
__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

clearReadErrors()

Clears the list of read errors.

getReadErrors()

Returns the list of error messages generated from the reading operations since the most recent clearReadErrors() call. Note that this could be an empty list if now errors have beenn encountered.

startErrorQueuing()

Queue error messages and suppress printing to the stream.

stopErrorQueuing()

Turn off error queueing and add any error messages to the error_queue attribute. And restore printing to the stream.

class schrodinger.structure.MaestroReaderWithPositions(filename, positions, error_handler=None)

Bases: schrodinger.structure.MaestroReader

A class for rapid random access to the structures in a Maestro file. Structures are read from a user-specified sequence of file positions (offsets). Here is one how one might use it to sort an input structure by glide score (‘r_i_glide_gscore’):

# Read input file, accumulating a list of glide scores and file
# positions:
reader = structure.MaestroReader('input.mae')
position_list = []
for st in reader:
    position_list.append((st.property['r_i_glide_gscore'],
            reader.last_position))

# Sort by glide score:
position_list.sort()

# Obtain a list of file positions from the sorted list:
positions = [record[1] for record in position_list]

# Read input file in sorted order and write the structures to output:
reader = structure.MaestroReaderWithPositions('input.mae', positions)
writer = structure.MaestroWriter('output.mae')
for st in reader:
    writer.append(st)
__init__(filename, positions, error_handler=None)

Like MaestroReader.__init__(), except here there is no optional index argument; instead, the user must supply a ‘positions’ argument, which must be an iterable giving file offsets for the structures to be read.

__next__()

Return the next requested Structure object from the file. Set self.last_position to the file offset it was read from.

__class__

alias of builtins.type

__del__(_mmct_terminate=<wrapped function mmct_terminate>, _m2io_terminate=<wrapped function m2io_terminate>)
__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': "\n A class for rapid random access to the structures in a Maestro file.\n Structures are read from a user-specified sequence of file positions\n (offsets). Here is one how one might use it to sort an input structure\n by glide score ('r_i_glide_gscore')::\n\n # Read input file, accumulating a list of glide scores and file\n # positions:\n reader = structure.MaestroReader('input.mae')\n position_list = []\n for st in reader:\n position_list.append((st.property['r_i_glide_gscore'],\n reader.last_position))\n\n # Sort by glide score:\n position_list.sort()\n\n # Obtain a list of file positions from the sorted list:\n positions = [record[1] for record in position_list]\n\n # Read input file in sorted order and write the structures to output:\n reader = structure.MaestroReaderWithPositions('input.mae', positions)\n writer = structure.MaestroWriter('output.mae')\n for st in reader:\n writer.append(st)\n\n ", '__init__': <function MaestroReaderWithPositions.__init__>, '__next__': <function MaestroReaderWithPositions.__next__>})
__dir__() → list

default dir() implementation

__enter__()
__eq__

Return self==value.

__exit__(type, value, tb)
__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__iter__()
__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

clearReadErrors()

Clears the list of read errors.

close()

Close the file.

getErrorHandler()

Returns the error handler by querying the m2io library and if the refcount is > 0 then return the error handler that is in use by m2io. Otherwise None is returned.

getReadErrors()

Returns the list of error messages generated from the reading operations since the most recent clearReadErrors() call. Note that this could be an empty list if now errors have beenn encountered.

read(position=None)

Return the next Structure object. If position is given, this will be honoured. Otherwise the current position is taken. This raise an exception for zero size file, reading structure beyond end of file indicator and m2io errors.

Raises:
  • EOFError – on EOF or zero size file.
  • Exception – otherwise.
read_mode = 16
seek(position)

Set the file position to the given position. This raise an exception for zero size file.

startErrorQueuing()

Queue error messages and suppress printing to the stream.

stopErrorQueuing()

Turn off error queueing and add any error messages to the error_queue attribute. And restore printing to the stream.

exception schrodinger.structure.OptionError

Bases: Exception

A parent exception class to indicate an error in setting an option.

__cause__

exception cause

__class__

alias of builtins.type

__context__

exception context

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n A parent exception class to indicate an error in setting an option.\n\n ', '__weakref__': <attribute '__weakref__' of 'OptionError' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init__

Initialize self. See help(type(self)) for accurate signature.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__setstate__()
__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__suppress_context__
__traceback__
__weakref__

list of weak references to the object (if defined)

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception schrodinger.structure.UnsupportedOption(option_name, class_name)

Bases: schrodinger.structure.OptionError

An exception class to indicate an attempt to set an option that is not supported.

__init__(option_name, class_name)

Initialize self. See help(type(self)) for accurate signature.

__cause__

exception cause

__class__

alias of builtins.type

__context__

exception context

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n An exception class to indicate an attempt to set an option that is not\n supported.\n\n ', '__init__': <function UnsupportedOption.__init__>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__setstate__()
__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__suppress_context__
__traceback__
__weakref__

list of weak references to the object (if defined)

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception schrodinger.structure.UnsupportedOptionValue(option_name, option_value, class_name)

Bases: schrodinger.structure.OptionError

An exception class to indicate an attempt to set an option to a value that is supported.

__init__(option_name, option_value, class_name)

Initialize self. See help(type(self)) for accurate signature.

__cause__

exception cause

__class__

alias of builtins.type

__context__

exception context

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n An exception class to indicate an attempt to set an option to a value\n that is supported.\n\n ', '__init__': <function UnsupportedOptionValue.__init__>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__setstate__()
__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__suppress_context__
__traceback__
__weakref__

list of weak references to the object (if defined)

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class schrodinger.structure.MaestroWriter(filename, overwrite=True)

Bases: schrodinger.structure._BaseWriter

A class for more efficient appending of a large number of structures to a single maestro structure file.

For writing single structures, just use the Structure.write method. For appending a small (less than a thousand) number of structures, the Structure.append method will perform acceptably.

__init__(filename, overwrite=True)

Initialize needed mmlibs and open the file ‘filename’.

Note that the file will not be completely written until it is explicitly closed or the object is garbage collected.

Parameters:
  • filename (str) – The filename to write to.
  • overwrite (bool) – If False, append to an existing file if it exists.
append(ct)

Append the provided structure to the open mae file. Set self.last_position to the file offset just before it was appended.

The use of this class and method should be preferred for large numbers of structures (say, >1000), but for smaller numbers of structures you can use the Structure.append method directly.

close()

Close the file.

__del__()

Close the file and terminate the mmlibs.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n A class for more efficient appending of a large number of structures to\n a single maestro structure file.\n\n For writing single structures, just use the Structure.write method.\n For appending a small (less than a thousand) number of structures, the\n Structure.append method will perform acceptably.\n\n ', '__init__': <function MaestroWriter.__init__>, 'append': <function MaestroWriter.append>, 'close': <function MaestroWriter.close>, '__del__': <function MaestroWriter.__del__>})
__dir__() → list

default dir() implementation

__enter__()
__eq__

Return self==value.

__exit__(type, value, tb)
__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

setOption(option, value)

Set a single option for this writer. This method is meant for options that may not be supported for all writer formats. See the StructureWriter class documentation for details on the available options.

Raises an OptionError subclass (either UnsupportedOption or UnsupportedOptionValue) if unsuccessful.

Parameters:
  • option (str) – The name of the option to set.
  • value – The value for the option. The data type of this parameter depends on the option being set.
class schrodinger.structure.SDWriter(filename, overwrite=True)

Bases: schrodinger.structure._BaseWriter

A class for more efficient appending of a large number of structures to a single SD structure file.

For writing single structures, just use the Structure.write method. For appending a small (less than a thousand) number of structures, the Structure.append method will perform acceptably.

__init__(filename, overwrite=True)

Initialize needed mmlibs and open the file ‘filename’.

Note that the file will not be completely written until it is explicitly closed or the object is garbage collected.

Parameters:
  • filename (str) – The filename to write to.
  • overwrite (bool) – If False, append to an existing file if it exists.
setOption(option, value)

Set an option not supported for all StructureWriter formats.

The only supported option for SDWriter is stereo. See the StructureWriter docstring for details on the option values.

append(ct)

Append the provided structure to the open file.

close()

Close the file.

__del__()

Close the file and terminate the mmlibs.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n A class for more efficient appending of a large number of structures to\n a single SD structure file.\n\n For writing single structures, just use the Structure.write method.\n For appending a small (less than a thousand) number of structures, the\n Structure.append method will perform acceptably.\n\n ', '__init__': <function SDWriter.__init__>, 'setOption': <function SDWriter.setOption>, 'append': <function SDWriter.append>, 'close': <function SDWriter.close>, '__del__': <function SDWriter.__del__>})
__dir__() → list

default dir() implementation

__enter__()
__eq__

Return self==value.

__exit__(type, value, tb)
__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.structure.Mol2Writer(filename, overwrite=True)

Bases: schrodinger.structure._BaseWriter

Mol2 support for the StructureWriter class.

__init__(filename, overwrite=True)

Initialize needed mmlibs and open the file ‘filename’.

Parameters:
  • filename (str) – The filename to write to.
  • overwrite (bool) – If False, append to an existing file if it exists.
append(st)

Append the provided structure to the file.

close()
__del__()
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n Mol2 support for the StructureWriter class.\n\n ', '__init__': <function Mol2Writer.__init__>, 'append': <function Mol2Writer.append>, 'close': <function Mol2Writer.close>, '__del__': <function Mol2Writer.__del__>})
__dir__() → list

default dir() implementation

__enter__()
__eq__

Return self==value.

__exit__(type, value, tb)
__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

setOption(option, value)

Set a single option for this writer. This method is meant for options that may not be supported for all writer formats. See the StructureWriter class documentation for details on the available options.

Raises an OptionError subclass (either UnsupportedOption or UnsupportedOptionValue) if unsuccessful.

Parameters:
  • option (str) – The name of the option to set.
  • value – The value for the option. The data type of this parameter depends on the option being set.
class schrodinger.structure.PDBWriter(filename, reorder_by_sequence=False, first_occ=False, translate_pdb_resnames=True)

Bases: schrodinger.structure._ReaderWriterContextManager

A class for writing PDB-formatted files. Only one structure can be written to a PDB file. While this class overs no speed increase over the Structure.write() method, it provides more options.

__init__(filename, reorder_by_sequence=False, first_occ=False, translate_pdb_resnames=True)

Initialize needed mmlibs and open the file ‘filename’.

Note that the file will not be completely written until it is explicitly closed or the object is garbage collected.

Parameters:
  • filename (str) – The filename to write to.
  • reorder_by_sequence (bool) – Whether to re-order the residues by sequence before writing the PDB file.
  • first_occ (bool) – If True and there are alternate occupancy sites, only the first occupancy site will be included in the output PDB file. Otherwise, all occupancy sites will be included.
  • translate_pdb_resnames (bool) – If True, the pdb residue names get converted to a standard set. If False, the translation is turned off.

NOTE: Any existing file will be overwritten when the class instance is created.

write(ct)

Write the provided structure to the PDB file.

append(ct)

Alias to the write() method (for consistency with the other Writer classes).

close()

Does nothing. Added for consistency with other Writer classes.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n A class for writing PDB-formatted files. Only one structure can be written\n to a PDB file. While this class overs no speed increase over the\n Structure.write() method, it provides more options.\n\n ', '__init__': <function PDBWriter.__init__>, 'write': <function PDBWriter.write>, 'append': <function PDBWriter.append>, 'close': <function PDBWriter.close>})
__dir__() → list

default dir() implementation

__enter__()
__eq__

Return self==value.

__exit__(type, value, tb)
__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.structure.StructureWriter(filename, overwrite=True, format=None, stereo=None)

Bases: schrodinger.structure._ReaderWriterContextManager

A class for efficient writing of multiple structures to a single structure file. If you are writing a single structure, you can more easily use the Structure.write method.

Options that are not supported for all formats can be set with the setOption method, for example:

writer = StructureWriter(filename)
try:
    writer.setOption(stereo=STEREO_FROM_ANNOTATION)
except OptionError:
    # take action based on unsupported option/value here

Currently, the following options are available:

  • stereo
    • This option controls how stereochemical properties are written. It does not affect the output geometry.
    • This option is supported for SD, SMILES, and SMILESCSV, although not all options are supported for SD.
    • Option values are NO_STEREO, STEREO_FROM_ANNOTATION_AND_GEOM, STEREO_FROM_ANNOTATION, and STEREO_FROM_GEOMETRY.
    • The default value is STEREO_FROM_ANNOTATION_AND_GEOM.
    • With STEREO_FROM_ANNOTATION_AND_GEOM, current annotation properties of the Structure are used when present. Chiral atoms without annotation properties will have their stereochemistry determined from geometry (if possible) and will be written with definite stereochemical configuration.
    • With NO_STEREO, no stereochemical information will be written.
    • With STEREO_FROM_ANNOTATION, stereochemical information will be written based only on the current annotations. Use this option to allow for specification of stereochemistry on some centers while leaving others undefined. This should be faster than identifying stereochemistry from the 3D geometry.
    • With STEREO_FROM_GEOMETRY, stereochemistry will be written for all chiral atoms based on the 3D geometry. This option is not supported for SD format.
__init__(filename, overwrite=True, format=None, stereo=None)

Create a structure writer class based on the format.

Parameters:
  • filename (str) – The filename to write to.
  • overwrite (bool) – If False, append to an existing file instead of overwriting it.
  • format (str) – The format of the file. Values should be specified by one of the module-level constants MAESTRO, MOL2, SD, SMILES, or SMILESCSV. If the format is not explicitly specified it will be determined from the suffix of the filename. Multi-structure PDB files are not supported.
  • stereo (enum) –
    Use of the stereo option in the constructor is pending deprecation. Please use the setOption method instead.

    See the class docstring for documentation on the stereo options.

append(ct)

Append the provided structure to the open file.

extend(cts)

Append all provided structures to the open file.

close()

Close the file.

setOption(option, value)

Set a single option for this writer. This method is meant for options that may not be supported for all writer formats. See the StructureWriter class documentation for details on the available options.

Raises an OptionError subclass (either UnsupportedOption or UnsupportedOptionValue) if unsuccessful.

Parameters:
  • option (str) – The name of the option to set.
  • value – The value for the option. The data type of this parameter depends on the option being set.
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n A class for efficient writing of multiple structures to a single\n structure file. If you are writing a single structure, you can more\n easily use the `Structure.write` method.\n\n Options that are not supported for all formats can be set with the\n setOption method, for example::\n\n writer = StructureWriter(filename)\n try:\n writer.setOption(stereo=STEREO_FROM_ANNOTATION)\n except OptionError:\n # take action based on unsupported option/value here\n\n Currently, the following options are available:\n\n - `stereo`\n - This option controls how stereochemical properties are written. It\n does not affect the output geometry.\n - This option is supported for `SD`, `SMILES`, and `SMILESCSV`,\n although not all options are supported for `SD`.\n - Option values are `NO_STEREO`,\n `STEREO_FROM_ANNOTATION_AND_GEOM`, `STEREO_FROM_ANNOTATION`,\n and `STEREO_FROM_GEOMETRY`.\n - The default value is `STEREO_FROM_ANNOTATION_AND_GEOM`.\n - With `STEREO_FROM_ANNOTATION_AND_GEOM`, current annotation\n properties of the Structure are used when present. Chiral atoms\n without annotation properties will have their stereochemistry\n determined from geometry (if possible) and will be written with\n definite stereochemical configuration.\n - With `NO_STEREO`, no stereochemical information will be written.\n - With `STEREO_FROM_ANNOTATION`, stereochemical information will\n be written based only on the current annotations. Use this option to\n allow for specification of stereochemistry on some centers while\n leaving others undefined. This should be faster than identifying\n stereochemistry from the 3D geometry.\n - With `STEREO_FROM_GEOMETRY`, stereochemistry will be written\n for all chiral atoms based on the 3D geometry. This option is not\n supported for `SD` format.\n\n ', '__init__': <function StructureWriter.__init__>, 'append': <function StructureWriter.append>, 'extend': <function StructureWriter.extend>, 'close': <function StructureWriter.close>, 'setOption': <function StructureWriter.setOption>})
__dir__() → list

default dir() implementation

__enter__()
__eq__

Return self==value.

__exit__(type, value, tb)
__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.structure.PDBReader(filename, index=1, error_handler=None, all_occ=True, allow_obsolete=True, use_strict_resname=False)

Bases: schrodinger.structure.FormatReader

A class for reading structures from a PDB format file.

__init__(filename, index=1, error_handler=None, all_occ=True, allow_obsolete=True, use_strict_resname=False)

Initialize with a filename, an optional starting index (default of 1) and optional error_handler (default of mm.error_handler).

all_occ - Whether to include alternative positions (default=True)

allow_obsolete - Whether to allow reading obsolete PDB files
(default=True)
use_strict_resname - Limit the residue name to 18-20 columns of pdb
record.
__del__()
close()

Close the file.

__iter__()
__next__()

Return the next Structure object from the file.

getErrorHandler()

Returns the error handler by querying the pdb library and if the refcount is > 0 then return the error handler that is in use by pdb. Otherwise None is returned.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n A class for reading structures from a PDB format file.\n\n ', '__init__': <function PDBReader.__init__>, '__del__': <function PDBReader.__del__>, 'close': <function PDBReader.close>, '__iter__': <function PDBReader.__iter__>, '_seek_current_model': <function PDBReader._seek_current_model>, '__next__': <function PDBReader.__next__>, 'getErrorHandler': <function PDBReader.getErrorHandler>})
__dir__() → list

default dir() implementation

__enter__()
__eq__

Return self==value.

__exit__(type, value, tb)
__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

clearReadErrors()

Clears the list of read errors.

getReadErrors()

Returns the list of error messages generated from the reading operations since the most recent clearReadErrors() call. Note that this could be an empty list if now errors have beenn encountered.

startErrorQueuing()

Queue error messages and suppress printing to the stream.

stopErrorQueuing()

Turn off error queueing and add any error messages to the error_queue attribute. And restore printing to the stream.

class schrodinger.structure.SDReader(filename, index=1, error_handler=None, ignore_errors=False, input_string=None, import_sdprop_as_string=False, import_sdprop_per_file=True, ignore_structureless=True)

Bases: schrodinger.structure.FormatReader

A class for reading structures from a SD format file.

__init__(filename, index=1, error_handler=None, ignore_errors=False, input_string=None, import_sdprop_as_string=False, import_sdprop_per_file=True, ignore_structureless=True)

Initialize the reader.

Parameters:
  • filename (string) – The filename to read.
  • index (int) – The index of the first structure to read.
  • error_handler (int) – The handle of the mmerr object to use for error logging. Defaults to schrodinger.infra.mm.error_handler.
  • ignore_errors (bool) – If True, bad structures will be skipped instead of raising an exception. If False, the caller may set self._previous_structure to None to continue reading past the error.
  • ignore_structureless (bool) – If False, exception will be raised for SD entries without atoms in case ignore_errors is also False (ignore_errors takes precedence, ignore_structureless makes atomless entries to be considered as errors).
  • input_string (string) – A string with the contents of an SD format file. If provided, the filename argument is ignored.
  • import_sdprop_as_string (bool) – Import all properties as strings. Setting this to True speeds file reading.
  • import_sdprop_per_file (bool) – Setting this to True indicates that all structures in the file will have the same set of properties. If this can be guaranteed, it speeds file reading.
getErrorHandler()

Returns the error handler by querying the mmmdl library and if the refcount is > 0 then return the error handler that is in use by mmmdl. Otherwise None is returned.

__del__()
close()

Close the file.

__iter__()
__next__()

Return the next Structure object from the file.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n A class for reading structures from a SD format file.\n ', '__init__': <function SDReader.__init__>, 'getErrorHandler': <function SDReader.getErrorHandler>, '__del__': <function SDReader.__del__>, 'close': <function SDReader.close>, '__iter__': <function SDReader.__iter__>, '__next__': <function SDReader.__next__>})
__dir__() → list

default dir() implementation

__enter__()
__eq__

Return self==value.

__exit__(type, value, tb)
__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

clearReadErrors()

Clears the list of read errors.

getReadErrors()

Returns the list of error messages generated from the reading operations since the most recent clearReadErrors() call. Note that this could be an empty list if now errors have beenn encountered.

startErrorQueuing()

Queue error messages and suppress printing to the stream.

stopErrorQueuing()

Turn off error queueing and add any error messages to the error_queue attribute. And restore printing to the stream.

class schrodinger.structure.Mol2Reader(filename, index=1, error_handler=None)

Bases: schrodinger.structure.FormatReader

A class for reading structures from a mol2 format file.

__init__(filename, index=1, error_handler=None)

Initialize the reader.

Parameters:
  • filename (string) – The filename to read.
  • index (int) – The index of the first structure to read.
  • error_handler (int) – The handle of the mmerr object to use for error logging. Defaults to schrodinger.infra.mm.error_handler.
__del__()
close()

Close the file.

__iter__()
getErrorHandler()

Returns the error handler by querying the mmmmol2 library and if the refcount is > 0 then return the error handler that is in use by mmmol2. Otherwise None is returned.

__next__()

Return the next Structure object from the file.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n A class for reading structures from a mol2 format file.\n ', '__init__': <function Mol2Reader.__init__>, '__del__': <function Mol2Reader.__del__>, 'close': <function Mol2Reader.close>, '__iter__': <function Mol2Reader.__iter__>, 'getErrorHandler': <function Mol2Reader.getErrorHandler>, '__next__': <function Mol2Reader.__next__>})
__dir__() → list

default dir() implementation

__enter__()
__eq__

Return self==value.

__exit__(type, value, tb)
__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

clearReadErrors()

Clears the list of read errors.

getReadErrors()

Returns the list of error messages generated from the reading operations since the most recent clearReadErrors() call. Note that this could be an empty list if now errors have beenn encountered.

startErrorQueuing()

Queue error messages and suppress printing to the stream.

stopErrorQueuing()

Turn off error queueing and add any error messages to the error_queue attribute. And restore printing to the stream.

class schrodinger.structure.StructureReader(filename=None, index=1, error_handler=None, format=None, ignore_errors=False, input_string=None)

Bases: schrodinger.structure._ReaderWriterContextManager

Read structures from files of various types.

The format is automatically determined from the extension of the specified file, or can be specified via the format option.

Example usage:

# Read the first structure in a file:
st = next(structure.StructureReader('myfile.pdb'))

# Read all structures from a file:
for st in structure.StructureReader('myfile.sdf'):
    <do something with st>

# Start reading at the second structure entry in the file
for st in structure.StructureReader('myfile.sdf', index=2):
    <do something with st>

# Assign iterator to a variable and read first 2 structures:
st_reader = structure.StructureReader('myfile.mae')
st1 = next(st_reader)
st2 = next(st_reader)
__init__(filename=None, index=1, error_handler=None, format=None, ignore_errors=False, input_string=None)

The format is determined from the file extension if no format is specified.

Parameters:
  • filename (str) – The filename to read.
  • index (int) – The index of the first structure to read.
  • error_handler (int) – The handle of the mmerr object to use for error logging. Defaults to schrodinger.infra.mm.error_handler.
  • format (str) – The format of the file, either ‘pdb’, ‘sd’, ‘mol2’, ‘maestro’ or ‘maestro_text’ (determined from file extension by default).
  • ignore_errors (bool) – If True, bad structures will be skipped instead of raising an exception. Currently only used by the SD reader.
  • input_string (str) – Use of this argument is pending deprecation. Please use the StructureReader.fromString static method instead. If this is specified then the structure will be read from this string and the filename will be ignored. The format must be specified. Currently this is only supported for Maestro and SD format.
static fromString(input_string, index=1, error_handler=None, format='maestro', ignore_errors=False)

Create a StructureReader from an input string. Currently this is only supported for Maestro and SD format.

Parameters:
  • input_string (str) – The string representation of the Structure.
  • index (int) – The index of the first structure to read.
  • error_handler (int) – The handle of the mmerr object to use for error logging. Defaults to schrodinger.infra.mm.error_handler.
  • format (str) – The format of the file, either SD (‘sd’) or MAESTRO (‘maestro’). Defaults to MAESTRO.
  • ignore_errors (bool) – If True, bad structures will be skipped instead of raising an exception. Currently only used by the SD reader.
__iter__()
__next__()
close()
getReadErrors()

Return any queued read errors.

clearReadErrors()

Clear any queued read errors.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': "\n Read structures from files of various types.\n\n The format is automatically determined from the extension of the\n specified file, or can be specified via the `format` option.\n\n Example usage::\n\n # Read the first structure in a file:\n st = next(structure.StructureReader('myfile.pdb'))\n\n # Read all structures from a file:\n for st in structure.StructureReader('myfile.sdf'):\n <do something with st>\n\n # Start reading at the second structure entry in the file\n for st in structure.StructureReader('myfile.sdf', index=2):\n <do something with st>\n\n # Assign iterator to a variable and read first 2 structures:\n st_reader = structure.StructureReader('myfile.mae')\n st1 = next(st_reader)\n st2 = next(st_reader)\n\n ", '__init__': <function StructureReader.__init__>, '_set_iterator': <function StructureReader._set_iterator>, 'fromString': <staticmethod object>, '__iter__': <function StructureReader.__iter__>, '__next__': <function StructureReader.__next__>, 'close': <function StructureReader.close>, 'getReadErrors': <function StructureReader.getReadErrors>, 'clearReadErrors': <function StructureReader.clearReadErrors>})
__dir__() → list

default dir() implementation

__enter__()
__eq__

Return self==value.

__exit__(type, value, tb)
__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

schrodinger.structure.read_ct(filename, index=1, error_handler=None)

Read a Structure from file ‘filename’, defaulting to the first one found.

Use the StructureReader or MaestroReader to access multiple structures from a single file.

Deprecated:Use the static Structure.read method instead, as it handles multiple formats and avoids the deprecated ‘ct’ name.
schrodinger.structure.write_ct_to_string(ct, error_handler=None)

Return a string representation of the provided Structure, formatted as a Maestro file.

schrodinger.structure.write_ct_to_sd_string(ct, error_handler=None)

Return a string representation of the provided Structure, formatted as an SD file.

schrodinger.structure.write_ct(ct, filename, mode=2, error_handler=None)

Write a Structure to a Maestro format file.

schrodinger.structure.write_cts(cts, filename)

Write multiple structures to a file

Parameters:
  • cts (iter) – An iterable containing the structures to write
  • filename (str) – The filename to write the structures to. File format will be determined from the filename suffix.
schrodinger.structure.write_ct_as_text(ct, filename, mode=2, error_handler=None)

Write a TextualStructure object to a Maestro format file.

schrodinger.structure.write_ct_sd(ct, filename, mode=2, error_handler=None)

Write a Structure to a SD format file.

schrodinger.structure.write_ct_mol2(ct, filename, mode=1, error_handler=None)

Write a Structure to a mol2 format file.

schrodinger.structure.write_ct_pdb(ct, filename, mode='write', error_handler=None)

Write a Structure to a PDB format file.

schrodinger.structure.write_ct_smiles(st, filename, mode='write')

Write a Structure object to a SMILES format file. Assumes that the input is a 3D file. If input is 2D (from SD file), then stereochemistry will be lost

schrodinger.structure.count_structures(filename, error_handler=None, format=None)

Returns the number of structures in the specified file. For PDB files, returns the number of MODELs. Optionally an error_handler may be specified (default of mm.error_handler).

class schrodinger.structure.PropertyName(dataname=None, type=None, family=None, username=None)

Bases: object

The PropertyName class can be used to display the “user-readable” version of an entry or atom property to the user.

Properties are stored in mae files with names in the form type_family_name, where type is a datatype indicator, family indicates the owner or creator of the property, and name is the name of the property. These strings are used as the keys in the property dictionary attributes of Structure, _StructureAtom, and _StructureBond. Examples include s_m_title, which is a string created by Maestro with the name “title”, and i_m_residue_number, which is an integer created by Maestro with the name “residue number”.

__init__(dataname=None, type=None, family=None, username=None)

The PropertyName constructor operates in one of two modes - either a dataname needs to be provided, or each of type, family, and username needs to be provided.

Parameters:
  • dataname (str) – The full property name, e.g. ‘s_m_title’.
  • type (enum) – The property value type, which must be ‘s’, ‘r’, ‘i’, or ‘b’. You can also use the predefined module constants PROP_STRING, PROP_FLOAT (or equivalently PROP_REAL), PROP_INTEGER, and PROP_BOOLEAN.
  • family (str) – The family/owner of the property. If the family is one of the recognized long family names (e.g. ‘QikProp’ - see the keys of the PROP_SHORT_NAME dict), the short family name is assigned automatically.
  • username (str) – The name a user would see displayed in the Maestro project table. Underscores are replaced with spaces unless protected by a backslash (in which case the backslash is not displayed). Internally, PropertyName will store the ‘name’, which is the fragment of the dataname that is not the type or family.
dataName()

Returns the m2io data name of form type_family_name.

This is the fully qualified name that includes the type, owner and name and should be used for all lookup, indexing, etc.

userName()

Returns the user name of this property. User name is the shortened, user-readable name that should only be used when presenting this property to the user, such as in a GUI pull down menu.

Since data names can NOT have spaces in them, while user names can, we have a convention where a space in a user name is represented as an underscore in the data name, and an underscore in the user name has to be escaped with a backslash in the data name.

Replace ‘_’ with ‘_’, and ‘_’ with ‘ ‘ before returning the user name

__str__()

Convert this PropertyName to a string

__eq__(other)

Compare this property to a string property name

__ne__(other)

Check for inequality; opposite of above

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n The PropertyName class can be used to display the "user-readable"\n version of an entry or atom property to the user.\n\n Properties are stored in `.mae` files with names in the form\n `type_family_name`, where `type` is a datatype indicator, `family`\n indicates the owner or creator of the property, and `name` is the name\n of the property. These strings are used as the keys in the `property`\n dictionary attributes of `Structure`, `_StructureAtom`, and\n `_StructureBond`. Examples include `s_m_title`, which is a string\n created by Maestro with the name "title", and `i_m_residue_number`,\n which is an integer created by Maestro with the name "residue number".\n\n ', '__init__': <function PropertyName.__init__>, 'dataName': <function PropertyName.dataName>, 'userName': <function PropertyName.userName>, '__str__': <function PropertyName.__str__>, '__eq__': <function PropertyName.__eq__>, '__ne__': <function PropertyName.__ne__>, '__dict__': <attribute '__dict__' of 'PropertyName' objects>, '__weakref__': <attribute '__weakref__' of 'PropertyName' objects>, '__hash__': None})
__dir__() → list

default dir() implementation

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__ = None
__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.structure.TextualStructure(ct, txt)

Bases: schrodinger.structure.Structure

A sub-class of Structure for use when reading from a Maestro format file and only the structure-level properties are needed. The actual atom and bond records are not parsed from the file and so can’t actually be accessed. The only things possible with this type of Strucure are to access the structure level properties or to write it out unchanged to a file. Attempts to access the atom or bond data, directly or indirectly, will raise an exception.

The only useful way to create a TextualStructure object is via the StructureReader with the ‘maestro_text’ format.

__init__(ct, txt)

Initialize the TextualStructure object. The Structure handle will usually have no atoms but will have an unrequested data handle associated with it which can be used to access the Structure-level properties. ‘txt’ should be the full textual representation of the f_m_ct block as read from the Maestro format file.

__str__()

Return the structure object as a text string

atom

An iterable of structure atoms, each of which is a _StructureAtom instance.

Example usage, where st is a Structure instance:

# Access an atom (indices start at 1)
atomobj = st.atom[n]

# Delete an atom
del st.atom[n]

# Find the number of atoms
len(st.atom)

# Iterate over all atoms
for atom in st.atom:
    take_some_action(atom)
Note:As with many other collections, the contents of the atom list should not be modified through additions or deletions while you are iterating over it.
molecule

An iterable of molecules in the structure, each of which is a _Molecule instance.

Example usage:

# Find the number of molecules in the structure
len(st.molecule)

# Retrieve a molecule by number (indices start at 1)
mol = st.molecule[molnum]

# Iterate over all molecules
for mol in st.molecule:
    take_some_action(mol)
Note:Atoms and bonds should not be added or deleted while you are iterating over molecules.
chain

An iterable of chains in the structure, each of which is a _Chain instance.

Example usage:

# Find the number of chains in the structure
len(st.chain)

# Retrieve a _Chain instance by letter
chain = st.chain[letter]

# Iterate over chains
for chain in st.chain:
    take_some_action(chain)
Note:Atoms and bonds should not be added or deleted while you are iterating over chains.
residue

An iterable of residues in the structure, each of which is a _Residue instance.

To iterate over all residues:

for residue in st.residue:
    take_some_action(residue)
Note:Atoms and bonds should not be added or deleted while you are iterating over residues.
Note:residues are not accessible by index. See Structure.findResidue()
ring

An iterable of rings in the structure, each of which is a _Ring instance.

To iterate over rings:

for ring in st.ring:
    take_some_action(ring)
Note:Atoms and bonds should not be added or deleted while you are iterating over rings.
property

Dictionary-like container of structure properties. Keys are strings of the form type_family_name as described in the PropertyName documentation.

Note:Unlike the Structure.property dictionary, this dictionary is read-only.
write(filename, format=None)

Write the structure to a file, overwriting any previous content. File will only be written to Maestro format.

append(filename, format=None)

Append the structure to the file. File will only be written to Maestro format.

putToM2ioFile(filehandle)

Used by the Maestro writer - put a single structure to the (already open) filehandle

closeBlockIfNecessary(filehandle)

Used by the Maestro writer to leave the header block if necessary. For Structure objects this is not needed so it only returns

__class__

alias of builtins.type

__copy__()

Allows the structure to be copied by copy.copy

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': "\n A sub-class of Structure for use when reading from a Maestro format file\n and only the structure-level properties are needed. The actual atom and\n bond records are not parsed from the file and so can't actually be\n accessed. The only things possible with this type of Strucure are to\n access the structure level properties or to write it out unchanged to a\n file. Attempts to access the atom or bond data, directly or indirectly,\n will raise an exception.\n\n The only useful way to create a TextualStructure object is via the\n StructureReader with the 'maestro_text' format.\n\n ", '__init__': <function TextualStructure.__init__>, '__str__': <function TextualStructure.__str__>, 'atom': <property object>, 'molecule': <property object>, 'chain': <property object>, 'residue': <property object>, 'ring': <property object>, 'property': <property object>, 'write': <function TextualStructure.write>, 'append': <function TextualStructure.append>, 'putToM2ioFile': <function TextualStructure.putToM2ioFile>, 'closeBlockIfNecessary': <function TextualStructure.closeBlockIfNecessary>})
__dir__() → list

default dir() implementation

__eq__(other)

Check for equality with other Structure instances based on the MMCT handle.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__getstate__()

Return a string representation for use by pickle.

__gt__

Return self>value.

__hash__()

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__int__()

Return the underlying mmct handle when coerced to an integer.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__(other)

Check for inequality with other Structure instances based on the MMCT handle.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__()

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__setstate__(state)

Allows Structure to be unpickled by reading in a string representation

__sizeof__() → int

size of object in memory, in bytes

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

addAtom(element, x, y, z, color=None, atom_type=None)

Add a new atom to the structure. Return the created _StructureAtom object.

addAtoms(num_atoms)

Add the specified number of atoms to this structure.

The following atom attributes will have to be set for each atom afterwards:

  • element
  • x, y, z
  • color
  • atom_type
addBond(atom1, atom2, bond_type)

Add a bond of the specified type between the two atoms atom1 and atom2. The atom parameters can be _StructureAtom objects or integer indices from 1 to the number of atoms in the structure. If the two atoms are already bound then the bond type is just changed.

:param bond_type bond type (legacy integer 0-3 bond order)

addBonds(bonds_list)

Add multiple bonds to this structure. This is much faster than multiple calls to addBond() method when many bonds need to be added. Bonds are specified by a list of integer lists: (atom1, atom2, bond_type).

Example::
st.addBonds([(10, 11, 1), (12, 13, 2)])

This will add a single-order bond between atoms 10 and 11, and a double-order bond between atoms 12 and 13.

adjust(value, atom1, atom2, atom3=None, atom4=None)

Adjust a distance, angle or dihedral angle. If atom3 is None then the distance between atom1 and atom2 will be set to value, atom2 and all atoms attached to that atom will be moved. If atom4 is None then the angle between atom1, atom2 and atom3 will set to value, atom3 and all other atoms attached to that will be moved. If all atoms are specified then the dihedral angle made by atom1, atom2, atom3 and atom4 will be set to value and atom4 and all other atoms attached to that will be moved. All distances are specified in Angstroms, all angles in degrees.

All atom arguments can be integers or _StructureAtom objects. There is no return value for this function.

Raises:AtomsInRingError – if specified atoms are within a ring system. If ring distortion from an adjustment is not an issue, then the moving bitset can be manually created and passed to mmct_atom_set_distance(), mmct_atom_set_bond_angle(), or mmct_atom_set_dihedral_angle().
applyStyle(atoms=3, bonds=3, atom_list=None)

Applies the given display styles to the atoms and bonds of the entire structure (by default) or to the atoms (and their bonds) given in atom_list.

Parameters:
  • atoms (int) – Display style for atoms, given by structure module constants ATOM_NOSTYLE, ATOM_CIRCLE, ATOM_CPK, ATOM_BALLNSTICK. Default is ATOM_BALLNSTICK.
  • atoms – Display style for bonds, given by structure module constants BOND_NOSTYLE, BOND_WIRE, BOND_TUBE, BOND_BALLNSTICK. Default is BOND_BALLNSTICK.
  • atom_list (iterable) – An iterable of atom objects or atom indices to apply the given styles to. If not included the styles are applied to all atoms in the structure. Possible examples include:: [1, 3, 5] ring.atom schrodinger.structutils.analyze.evalulate_asl(asl_expr) [structure.atom[x] for x in xrange(50)] maestro.selected_atoms_get()
areBound(atom1, atom2)

Returns True if atom1 and atom2 have a bond of any order between them and False is there is no bond.

atom_total

Get total number of atoms in this structure

bond

An iterable of structure bonds, each of which is a _StructureBond instance.

To iterate over bonds:

for bond in st.bond:
    take_some_action(bond)
Note:Atoms and bonds should not be added or deleted while you are iterating over bonds.
Note:Bonds are not accessible by index.
copy()

Returns a copy of the structure.

deleteAtoms(indices, renumber_map=False)

Delete multiple atoms from the Structure. The argument indices must be a sequence or an iterable, and able to be interpreted as ints.

After deletion, indices are renumbered from 1 to len(atoms). Pre-existing references to Structure atoms will not be correct, as they store index values.

If renumber_map is set to True, will return a renumbering dictionary. Keys are atom numbers before deleting, and value for each is the new atom number, or None if that atom was deleted.

deleteBond(atom1, atom2)

Delete the bond between atom1 and atom2. Raises an Exception if there is no bond between these two.

extend(other_structure)

Add the atoms in other_structure to the end of the current structure. The other_structure is left unchanged.

Extending a structure with itself is not allowed.

extract(indices, copy_props=False)

Return a new structure object which contains the atoms of the current structure that appear in the specified list. The argument indices must be a sequence or an iterable, and able to be interpreted as ints.

After extractions, indices are renumbered from 1 to len(atoms). Pre-existing references to Structure atoms will not be correct, as they store index values.

If copy_props is set to True, then the new structure object will inherit Structure-level properties from the source object.

findResidue(query)

Returns a _Residue object matching the given string (e.g. “A:123”). Currently only protein residues are supported.

If no residues were found that match the given string, or if the given string is of improper format, ValueError is raised.

Note:If the structure has more than one matching residue, then only the first match will be returned.
find_rings(sort=True)

Find all rings in the structure using SSSR.

Each ring is returned in connectivity order.

Parameters:sort (bool) – Deprecated and unused
Returns:A list of lists of integers corresponding to the atom indices of the rings.
formal_charge

Get the sum of formal charges for the structure.

Accessing this property is an O(N) operation.

generate3dConformation(require_stereo=True)

Generate new 3D coordinates for the current structure, and add hydrogens if any are missing. This method is useful for “volumizing” a 2D structure into 3D. NOTE: For 2D inputs, annotation properties must be present for chiral centers to be processed correctly.

Parameters:require_stereo (bool) – Whether to require all chiral centers to have defined stereochemistry via annotation properties. Defaults to True. UndefinedStereochemistry exception is raised if any chiral atom has ambiguous chirality. If set to False, ambiguous chiralities will be expanded arbitrarily.
get3dStructure(require_stereo=True)
Deprecated:Use generate3dConformation() instead.
getAtomIndices()

Return a list of all atom indices in this structure.

getBond(atom1, atom2)

Returns a _StructureBond object for the bond between atom1 and atom2. The atom parameters can be _StructureAtom objects or integer indices from 1 to the number of atoms in the structure.

getChainAtoms(atom)

Return a list of atom objects that are in the same chain as ‘atom’.

getMoleculeAtoms(atom)

Return a list of atom objects that are in the same molecule as ‘atom’.

getMovingAtoms(fixed_atom, moving_atom)

Returns all atoms that would move if <moving_atom> is moved while <fixed_atom> is frozen. This effectively returns all atoms in the same molecule substructure as <moving_atom> (atoms in the same substructure as fixed_atom are excluded).

In other words, if the bond between the moving_atom and fixed_atom (or towards the direction of fixed_atom) were to be broken, the atoms that would be in the same molecule as moving_atom are returned. Can be used for detecting things like residue side-chain atoms, etc.

Note:

If fixed_atom and moving_atom are part of different molecules, then all atoms in the moving_atom’s molecule will be returned. If fixed_atom and moving_atom are not bound directly, the intervening atoms will not be included in the result. If fixed_atom and moving_atom are connected with more than one path (are in a ring), then ValueError is raised.

Parameters:
  • fixed_atom (Atom index or _StructureAtom.) – Atom which is part of the molecule that is to be excluded from the result (frozen, not being moved).
  • moving_atom (Atom index or _StructureAtom.) – Atom of interest (atom to be moved); a set of atoms that would be moved with it (connected to it) will be returned.
Return type:

Set of ints

Returns:

Set of atom indices for atoms “connected” to moving_atom - those atoms that would be moved with it if it was moved. For example, if called with alpha carbon and beta carbon atoms of a protein residue, then all side-chain atoms would be returned. Atom moving_atom will also be included.

Raises ValueError if the given atoms are part of a ring (in other words, moving_atom is connected to fixed_atom via more than one path). This may happen if part of the moving_atom’s “chain” is bonded to something unexpected; e.g. ZOBed to metals, or involved in a di-sulfide bond.

getResidueAtoms(atom)

Return a list of atom objects that are in the same residue as ‘atom’.

getXYZ(copy=True)

Get a numpy array of the xyz coordinates of all atoms in the molecule with shape (atom_total, 3). Note that numpy arrays are indexed starting with 0.

You can avoid copying the underlying data by specifying copy=False, in which case modifying any values will modify the coordinate values in the Structure.

Note that if coordinates are retrieved with copy=False they will become invalid after their source Structure has been garbage collected. Any use of them after this point will likely cause a core dump. This is because the python numpy array provides access directly to the underlying C data.

has3dCoords()

Returns True if any atom in the structure has a non-zero z-coordinate.

isEquivalent(struct, check_stereo=True)

Return True if the 2 structures are equivalent Return False if the 2 structures are different

struct: Another structure class object

check_stereo: Specifies whether or not to check stereo chemistry.

measure(atom1, atom2, atom3=None, atom4=None)

Return the measurement for the provided atoms. If atom3 is None, return the distance between atom1 and atom2. If atom4 is None, return the angle with atoms 1 through 3, and if all atoms are provided, return the dihedral angle.

All atom arguments can be integers or _StructureAtom objects.

If Periodic Boundary Condition CT-level properties are defined, uses the PBC measurement.

See also the structutil.measure module, which has functions to make measurements between atoms in different structures, and can also measure angles between planes.

merge(other_structure, copy_props=False)

Return a new structure object which contains the atoms of the current structure and the atoms of other_structure.

If copy_props is True, properties from the current structure and other_structure will be added to the new structure. If the same property is specifed in both the current structure and other_structure, the current value will take precedence.

mol_total

Get total number of molecules in this structure

static read(filename, index=1, error_handler=None, format=None, ignore_errors=False)

Read a single structure from file ‘filename’, returning a Structure instance.

Parameters:
  • index (int) – For multi-structure formats, the index of the structure to read.
  • error_handler (int) – Handle of the mmerr object to use for error logging. Defaults to schrodinger.infra.mm.error_handler.
  • format (str) – Format of the file, either ‘pdb’, ‘sd’, ‘mol2’, ‘maestro’ or ‘maestro_text’ (determined from file extension by default).
  • ignore_errors (bool) – If True, bad structures will be skipped instead of raising an exception. Currently only used by the SD reader.
retype()

Reassign all the MacroModel atom types based on the bond orders and formal charges. This function should be called after either of these have been changed.

setXYZ(xyz)

Set all xyz coordinates for the molecule from a numpy array.

title

Get the title for this structure

total_weight

The sum of atomic weights for the whole structure.

The weight of implicit hydrogens is automatically included.

Accessing this property is an O(N) operation.

writeToString(format)

Write the structure to a string representation and return the string. The format parameter is required.

class schrodinger.structure.SmilesStructure(pattern, properties=None)

Bases: object

SMILES representation of a Structure that is returned by SmilesReader and SmilesCsvReader. When written to a SMILES-formatted file, properties other than the title are not retained.

mmsmiles_initialized = False
__init__(pattern, properties=None)

Initialize self. See help(type(self)) for accurate signature.

__str__()

Return a string representation of this structure.

write(filename)

Write the structure to a SMILES formatted file.

append(filename)

Append the structure to a SMILES formatted file.

get2dStructure()

Return a 2D Structure object for this SMILES. The structure will have only 2D coordinates, with stereo annotation properties for chiral atoms with specified chirality. NOTE: Use for 2D applications only.

Return type:Structure.Structure
Returns:2D structure.
Raises:ValueError – if self.smiles is set to an invalid SMILES string.
get3dStructure(require_stereo=True)

Return a 3D Structure object for this SMILES with all hydrogens added.

Parameters:require_stereo (bool) – Whether to require all chiral centers to have defined stereochemistry via annotation properties. Defaults to True. UndefinedStereochemistry exception is raised if any chiral atom has ambiguous chirality. If set to False, ambiguous chiralities will be expanded arbitrarily.
Return type:Structure.Structure
Returns:Volumized 3D structure.
neutralize()

Neutralize this SMILES structure.

title
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n SMILES representation of a Structure that is returned by SmilesReader\n and SmilesCsvReader. When written to a SMILES-formatted file, properties\n other than the title are not retained.\n\n ', 'mmsmiles_initialized': False, '__init__': <function SmilesStructure.__init__>, '__str__': <function SmilesStructure.__str__>, 'write': <function SmilesStructure.write>, 'append': <function SmilesStructure.append>, '_writeSmiles': <function SmilesStructure._writeSmiles>, '_writeSmilesCsv': <function SmilesStructure._writeSmilesCsv>, 'get2dStructure': <function SmilesStructure.get2dStructure>, 'get3dStructure': <function SmilesStructure.get3dStructure>, 'neutralize': <function SmilesStructure.neutralize>, 'title': <property object>, '__dict__': <attribute '__dict__' of 'SmilesStructure' objects>, '__weakref__': <attribute '__weakref__' of 'SmilesStructure' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.structure.SmilesReader(filename, index=1)

Bases: schrodinger.structure._ReaderWriterContextManager

A class for reading structures from a SMILES formatted file. Returns instances of SmilesStructure.

__init__(filename, index=1)

Initialize with a filename, an optional starting index (default of 1).

__del__()
__iter__()

Return the iterator for all SmilesStructures from the file

__next__()

Return the next SmilesStructure from the file.

Raises StopIteration on EOF.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n A class for reading structures from a SMILES formatted file.\n Returns instances of SmilesStructure.\n\n ', '__init__': <function SmilesReader.__init__>, '__del__': <function SmilesReader.__del__>, '__iter__': <function SmilesReader.__iter__>, '__next__': <function SmilesReader.__next__>})
__dir__() → list

default dir() implementation

__enter__()
__eq__

Return self==value.

__exit__(type, value, tb)
__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.structure.SmilesCsvReader(filename, index=1)

Bases: schrodinger.structure._ReaderWriterContextManager

A class for reading structures from a SMILES CSV formatted file. This format is used by Canvas. Returns instances of SmilesStructure.

__init__(filename, index=1)

Initialize with a filename, an optional starting index (default of 1).

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n A class for reading structures from a SMILES CSV formatted file.\n This format is used by Canvas.\n Returns instances of SmilesStructure.\n\n ', '__init__': <function SmilesCsvReader.__init__>, '__del__': <function SmilesCsvReader.__del__>, '__iter__': <function SmilesCsvReader.__iter__>, '__next__': <function SmilesCsvReader.__next__>})
__dir__() → list

default dir() implementation

__enter__()
__eq__

Return self==value.

__exit__(type, value, tb)
__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

__del__()
__iter__()

Return the iterator for all SmilesStructures from the file

__next__()

Return the next SmilesStructure from the file.

Raises StopIteration on EOF.

class schrodinger.structure.SmilesWriter(filename, overwrite=True, stereo=None)

Bases: schrodinger.structure._BaseWriter

More efficient writing of a large number of structures to a single SMILES file.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n More efficient writing of a large number of structures to a single SMILES\n file.\n\n ', '__init__': <function SmilesWriter.__init__>, 'append': <function SmilesWriter.append>, 'close': <function SmilesWriter.close>, '__del__': <function SmilesWriter.__del__>})
__dir__() → list

default dir() implementation

__enter__()
__eq__

Return self==value.

__exit__(type, value, tb)
__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

setOption(option, value)

Set a single option for this writer. This method is meant for options that may not be supported for all writer formats. See the StructureWriter class documentation for details on the available options.

Raises an OptionError subclass (either UnsupportedOption or UnsupportedOptionValue) if unsuccessful.

Parameters:
  • option (str) – The name of the option to set.
  • value – The value for the option. The data type of this parameter depends on the option being set.
__init__(filename, overwrite=True, stereo=None)
Parameters:
  • filename (str) – The filename to write to.
  • overwrite (bool) – If False, append to an existing file if it exists.
  • stereo (enum) – See the StructureWriter class for documentation on the allowed values.
append(st)

Append the provided structure to the open SMILES file.

close()

Close the file.

__del__()

Close the file when instance is deleted.

class schrodinger.structure.SmilesCsvWriter(filename, stereo=None, props=None)

Bases: schrodinger.structure._BaseWriter

More efficient writing of a large number of structures to a single SMILES CSV file.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n More efficient writing of a large number of structures to a single\n SMILES CSV file.\n\n ', '__init__': <function SmilesCsvWriter.__init__>, 'append': <function SmilesCsvWriter.append>, '_openWriter': <function SmilesCsvWriter._openWriter>, '_writeRow': <function SmilesCsvWriter._writeRow>, '_getCtData': <function SmilesCsvWriter._getCtData>, 'close': <function SmilesCsvWriter.close>, '__del__': <function SmilesCsvWriter.__del__>})
__dir__() → list

default dir() implementation

__enter__()
__eq__

Return self==value.

__exit__(type, value, tb)
__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

setOption(option, value)

Set a single option for this writer. This method is meant for options that may not be supported for all writer formats. See the StructureWriter class documentation for details on the available options.

Raises an OptionError subclass (either UnsupportedOption or UnsupportedOptionValue) if unsuccessful.

Parameters:
  • option (str) – The name of the option to set.
  • value – The value for the option. The data type of this parameter depends on the option being set.
__init__(filename, stereo=None, props=None)
Note:

Excessive memory may be used by this class if the props argument is not specified and many structures are appended.

Parameters:
  • filename (str) – The filename to write to.
  • stereo (enum) – See the StructureWriter class for documentation on the allowed values.
  • props (list) – List of property names to export. If specified, then the CSV header is derived from this list, and structure lines are written by the append() method. If not specified, then CSV header will include all properties of all structures, and the output file will only be written when the close() method is called. (All structures will be cached in memory until flushed to disk.)
append(st)

Append the provided structure to the open SMILES CSV file.

close()

Close the file.

__del__()

Close the file when instance is deleted.

class schrodinger.structure.MultiFileStructureReader(files, *args, **kwargs)

Bases: schrodinger.structure._ReaderWriterContextManager

Provides a single iterator that reads structure from multiple files. Typical usage is idential to typical useage of the StructureReader class except that the class is instantiated with a python list of file names rather than a single file name.

By default, the StructureReader class is used to read the files, but this is customizable with the reacer_class keyword.

API Example:

names = ['file1.mae', 'file2.mae', 'file3.pdb']
reader = MultiFileStructureReader(names)
first_struct = next(reader)
for struct in reader:
    do stuff

By default, the reader skips files that raise Exceptions and stores the list of skipped files in the failed_files property.

The current StructureReader can be accessed with the reader property

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': "\n Provides a single iterator that reads structure from multiple files.\n Typical usage is idential to typical useage of the StructureReader class\n except that the class is instantiated with a python list of file names\n rather than a single file name.\n\n By default, the StructureReader class is used to read the files, but this is\n customizable with the reacer_class keyword.\n\n API Example::\n\n names = ['file1.mae', 'file2.mae', 'file3.pdb']\n reader = MultiFileStructureReader(names)\n first_struct = next(reader)\n for struct in reader:\n do stuff\n\n By default, the reader skips files that raise Exceptions and stores the list\n of skipped files in the failed_files property.\n\n The current StructureReader can be accessed with the reader property\n ", '__init__': <function MultiFileStructureReader.__init__>, '__iter__': <function MultiFileStructureReader.__iter__>, '_createNewReader': <function MultiFileStructureReader._createNewReader>, '__next__': <function MultiFileStructureReader.__next__>})
__dir__() → list

default dir() implementation

__enter__()
__eq__

Return self==value.

__exit__(type, value, tb)
__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

__init__(files, *args, **kwargs)

Create a MultiFileStructureReader

Parameters:
  • files (list) – A list of paths to files to be read
  • reader_class (Reader class) – By default, StructureReader is used to read the files. A more specific class can be provided, such as PDBReader
  • pass_errors (bool) – If True, any filename that raises an expected exception will be skipped. Skipped filenames are stored in the failed_files property and can be retrieved after reading. Items of the failed_files list are tuples (filename, error_message). Expected Exceptions include: IOError (does not exist, or unreadable), ValueError (unknown extension), MmException (error opening file) or an Exception while reading structures. The default of False will cause the exceptions to be raise’d.
  • skip_receptors (bool) – Whether to skip receptors of PV files.

Any additional parameters and keyword arguments are passed to the structure reader class.

reader_class = None

The class used to read files

pass_errors = None

False if exceptions should be raised, True if they should be caught

files = None

List of files remaining to be read

current_filename = None

The file currently being read

index_in_current_file = None

Index of current structure in current file

failed_files = None

List of (failed_file_name, error_message)

reader = None

Current file reader

__iter__()

Required to make the class an iterator

__next__()

Get the next structure to process. This might either be the next structure in the currently open file, or might result in the next file being opened.

Raises:StopIteration – When all structures in all files have been read
class schrodinger.structure.MultiFileStructureWriter(basename, extension='.maegz', sts_per_file=100000)

Bases: schrodinger.structure._ReaderWriterContextManager

Similar to StructureWriter, except that it writes to multiple files, while keeping the number of structures per file under sts_per_file.

Files will be named <basename>-NNN<extension>. Default extension is .maegz.

Options:

basename - The base name of the written files extension - The extension of the written files (default “.maegz”) sts_per_file - Maximum number of structures to write to each file

Usage:

writer = MultiFileStructureWriter(out_basename, ".maegz", 50)
for st in sts:
    writer.append(st)
writer.close()
written_files = writer.getFiles()
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n Similar to StructureWriter, except that it writes to multiple files,\n while keeping the number of structures per file under sts_per_file.\n\n Files will be named <basename>-NNN<extension>. Default extension is .maegz.\n\n Options:\n\n basename - The base name of the written files\n extension - The extension of the written files (default ".maegz")\n sts_per_file - Maximum number of structures to write to each file\n\n Usage::\n\n writer = MultiFileStructureWriter(out_basename, ".maegz", 50)\n for st in sts:\n writer.append(st)\n writer.close()\n written_files = writer.getFiles()\n ', '__init__': <function MultiFileStructureWriter.__init__>, 'append': <function MultiFileStructureWriter.append>, 'getFiles': <function MultiFileStructureWriter.getFiles>, 'getNumStructures': <function MultiFileStructureWriter.getNumStructures>, 'close': <function MultiFileStructureWriter.close>})
__dir__() → list

default dir() implementation

__enter__()
__eq__

Return self==value.

__exit__(type, value, tb)
__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

__init__(basename, extension='.maegz', sts_per_file=100000)

Initialize self. See help(type(self)) for accurate signature.

append(st)
getFiles()

Return a list of file paths for the written files.

getNumStructures()

Return the total number of structures that were written.

close()

Close any open file handles

schrodinger.structure.create_new_structure(num_atoms=0)

Returns a new Structure object.

If the Structure is created without atoms, they can be added with the Structure.addAtom or Structure.addAtoms methods.

Otherwise, the following atom attributes must be set for each atom afterwards:

  • element
  • x, y, z
  • color
  • atom_type
Parameters:num_atoms – The number of atoms to create the structure with.
schrodinger.structure.get_residues_by_connectivity(atom_container)

Access residues in N->C connectivity order

Parameters:atom_container (Structure._Chain, Structure._Structure, or Structure._Molecule) – Anything with an atom() method that returns atom indexes
Returns:A residue iterator where the atoms are returned in N->C connectivity order
Return type:Structure._ResidueIterator
schrodinger.structure.get_residues_unsorted(atom_container)

Access residues in the unsorted input order

Parameters:atom_container (Structure._Chain, Structure._Structure, or Structure._Molecule) – Anything with an atom() method that returns atom indexes
Returns:A residue iterator where the atoms are returned in unsorted order
Return type:Structure._ResidueIterator
schrodinger.structure.get_pyatom_from_cppatom(cppatom)

Given a C++ atom object, return the corresponding Python atom.

Parameters:cppatom (schrodinger.infra.structure.StructureAtom) – C++ atom object
Returns:The corresponding Python atom object
Return type:structure._StructureAtom
class schrodinger.structure._AtomBondContainer(ct, atom_index)

Bases: object

The class to provide access to _StructureBond instances for each bond of an atom.

__init__(ct, atom_index)

Initialize with a Structure and an atom index.

__delitem__(index)

Delete the specified bond.

__getitem__(index)

Return the wrapper class for bond based properties. Note that as in _StructureAtomContainer the initial index is 1, as expected by the C mmlibraries, not 0 as is expected for python.

__iter__()

Provide iteration access.

__len__()

Return the number of bonds by querying the Structure class.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n The class to provide access to _StructureBond instances for each bond\n of an atom.\n\n ', '__init__': <function _AtomBondContainer.__init__>, '__delitem__': <function _AtomBondContainer.__delitem__>, '__getitem__': <function _AtomBondContainer.__getitem__>, '__iter__': <function _AtomBondContainer.__iter__>, '__len__': <function _AtomBondContainer.__len__>, '__dict__': <attribute '__dict__' of '_AtomBondContainer' objects>, '__weakref__': <attribute '__weakref__' of '_AtomBondContainer' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.structure._AtomCollection(st, atoms)

Bases: object

A set of atoms, usually comprising a subset of the total atoms in a Structure. Initialize using a structure and an iterable of current atom indices.

Important methods include extractStructure and getAtomIndices. Use the atom attribute to iterate over all contained atoms. 1-based indexed access to the atoms is also possible using atom (e.g. atom[1] gets the first atom in the _AtomCollection). The number of atoms can be determined via len(self.atom) or len(self).

Intended as a base class for _Ring, _Molecule, and _Chain.

__init__(st, atoms)

Initialize self. See help(type(self)) for accurate signature.

structure

Return the parent Structure object for this atom collection.

atom

Iterate over all atoms. Also allows 1-based indexed access to the atoms.

__len__()

Return number of atoms.

getAtomIndices()

Return a list of atom indices for all atoms in this object.

Returns:List of atom indicies.
Return type:list of ints
getAtomList()

Deprecated. Use getAtomIndices() method instead.

extractStructure(copy_props=False)

Return a new Structure containing only the atoms associated with this substructure. Structure properties, including the title, are inherited only if copy_props is set to True.

temperature_factor

Average B (temperature) factor for all atoms that have it assigned. Setting this property will set the B factor to the given value for each atom.

__eq__(that)

Return True if this object and “that” object are equivalent.

__hash__()

Hash value for this atom collection. This hash uniquely identifies the object (e.g. when using it as keys to dicts or in sets).

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n A set of atoms, usually comprising a subset of the total atoms in a\n Structure. Initialize using a structure and an iterable of current atom\n indices.\n\n Important methods include `extractStructure` and `getAtomIndices`. Use the\n `atom` attribute to iterate over all contained atoms. 1-based indexed\n access to the atoms is also possible using `atom` (e.g. atom[1] gets the\n first atom in the _AtomCollection). The number of atoms can be determined\n via `len(self.atom)` or `len(self)`.\n\n Intended as a base class for _Ring, _Molecule, and _Chain.\n\n ', '__init__': <function _AtomCollection.__init__>, 'structure': <property object>, 'atom': <property object>, '__len__': <function _AtomCollection.__len__>, 'getAtomIndices': <function _AtomCollection.getAtomIndices>, 'getAtomList': <function _AtomCollection.getAtomList>, 'extractStructure': <function _AtomCollection.extractStructure>, 'temperature_factor': <property object>, '__eq__': <function _AtomCollection.__eq__>, '__hash__': <function _AtomCollection.__hash__>, '__dict__': <attribute '__dict__' of '_AtomCollection' objects>, '__weakref__': <attribute '__weakref__' of '_AtomCollection' objects>})
__dir__() → list

default dir() implementation

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.structure._AtomIterator(st, atoms)

Bases: object

Iterates over each _StructureAtom in a _Molecule, _Chain, _Residue or _Ring.

__init__(st, atoms)

Constructor takes a list of atom numbers to iterate over.

__len__()

Return number of atoms in this molecule/chain/residue/ring.

__iter__()

Iterator through atoms in this molecule/chain/residue/ring.

__getitem__(idx)

Return atom <idx> of the molecule/chain/residue/ring. Starts at 1.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n Iterates over each `_StructureAtom` in a _Molecule, _Chain, _Residue\n or _Ring.\n\n ', '__init__': <function _AtomIterator.__init__>, '__len__': <function _AtomIterator.__len__>, '__iter__': <function _AtomIterator.__iter__>, '__getitem__': <function _AtomIterator.__getitem__>, '__dict__': <attribute '__dict__' of '_AtomIterator' objects>, '__weakref__': <attribute '__weakref__' of '_AtomIterator' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.structure._BaseWriter

Bases: schrodinger.structure._ReaderWriterContextManager

This class provides a common implementation for structure writers.

setOption(option, value)

Set a single option for this writer. This method is meant for options that may not be supported for all writer formats. See the StructureWriter class documentation for details on the available options.

Raises an OptionError subclass (either UnsupportedOption or UnsupportedOptionValue) if unsuccessful.

Parameters:
  • option (str) – The name of the option to set.
  • value – The value for the option. The data type of this parameter depends on the option being set.
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n This class provides a common implementation for structure writers.\n\n ', 'setOption': <function _BaseWriter.setOption>})
__dir__() → list

default dir() implementation

__enter__()
__eq__

Return self==value.

__exit__(type, value, tb)
__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init__

Initialize self. See help(type(self)) for accurate signature.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.structure._Chain(st, chain, atoms)

Bases: schrodinger.structure._AtomCollection

A class used to return chain information when iterating over chains in a Structure object.

Important methods include extractStructure and getAtomIndices. The atom attribute can be used to iterate over all atoms in the molecule, and the number of atoms can be determined via len(molecule.atom).

The residue iterator allows for iteration over residues of the chain, returning _Residue instances.

__init__(st, chain, atoms)

Initialize the Chain object.

residue

Returns residue iterator for all residues in the chain

name

Return name of the chain.

__str__()

Return str(self).

applyStyle(atoms=3, bonds=3)

Applies the given display styles to the atoms and bonds of the chain.

Parameters:
  • atoms (int) – display style for atoms given by structure module constants ATOM_NOSTYLE, ATOM_CIRCLE, ATOM_CPK, ATOM_BALLNSTICK. Default is ATOM_BALLNSTICK.
  • atoms – display style for bonds given by structure module constants BOND_NOSTYLE, BOND_WIRE, BOND_TUBE, BOND_BALLNSTICK. Default is BOND_BALLNSTICK.
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n A class used to return chain information when iterating over chains\n in a Structure object.\n\n Important methods include `extractStructure` and `getAtomIndices`. The\n `atom` attribute can be used to iterate over all atoms in the molecule,\n and the number of atoms can be determined via `len(molecule.atom)`.\n\n The `residue` iterator allows for iteration over residues of the\n chain, returning `_Residue` instances.\n\n ', '__init__': <function _Chain.__init__>, 'residue': <property object>, 'name': <property object>, '__str__': <function _Chain.__str__>, 'applyStyle': <function _Chain.applyStyle>})
__dir__() → list

default dir() implementation

__eq__(that)

Return True if this object and “that” object are equivalent.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__()

Hash value for this atom collection. This hash uniquely identifies the object (e.g. when using it as keys to dicts or in sets).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__len__()

Return number of atoms.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

atom

Iterate over all atoms. Also allows 1-based indexed access to the atoms.

extractStructure(copy_props=False)

Return a new Structure containing only the atoms associated with this substructure. Structure properties, including the title, are inherited only if copy_props is set to True.

getAtomIndices()

Return a list of atom indices for all atoms in this object.

Returns:List of atom indicies.
Return type:list of ints
getAtomList()

Deprecated. Use getAtomIndices() method instead.

structure

Return the parent Structure object for this atom collection.

temperature_factor

Average B (temperature) factor for all atoms that have it assigned. Setting this property will set the B factor to the given value for each atom.

class schrodinger.structure._Molecule(st, molnum, atoms)

Bases: schrodinger.structure._AtomCollection

A class used to return molecule information when iterating over molecules in a Structure object.

Important methods include extractStructure and getAtomIndices. The atom attribute can be used to iterate over all atoms in the molecule, and the number of atoms can be determined via len(molecule.atom).

The residue iterator allows for iteration over residues of the molecule, returning _Residue instances.

__init__(st, molnum, atoms)

Initialize the Molecule object.

residue

Returns residue iterator for all residues in the molecule.

__int__()

Return an integer rep - the molecule number.

number

Returns the molecule number of this molecule.

__str__()

Return str(self).

applyStyle(atoms=3, bonds=3)

Applies the given display styles to the atoms and bonds of the molecule.

Parameters:
  • atoms (int) – display style for atoms given by structure module constants ATOM_NOSTYLE, ATOM_CIRCLE, ATOM_CPK, ATOM_BALLNSTICK. Default is ATOM_BALLNSTICK.
  • atoms – display style for bonds given by structure module constants BOND_NOSTYLE, BOND_WIRE, BOND_TUBE, BOND_BALLNSTICK. Default is BOND_BALLNSTICK.
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n A class used to return molecule information when iterating over\n molecules in a Structure object.\n\n Important methods include `extractStructure` and `getAtomIndices`. The\n `atom` attribute can be used to iterate over all atoms in the molecule,\n and the number of atoms can be determined via `len(molecule.atom)`.\n\n The `residue` iterator allows for iteration over residues of the\n molecule, returning `_Residue` instances.\n\n ', '__init__': <function _Molecule.__init__>, 'residue': <property object>, '__int__': <function _Molecule.__int__>, 'number': <property object>, '__str__': <function _Molecule.__str__>, 'applyStyle': <function _Molecule.applyStyle>})
__dir__() → list

default dir() implementation

__eq__(that)

Return True if this object and “that” object are equivalent.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__()

Hash value for this atom collection. This hash uniquely identifies the object (e.g. when using it as keys to dicts or in sets).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__len__()

Return number of atoms.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

atom

Iterate over all atoms. Also allows 1-based indexed access to the atoms.

extractStructure(copy_props=False)

Return a new Structure containing only the atoms associated with this substructure. Structure properties, including the title, are inherited only if copy_props is set to True.

getAtomIndices()

Return a list of atom indices for all atoms in this object.

Returns:List of atom indicies.
Return type:list of ints
getAtomList()

Deprecated. Use getAtomIndices() method instead.

structure

Return the parent Structure object for this atom collection.

temperature_factor

Average B (temperature) factor for all atoms that have it assigned. Setting this property will set the B factor to the given value for each atom.

class schrodinger.structure._NotSortable

Bases: object

Mix-in for classes that shouldn’t be sortable or orderable.

__lt__(that)

Return self<value.

__gt__(that)

Return self<value.

__ge__(that)

Return self<value.

__le__(that)

Return self<value.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': "Mix-in for classes that shouldn't be sortable or orderable.", '__lt__': <function _NotSortable.__lt__>, '__gt__': <function _NotSortable.__lt__>, '__ge__': <function _NotSortable.__lt__>, '__le__': <function _NotSortable.__lt__>, '__dict__': <attribute '__dict__' of '_NotSortable' objects>, '__weakref__': <attribute '__weakref__' of '_NotSortable' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__getattribute__

Return getattr(self, name).

__hash__

Return hash(self).

__init__

Initialize self. See help(type(self)) for accurate signature.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.structure._ReaderWriterContextManager

Bases: object

A mixin to enable context manager usage in reader and writer classes.

__enter__()
__exit__(type, value, tb)
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n A mixin to enable context manager usage in reader and writer classes.\n ', '__enter__': <function _ReaderWriterContextManager.__enter__>, '__exit__': <function _ReaderWriterContextManager.__exit__>, '__dict__': <attribute '__dict__' of '_ReaderWriterContextManager' objects>, '__weakref__': <attribute '__weakref__' of '_ReaderWriterContextManager' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init__

Initialize self. See help(type(self)) for accurate signature.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.structure._Residue(st, resnum, inscode, chain, atoms=[])

Bases: schrodinger.structure._AtomCollection

A class which is returned by the ResidueIterator and contains information about the residue including the atoms which make it up.

Important methods include extractStructure and getAtomIndices. The atom attribute can be used to iterate over all atoms in the molecule, and the number of atoms can be determined via len(molecule.atom).

__init__(st, resnum, inscode, chain, atoms=[])

Initialize self. See help(type(self)) for accurate signature.

__str__()

Return a string representation - chain:resnum[inscode]. Insertion code is included only it is present. If the residue has no chain ID, then underscore (“_”) is used.

pdbres

Returns PDB residue name.

chain

Return chain name.

resnum

Returns PDB residue number.

inscode

Returns PDB residue insertion code.

molecule_number

Return molecule number.

secondary_structure
getCode()

Return the one-letter residue code for this residue.

hasMissingAtoms()

Returns True is this residue doesn’t have the expected number of heavy atoms. Will return False is this residue has the correct number of heavy atoms or if it is of a type we don’t know

isStandardResidue()

Returns True if this residue is on the list of standard PDB residues

isConnectedToResidue(other_res)

Returns True if the given residue is connected (C->N) to this residue.

If the “C” PDB atom of this residue is connected to the “N” PDB atom of the other_res, then the residues are connected. Otherwise, they are not considered connected.

applyStyle(atoms=3, bonds=3)

Applies the given display styles to the atoms and bonds of the residue.

Parameters:
  • atoms (int) – display style for atoms given by structure module constants ATOM_NOSTYLE, ATOM_CIRCLE, ATOM_CPK, ATOM_BALLNSTICK. Default is ATOM_BALLNSTICK.
  • atoms – display style for bonds given by structure module constants BOND_NOSTYLE, BOND_WIRE, BOND_TUBE, BOND_BALLNSTICK. Default is BOND_BALLNSTICK.
getAtomByPdbName(pdbname)

Returns the atom of this residue that matches the given PDB name, or None if no such atom is found.

Parameters:pdbname (str) – 4-letter PDB atom name. E.g. ” C ” to get the C terminal atom of a protein residue.
Returns:Atom with given PDB name or None
Return type:_StructureAtom or None
getBackboneNitrogen()

Returns the backbone nitrogen of the residue, or None. NOTE: For use with protein residues only.

Returns:Nitrogen atom or None
Return type:_StructureAtom or None
getCarbonylCarbon()

Returns the carbonyl backbone carbon of the residue, or None. NOTE: For use with protein residues only.

Returns:Carbon atom or None
Return type:_StructureAtom or None
getBackboneOxygen()

Returns the oxygen of the backbone, or None. NOTE: For use with protein residues only.

Returns:Oxygen atom or None
Return type:_StructureAtom or None
getAlphaCarbon()

Returns the backbone alpha carbon atom of this residue, or None. NOTE: For use with protein residues only.

Returns:Alpha carbon atom or None
Return type:_StructureAtom or None
getBetaCarbon(gly_hydrogen=False)

Returns the beta carbon atom of this residue, or None. NOTE: For use with protein residues only.

Parameters:gly_hydrogen (bool) – Whether to return the hydrogen atom if the residue is a glycine.
Returns:Beta carbon atom or None
Return type:_StructureAtom or None
getDihedralAtoms(angle_name)

Return a list of 4 atom objects for the named dihedral angle in this residue. For backbone bonds, atoms are listed in the N->C order; for side-chain bonds, atoms are listed in order of increasing bond count from the backbone. Omega dihedral is the one to the previous residue (the one bonded to the N atom of this residue).

Parameters:name (str) – Name of the dihedral angle to fine. Supported names are: Phi, Psi, Omega, Chi1, Chi2, Chi3, Chi4, Chi5.
Raises:ValueError – if specified dihedral name is not valid or if it was not found in the database.
getAsl()

Return an ASL that uniquely identifies this residue, by chain ID, residue number, and insertion code.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n A class which is returned by the ResidueIterator and contains\n information about the residue including the atoms which make it up.\n\n Important methods include `extractStructure` and `getAtomIndices`. The\n `atom` attribute can be used to iterate over all atoms in the molecule,\n and the number of atoms can be determined via `len(molecule.atom)`.\n\n ', '__init__': <function _Residue.__init__>, '__str__': <function _Residue.__str__>, 'pdbres': <property object>, 'chain': <property object>, 'resnum': <property object>, 'inscode': <property object>, 'molecule_number': <property object>, 'secondary_structure': <property object>, 'getCode': <function _Residue.getCode>, 'hasMissingAtoms': <function _Residue.hasMissingAtoms>, 'isStandardResidue': <function _Residue.isStandardResidue>, 'isConnectedToResidue': <function _Residue.isConnectedToResidue>, 'applyStyle': <function _Residue.applyStyle>, 'getAtomByPdbName': <function _Residue.getAtomByPdbName>, 'getBackboneNitrogen': <function _Residue.getBackboneNitrogen>, 'getCarbonylCarbon': <function _Residue.getCarbonylCarbon>, 'getBackboneOxygen': <function _Residue.getBackboneOxygen>, 'getAlphaCarbon': <function _Residue.getAlphaCarbon>, 'getBetaCarbon': <function _Residue.getBetaCarbon>, 'getDihedralAtoms': <function _Residue.getDihedralAtoms>, 'getAsl': <function _Residue.getAsl>})
__dir__() → list

default dir() implementation

__eq__(that)

Return True if this object and “that” object are equivalent.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__()

Hash value for this atom collection. This hash uniquely identifies the object (e.g. when using it as keys to dicts or in sets).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__len__()

Return number of atoms.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

atom

Iterate over all atoms. Also allows 1-based indexed access to the atoms.

extractStructure(copy_props=False)

Return a new Structure containing only the atoms associated with this substructure. Structure properties, including the title, are inherited only if copy_props is set to True.

getAtomIndices()

Return a list of atom indices for all atoms in this object.

Returns:List of atom indicies.
Return type:list of ints
getAtomList()

Deprecated. Use getAtomIndices() method instead.

structure

Return the parent Structure object for this atom collection.

temperature_factor

Average B (temperature) factor for all atoms that have it assigned. Setting this property will set the B factor to the given value for each atom.

class schrodinger.structure._ResidueIterator(st, atoms, sort=True, connectivity_sort=False)

Bases: object

Residue iterator. Each Structure, Chain and Molecule will have one of these.

__init__(st, atoms, sort=True, connectivity_sort=False)

Residue iterator constructor.

Parameters:
  • st (Structure) – The Structure that the atoms list belongs to.
  • atoms (list(_StructureAtom)) – An atom iterator from which to select residues, e.g. chain.atom.
  • sort (bool) – If False, the residues will be returned in the order they are listed in the structure. If True, they will be sorted according to (chain, resnum, inscode, atom index).
  • connectivity_sort (bool) – If True, residues are sorted according to N->C order. A given chain of connectivity will be sorted will be sorted contiguously, but the order of several different chains or unconnected residues is undefined. Modifying the connectivity of CT during iteration will also produce undefined results.
__len__()

Number of residues in this st, chain, or molecule.

__iter__()

Iterate over residues in this st, chain, or molecule.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n Residue iterator. Each Structure, Chain and Molecule will have one of these.\n ', '__init__': <function _ResidueIterator.__init__>, '__len__': <function _ResidueIterator.__len__>, '_get_atom_residue_mapping': <function _ResidueIterator._get_atom_residue_mapping>, '__iter__': <function _ResidueIterator.__iter__>, '__dict__': <attribute '__dict__' of '_ResidueIterator' objects>, '__weakref__': <attribute '__weakref__' of '_ResidueIterator' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.structure._Ring(st, ringnum, atoms, iterator)

Bases: schrodinger.structure._AtomCollection

Class representing a ring.

Important methods include extractStructure and getAtomIndices. The atom attribute returns an iterator over all atoms in the ring, and the number of atoms can be determined via len(molecule.atom). The edge attribute works in a similar manner for bonds in the ring.

__init__(st, ringnum, atoms, iterator)

Initialize self. See help(type(self)) for accurate signature.

__str__()

Return str(self).

edge

Returns a bond iterator for all edges in the ring.

isAromatic()
isHeteroaromatic()
applyStyle(atoms=3, bonds=3)

Applies the given display styles to the atoms and bonds of the ring.

Parameters:
  • atoms (int) – display style for atoms given by structure module constants ATOM_NOSTYLE, ATOM_CIRCLE, ATOM_CPK, ATOM_BALLNSTICK. Default is ATOM_BALLNSTICK.
  • atoms – display style for bonds given by structure module constants BOND_NOSTYLE, BOND_WIRE, BOND_TUBE, BOND_BALLNSTICK. Default is BOND_BALLNSTICK.
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n Class representing a ring.\n\n Important methods include `extractStructure` and `getAtomIndices`. The\n `atom` attribute returns an iterator over all atoms in the ring, and\n the number of atoms can be determined via `len(molecule.atom)`. The\n `edge` attribute works in a similar manner for bonds in the ring.\n\n ', '__init__': <function _Ring.__init__>, '__str__': <function _Ring.__str__>, 'edge': <property object>, 'isAromatic': <function _Ring.isAromatic>, 'isHeteroaromatic': <function _Ring.isHeteroaromatic>, 'applyStyle': <function _Ring.applyStyle>})
__dir__() → list

default dir() implementation

__eq__(that)

Return True if this object and “that” object are equivalent.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__()

Hash value for this atom collection. This hash uniquely identifies the object (e.g. when using it as keys to dicts or in sets).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__len__()

Return number of atoms.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

atom

Iterate over all atoms. Also allows 1-based indexed access to the atoms.

extractStructure(copy_props=False)

Return a new Structure containing only the atoms associated with this substructure. Structure properties, including the title, are inherited only if copy_props is set to True.

getAtomIndices()

Return a list of atom indices for all atoms in this object.

Returns:List of atom indicies.
Return type:list of ints
getAtomList()

Deprecated. Use getAtomIndices() method instead.

structure

Return the parent Structure object for this atom collection.

temperature_factor

Average B (temperature) factor for all atoms that have it assigned. Setting this property will set the B factor to the given value for each atom.

class schrodinger.structure._RingEdgeIterator(ring)

Bases: object

Iterates over edges(bonds) of a _Ring.

__init__(ring)

ring argument is an instance of _Ring class.

__len__()
__iter__()
__getitem__(idx)

Return i’th edge. Index starts at 1

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n Iterates over edges(bonds) of a _Ring.\n\n ', '__init__': <function _RingEdgeIterator.__init__>, '__len__': <function _RingEdgeIterator.__len__>, '__iter__': <function _RingEdgeIterator.__iter__>, '__getitem__': <function _RingEdgeIterator.__getitem__>, '__dict__': <attribute '__dict__' of '_RingEdgeIterator' objects>, '__weakref__': <attribute '__weakref__' of '_RingEdgeIterator' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.structure._StructureAtom(ct, index)

Bases: schrodinger.structure._NotSortable

Access of mmct atoms properties pythonically.

__init__(ct, index)

Create an instance from the Structure object and the atom index. Note that the index used starts at 1 as per the underlying mmct lib.

__int__()

The atom index. I{Read only.}

index
__eq__(that)

Compare on mmct handle and index.

__ne__(other)

Check for inequality based on mmct handle and index.

__hash__()

Return hash(self).

__str__()

Return str(self).

addBond(atom2, bond_order)

Add a bond between the current atom and atom2. :param bond_order Takes an integer bond order or a BondType

deleteBond(atom2)

Delete the bond between the current atom and atom2.

retype()

Reassign the MacroModel atom type based on the bond orders and formal charge. This function should be called after either of these have been changed.

getResidue()

Return a _Residue object for the residue that this atom is part of.

getMolecule()

Return a _Molecule object for the molecule that this atom is part of.

getChain()

Return a _Chain object for the molecule that this atom is part of.

structure

Return the parent Structure object for this atom.

bond_total

Get total number of bonds to this atom.

bond

List of bonds to the atom (_StructureBond objects).

bonded_atoms

Iterator for atoms bonded to this atom (_StructureAtom objects).

atomic_weight

Return the atomic weight of the atom.

If implicit hydrogens are present, these are included with the weight of the atom they are attached to.

growname

Returns Maestro grow name.

pdbname

Returns PDB atom name.

pdbres
pdbcode

Returns one-letter PDB residue code.

resnum

Returns PDB residue number.

inscode

Returns PDB residue insertion code.

atom_type
atom_type_name

Returns MacroModel atom type name.

color

Get property method for _StructureAtom.color attribute.

:return Color object. :rtype: color.Color

setColorRGB(red, green, blue)

Set the RGB color of this atom as a tuple (R,G.B). Each color value should be an integer between 0 and 255.

chain

Returns atom chain name.

atom_name
name

Return name of atom.

entry_id

Return maestro entry id, may be None.

element

Element symbol of the atom.

partial_charge

Return partial charge of the atom.

solvation_charge
formal_charge
isotope

Returns mass number charge of the atom.

secondary_structure
temperature_factor
radius
vdw_radius
is_halogen
molecule_number
number_by_molecule
number_by_entry
atomic_number

“Atomic number of the atom’s element.

x
y
z
xyz

XYZ-coordinates of the atom.

alt_xyz

Alternative XYZ-coordinates of the atom, if available, otherwise returns None.

chirality

Returns chirality of the atom. R, S, ANR, ANS, undef, or None.

atom_style
style
visible
label_format
label_color
label_user_text
property

Dictionary-like container of Atom-level properties. Keys are strings of the form type_family_name as described in the “PropertyName documentation.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n Access of mmct atoms properties pythonically.\n\n ', '__init__': <function _StructureAtom.__init__>, '__int__': <function _StructureAtom.__int__>, 'index': <property object>, '_index': <property object>, '__eq__': <function _StructureAtom.__eq__>, '__ne__': <function _StructureAtom.__ne__>, '__hash__': <function _StructureAtom.__hash__>, '__str__': <function _StructureAtom.__str__>, 'addBond': <function _StructureAtom.addBond>, 'deleteBond': <function _StructureAtom.deleteBond>, 'retype': <function _StructureAtom.retype>, 'getResidue': <function _StructureAtom.getResidue>, 'getMolecule': <function _StructureAtom.getMolecule>, 'getChain': <function _StructureAtom.getChain>, 'structure': <property object>, 'bond_total': <property object>, 'bond': <property object>, 'bonded_atoms': <property object>, 'atomic_weight': <property object>, 'growname': <property object>, 'pdbname': <property object>, 'pdbres': <property object>, 'pdbcode': <property object>, 'resnum': <property object>, 'inscode': <property object>, 'atom_type': <property object>, 'atom_type_name': <property object>, '_color_index': <property object>, 'color': <property object>, 'setColorRGB': <function _StructureAtom.setColorRGB>, 'chain': <property object>, '_atomNameWarning': <function _StructureAtom._atomNameWarning>, 'atom_name': <property object>, 'name': <property object>, 'entry_id': <property object>, '_getCtEntryId': <function _StructureAtom._getCtEntryId>, 'element': <property object>, 'partial_charge': <property object>, 'solvation_charge': <property object>, 'formal_charge': <property object>, 'isotope': <property object>, 'secondary_structure': <property object>, 'temperature_factor': <property object>, 'radius': <property object>, 'vdw_radius': <property object>, 'is_halogen': <property object>, 'molecule_number': <property object>, 'number_by_molecule': <property object>, 'number_by_entry': <property object>, 'atomic_number': <property object>, 'x': <property object>, 'y': <property object>, 'z': <property object>, 'xyz': <property object>, 'alt_xyz': <property object>, 'chirality': <property object>, '_atomStyleWarning': <function _StructureAtom._atomStyleWarning>, 'atom_style': <property object>, 'style': <property object>, 'visible': <property object>, 'label_format': <property object>, 'label_color': <property object>, 'label_user_text': <property object>, 'property': <property object>})
__dir__() → list

default dir() implementation

__format__()

default object formatter

__ge__(that)

Return self<value.

__getattribute__

Return getattr(self, name).

__gt__(that)

Return self<value.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__(that)

Return self<value.

__lt__(that)

Return self<value.

__module__ = 'schrodinger.structure'
__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.structure._StructureAtomContainer(ct)

Bases: object

The class to provide access to _StructureAtom instances.

__init__(ct)

Initialize the container. The underlying mmct is always present.

__delitem__(index)

Delete an atom from the Structure. Note that this immediately updates the Structure and therefore renumbers any atoms following the one deleted. You can use Structure.deleteAtoms() to easily delete multiple atoms.

__getitem__(index)

Return the wrapper class for atom based properties. Note that the initial index is 1, as per the underlying mmct library, not 0 as is expected for python.

__iter__()

Provide iteration access.

__len__()

Return the number of atoms by querying the Structure class.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': 'The class to provide access to _StructureAtom instances. ', '__init__': <function _StructureAtomContainer.__init__>, '__delitem__': <function _StructureAtomContainer.__delitem__>, '__getitem__': <function _StructureAtomContainer.__getitem__>, '__iter__': <function _StructureAtomContainer.__iter__>, '__len__': <function _StructureAtomContainer.__len__>, '__dict__': <attribute '__dict__' of '_StructureAtomContainer' objects>, '__weakref__': <attribute '__weakref__' of '_StructureAtomContainer' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.structure._StructureAtomProperty(ct, cpp_atom)

Bases: collections.abc.MutableMapping

Dictionary-like container of atom based properties. These can be accessed via the property name as it appears in the maestro file.

Property names must be m2io data names, which are in the format ‘<type>_<author>_<property_name>’, where ‘<type>’ is a data type prefix, ‘<author>’ is a source specification, and ‘<property_name>’ is the actual name of the data.

The data type prefix can specified as ‘s’ for string, ‘i’ for integer, ‘r’ for real and ‘b’ for boolean. The author specification should be ‘user’ for user created properties. The property name can have embedded underscores.

Some example m2io datanames are ‘r_m_x_coord’, which indicates a real maestro property named ‘x coord’, and ‘i_user_my_count’ which indicates an integer user property named ‘my count’.

__init__(ct, cpp_atom)

Create an instance of the property dictionary.

__getitem__(item)

Return the given item if it is a valid property for this atom, raise a KeyError if not.

Parameters:item (string) – Key object for property dict, must be a string starting with s, r, i, or b
Raises:KeyError
__setitem__(item, value)

Set atom properties for the given atom:

__delitem__(item)

Delete the atom property.

keys()

Returns a list of the datanames of all unrequested items.

__len__()
__iter__()
__abstractmethods__ = frozenset()
__class__

alias of abc.ABCMeta

__contains__(key)
__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': "\n Dictionary-like container of atom based properties. These can be accessed\n via the property name as it appears in the maestro file.\n\n Property names must be m2io data names, which are in the format\n '<type>_<author>_<property_name>', where '<type>' is a data type prefix,\n '<author>' is a source specification, and '<property_name>' is the\n actual name of the data.\n\n The data type prefix can specified as 's' for string, 'i' for integer,\n 'r' for real and 'b' for boolean. The author specification should be\n 'user' for user created properties. The property name can have embedded\n underscores.\n\n Some example m2io datanames are 'r_m_x_coord', which indicates a real\n maestro property named 'x coord', and 'i_user_my_count' which indicates\n an integer user property named 'my count'.\n\n ", '__init__': <function _StructureAtomProperty.__init__>, '__getitem__': <function _StructureAtomProperty.__getitem__>, '__setitem__': <function _StructureAtomProperty.__setitem__>, '__delitem__': <function _StructureAtomProperty.__delitem__>, 'keys': <function _StructureAtomProperty.keys>, '__len__': <function _StructureAtomProperty.__len__>, '__iter__': <function _StructureAtomProperty.__iter__>, '__dict__': <attribute '__dict__' of '_StructureAtomProperty' objects>, '__weakref__': <attribute '__weakref__' of '_StructureAtomProperty' objects>, '__abstractmethods__': frozenset(), '_abc_registry': <_weakrefset.WeakSet object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 49})
__dir__() → list

default dir() implementation

__eq__(other)

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__ = None
__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__reversed__ = None
__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__slots__ = ()
__str__

Return str(self).

classmethod __subclasshook__(C)

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

clear() → None. Remove all items from D.
get(k[, d]) → D[k] if k in D, else d. d defaults to None.
items() → a set-like object providing a view on D's items
pop(k[, d]) → v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() → (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) → D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) → None. Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() → an object providing a view on D's values
class schrodinger.structure._StructureBond(ct, atom_index, index)

Bases: schrodinger.structure._NotSortable

A class for pythonic access to bond properties.

Attributes
  • atom1: The first atom, by which the bond is defined.
  • atom2: The atom bonded to atom1.
__init__(ct, atom_index, index)

A bond is defined by its underlying Structure, the atom index that it is anchored to, and the bond index.

__eq__(that)

Test _StructureBond equality by the bonded atoms.

__ne__(other)

Test _StructureBond inequality based on the bonded atoms.

__hash__()

Hash value for bond, based on the index values of the atoms involved and the handle of the underlying Structure.

__str__()

Return str(self).

delete()

Delete this bond. Use with care. Iteration over bonds may be affected.

length

Length of the bond in angstroms.

order

Return bond order. Returns None for the MMCT_NONE type, integer values for zero through three.

type

:returns schrodinger.structure.BondType

from_style

Return bond’s “from” style.

to_style

Return bond’s “to” style.

style
setStyle(style)

Set the bond’s style in both directions (“from” and “to”)

property

Dictionary-like container of Bond properties.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n A class for pythonic access to bond properties.\n\n Attributes\n - atom1: The first atom, by which the bond is defined.\n - atom2: The atom bonded to atom1.\n\n ', '__init__': <function _StructureBond.__init__>, '__eq__': <function _StructureBond.__eq__>, '__ne__': <function _StructureBond.__ne__>, '__hash__': <function _StructureBond.__hash__>, '__str__': <function _StructureBond.__str__>, 'delete': <function _StructureBond.delete>, '_getBondIndex': <function _StructureBond._getBondIndex>, 'length': <property object>, 'order': <property object>, 'type': <property object>, 'from_style': <property object>, 'to_style': <property object>, 'style': <property object>, 'setStyle': <function _StructureBond.setStyle>, 'property': <property object>})
__dir__() → list

default dir() implementation

__format__()

default object formatter

__ge__(that)

Return self<value.

__getattribute__

Return getattr(self, name).

__gt__(that)

Return self<value.

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__(that)

Return self<value.

__lt__(that)

Return self<value.

__module__ = 'schrodinger.structure'
__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.structure._StructureBondContainer(ct)

Bases: object

The class to provide access to _StructureBond instances for each bond in the structure.

__init__(ct)

Initialize with a Structure.

__iter__()

Provide iteration access.

__len__()

Return the total number of bonds in the Structure

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n The class to provide access to _StructureBond instances for each bond\n in the structure.\n\n ', '__init__': <function _StructureBondContainer.__init__>, '__iter__': <function _StructureBondContainer.__iter__>, '__len__': <function _StructureBondContainer.__len__>, '__dict__': <attribute '__dict__' of '_StructureBondContainer' objects>, '__weakref__': <attribute '__weakref__' of '_StructureBondContainer' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.structure._StructureBondProperty(ct, atomindex, bondnum)

Bases: collections.abc.MutableMapping

Dictionary-like container of bond based properties. These can be accessed via the property name as it appears in the maestro file.

Property names must be m2io data names, which are in the format ‘<type>_<author>_<property_name>’, where ‘<type>’ is a data type prefix, ‘<author>’ is a source specification, and ‘<property_name>’ is the actual name of the data.

The data type prefix can specified as ‘s’ for string, ‘i’ for integer, ‘r’ for real and ‘b’ for boolean. The author specification should be ‘user’ for user created properties. The property name can have embedded underscores.

Some example m2io datanames are ‘r_m_x_coord’, which indicates a real maestro property named ‘x coord’, and ‘i_user_my_count’ which indicates an integer user property named ‘my count’.

__init__(ct, atomindex, bondnum)

Create an instance of the property dictionary.

__getitem__(item)

Return the given item if it is a valid property for this atom, None if not.

__setitem__(item, value)

Set atom properties for the given atom:

__delitem__(item)

Delete the atom property.

keys()

Returns a list of the datanames of all unrequested items.

__len__()
__iter__()
__abstractmethods__ = frozenset()
__class__

alias of abc.ABCMeta

__contains__(key)
__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': "\n Dictionary-like container of bond based properties. These can be accessed\n via the property name as it appears in the maestro file.\n\n Property names must be m2io data names, which are in the format\n '<type>_<author>_<property_name>', where '<type>' is a data type prefix,\n '<author>' is a source specification, and '<property_name>' is the\n actual name of the data.\n\n The data type prefix can specified as 's' for string, 'i' for integer,\n 'r' for real and 'b' for boolean. The author specification should be\n 'user' for user created properties. The property name can have embedded\n underscores.\n\n Some example m2io datanames are 'r_m_x_coord', which indicates a real\n maestro property named 'x coord', and 'i_user_my_count' which indicates\n an integer user property named 'my count'.\n\n ", '__init__': <function _StructureBondProperty.__init__>, '__getitem__': <function _StructureBondProperty.__getitem__>, '__setitem__': <function _StructureBondProperty.__setitem__>, '__delitem__': <function _StructureBondProperty.__delitem__>, 'keys': <function _StructureBondProperty.keys>, '__len__': <function _StructureBondProperty.__len__>, '__iter__': <function _StructureBondProperty.__iter__>, '__dict__': <attribute '__dict__' of '_StructureBondProperty' objects>, '__weakref__': <attribute '__weakref__' of '_StructureBondProperty' objects>, '__abstractmethods__': frozenset(), '_abc_registry': <_weakrefset.WeakSet object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 49})
__dir__() → list

default dir() implementation

__eq__(other)

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__ = None
__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__reversed__ = None
__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__slots__ = ()
__str__

Return str(self).

classmethod __subclasshook__(C)

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

clear() → None. Remove all items from D.
get(k[, d]) → D[k] if k in D, else d. d defaults to None.
items() → a set-like object providing a view on D's items
pop(k[, d]) → v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() → (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) → D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) → None. Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() → an object providing a view on D's values
class schrodinger.structure._StructureChainIterator(st)

Bases: object

Class for iterating over chains in a Structure.

__init__(st)

Initialize self. See help(type(self)) for accurate signature.

recalc()

Obsolete

chainNames()

Return a list of chain letters

__len__()

Return number of chains in the structure

__getitem__(name)

Return chain object for chain <name>

__delitem__(name)

Delete the chain <name> from the Structure. Note that this immediately updates the Structure and therefore renumbers the atoms.

__iter__()

Iterate through all chains in the structure.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': ' Class for iterating over chains in a Structure. ', '__init__': <function _StructureChainIterator.__init__>, 'recalc': <function _StructureChainIterator.recalc>, 'chainNames': <function _StructureChainIterator.chainNames>, '__len__': <function _StructureChainIterator.__len__>, '__getitem__': <function _StructureChainIterator.__getitem__>, '__delitem__': <function _StructureChainIterator.__delitem__>, '__iter__': <function _StructureChainIterator.__iter__>, '__dict__': <attribute '__dict__' of '_StructureChainIterator' objects>, '__weakref__': <attribute '__weakref__' of '_StructureChainIterator' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.structure._StructureMoleculeIterator(st)

Bases: object

Iterates over _Molecule in a Structure.

__init__(st)

Initialize self. See help(type(self)) for accurate signature.

recalc()

Obsolete

__len__()
__getitem__(molnum)

Return molecule object for molecule <molnum>.

__delitem__(molnum)

Delete the molecule <molnum> from the Structure. Note that this immediately updates the Structure and therefore renumbers the atoms.

__iter__()
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': ' Iterates over _Molecule in a Structure. ', '__init__': <function _StructureMoleculeIterator.__init__>, 'recalc': <function _StructureMoleculeIterator.recalc>, '__len__': <function _StructureMoleculeIterator.__len__>, '__getitem__': <function _StructureMoleculeIterator.__getitem__>, '__delitem__': <function _StructureMoleculeIterator.__delitem__>, '__iter__': <function _StructureMoleculeIterator.__iter__>, '__dict__': <attribute '__dict__' of '_StructureMoleculeIterator' objects>, '__weakref__': <attribute '__weakref__' of '_StructureMoleculeIterator' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.structure._StructureProperty(st, read_only=False)

Bases: collections.abc.MutableMapping

Dictionary-like container of Structure based properties, with all dict methods. Properties can be accessed via the m2io dataname as it appears in the maestro file.

Property names must be m2io data names, which are in the format ‘<type>_<author>_<property_name>’, where ‘<type>’ is a data type prefix, ‘<author>’ is a source specification, and ‘<property_name>’ is the actual name of the data.

The data type prefix can specified as ‘s’ for string, ‘i’ for integer, ‘r’ for real and ‘b’ for boolean. The author specification should be ‘user’ for user created properties. The property name can have embedded underscores.

Some example m2io datanames are ‘r_m_x_coord’, which indicates a real maestro property named ‘x coord’, and ‘i_user_my_count’ which indicates an integer user property named ‘my count’.

To convert to the _StructureProperty to a real dictionary::
d = dict(st.property)
To set all properties from dictionary::
st.property = {…}
__init__(st, read_only=False)

Create an instance of the property ‘dictionary’ The instance is created when st.property is first used. If read-only is True then only read-access will be supported.

__getitem__(item)

Return an item from the unrequested or additional data handle. Usage: value = st.property[<name>]

__delitem__(item)

Delete an item from the additional and unrequested data handle. Usage: del st.property[<name>]

__setitem__(item, value)

Set the item into the additional data handle. Usage: st.property[<name>] = value

keys()

Return a list of the names of all properties.

clear()

Clear all properties (except the title).

__len__()
__iter__()
__abstractmethods__ = frozenset()
__class__

alias of abc.ABCMeta

__contains__(key)
__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': "\n Dictionary-like container of Structure based properties, with all dict\n methods. Properties can be accessed via the m2io dataname as it appears in\n the maestro file.\n\n Property names must be m2io data names, which are in the format\n '<type>_<author>_<property_name>', where '<type>' is a data type prefix,\n '<author>' is a source specification, and '<property_name>' is the\n actual name of the data.\n\n The data type prefix can specified as 's' for string, 'i' for integer,\n 'r' for real and 'b' for boolean. The author specification should be\n 'user' for user created properties. The property name can have embedded\n underscores.\n\n Some example m2io datanames are 'r_m_x_coord', which indicates a real\n maestro property named 'x coord', and 'i_user_my_count' which indicates\n an integer user property named 'my count'.\n\n To convert to the _StructureProperty to a real dictionary::\n d = dict(st.property)\n\n To set all properties from dictionary::\n st.property = {...}\n\n ", '__init__': <function _StructureProperty.__init__>, '_get_ct_property': <function _StructureProperty._get_ct_property>, '__getitem__': <function _StructureProperty.__getitem__>, '__delitem__': <function _StructureProperty.__delitem__>, '__setitem__': <function _StructureProperty.__setitem__>, 'keys': <function _StructureProperty.keys>, 'clear': <function _StructureProperty.clear>, '__len__': <function _StructureProperty.__len__>, '__iter__': <function _StructureProperty.__iter__>, '__dict__': <attribute '__dict__' of '_StructureProperty' objects>, '__weakref__': <attribute '__weakref__' of '_StructureProperty' objects>, '__abstractmethods__': frozenset(), '_abc_registry': <_weakrefset.WeakSet object>, '_abc_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache': <_weakrefset.WeakSet object>, '_abc_negative_cache_version': 49})
__dir__() → list

default dir() implementation

__eq__(other)

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__ = None
__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__reversed__ = None
__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__slots__ = ()
__str__

Return str(self).

classmethod __subclasshook__(C)

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

get(k[, d]) → D[k] if k in D, else d. d defaults to None.
items() → a set-like object providing a view on D's items
pop(k[, d]) → v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() → (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) → D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) → None. Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() → an object providing a view on D's values
class schrodinger.structure._StructureRingIterator(st)

Bases: object

Container for all rings in the Structure. Represents a dynamic list of the smallest set of smallest rings (SSSR) in the structure.

__init__(st)

Initialize self. See help(type(self)) for accurate signature.

recalc()

Obsolete

__len__()

Return the number of rings in the structure.

__getitem__(ringnum)

Return ring object for ring <i>. Index starts at 1.

__iter__()

Iterate through all rings in the structure.

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.structure', '__doc__': '\n Container for all rings in the Structure. Represents a dynamic list\n of the smallest set of smallest rings (SSSR) in the structure.\n\n ', '__init__': <function _StructureRingIterator.__init__>, 'recalc': <function _StructureRingIterator.recalc>, '__len__': <function _StructureRingIterator.__len__>, '__getitem__': <function _StructureRingIterator.__getitem__>, '__iter__': <function _StructureRingIterator.__iter__>, '_isAromatic': <function _StructureRingIterator._isAromatic>, '__dict__': <attribute '__dict__' of '_StructureRingIterator' objects>, '__weakref__': <attribute '__weakref__' of '_StructureRingIterator' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.structure'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)