Trees | Indices | Help |
|
---|
|
object --+ | Structure
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.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Set of ints |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Structure.Structure
|
|
||
Inherited from |
|
|||
|
|
|||
_doc =
|
|
|||
manage_handle Return the current manage_handle attribute. |
|||
manual_update Manual update mode boolean flag for mmct |
|||
title Title of the structure |
|||
atom_total Total number of atoms in the structure |
|||
mol_total Total number of molecules in the structure |
|||
formal_charge Sum of formal charges in the structure. |
|||
total_weight The sum of atomic weights for the whole structure. |
|||
residue An iterable of residues in the structure, each of which is a _Residue instance. |
|||
property Dictionary-like container of Structure-level properties. |
|||
|
Initialize an object with an existing MMCT handle. The only way to get an existing handle in this module at the moment is by using the StructureReader class or the static read method below. By default, the MMCT resources will be managed by the object. To keep these from being cleaned upon object deletion, set manage_handle=False.
|
repr(x)
|
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. |
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. |
A method to create a proxy to be passed to subobjects that need to hold a reference to the parent Structure. This prevents cyclic references and therefore allows Structure instances to be deallocated by reference counting rather than waiting for a garbage collection sweep. |
An iterable of structure atoms, each of which is a _StructureAtom instance. Example usage, where # 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. |
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) Notes:
|
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. |
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. |
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. |
Alter the manage_handle attribute. Be sure to modify the _StructureDeleter object appropriately. |
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. |
Read a single structure from file 'filename', returning a Structure instance.
|
Write the structure to a string representation and return the string. The format parameter is required. |
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 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.
|
Used by the Maestro writer to leave the header block if necessary. For Structure objects this is not needed so it only returns |
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. |
Add a new atom to the structure. Return the created _StructureAtom object. |
Add the specified number of atoms to this structure. The following atom attributes will have to be set for each atom afterwards:
|
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. |
Add the atoms in other_structure to the end of the current structure. The other_structure is left unchanged. |
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. |
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. |
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) |
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. |
Delete the bond between atom1 and atom2. It will be an error if there is no bond between these two. |
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 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. Note, bond distances and angles within a ring system will not be adjusted. Modifications to atoms in rings via this call will silently fail. inRing() may be used to pre-check for this condition. 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_angle2(), or mmct_atom_set_dihedral_angle(). |
Returns True if atom1 and atom2 are both part of the same ring. The test works by seeing which atoms would be transformed if movement was made on the vector atom1-atom2. If atom1 is itself part of that set then we can assume atom2 and atom1 are in the same ring. All atom arguments can be integers or _StructureAtom objects. |
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.
|
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 all rings in the structure using SSSR.
|
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.
|
If the structure is 2D (with stereo annotation properties), return a 3D version of it - volumized using fast3d. Any missing hydrogens will also be added.
|
|
_doc
|
|
manage_handleReturn the current manage_handle attribute.
|
manual_updateManual update mode boolean flag for mmct
|
titleTitle of the structure |
atom_totalTotal number of atoms in the structure
|
mol_totalTotal number of molecules in the structure
|
formal_chargeSum of formal charges in the structure. Accessing this property is an O(N) operation.
|
total_weightThe sum of atomic weights for the whole structure. The weight of implicit hydrogens is automatically included. Accessing this property is an O(N) operation.
|
residueAn 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)
Notes:
|
propertyDictionary-like container of Structure-level properties. Keys are
strings of the form
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Oct 26 00:59:58 2016 | http://epydoc.sourceforge.net |