schrodinger.structure module

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.

__len__()

Return the number of bonds by querying the Structure class.

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.

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

Bases: schrodinger.structure.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.

number

Returns the molecule number of this molecule.

number_by_entry

Return molecule number of this molecule by entry.

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.
__len__()

Return number of atoms.

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._Residue(st, resnum, inscode, chain, atoms=[])

Bases: schrodinger.structure.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.

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.

molecule_number_by_entry

Return molecule number of this residue by entry.

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.

__len__()

Return number of atoms.

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.

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

Bases: schrodinger.structure.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.

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.
__len__()

Return number of atoms.

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._StructureAtom(ct, index)

Bases: schrodinger.structure.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.

index
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

First letter of the chain name for legacy applications which expect a 1-letter chain identifier.

The ‘chain_name’ property holds the full chain name.

chain_name

Chain name (mmCIF “auth_asym_id”)

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
molecule_number_by_entry

Return the molecule number of this atom, by entry.

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 schrodinger.structure._StructureBond(ct, atom_index, index)

Bases: schrodinger.structure.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.

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 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.

keys()

Return a list of the names of all properties.

clear()

Clear all properties (except the title).

__len__()
__contains__(key)
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