Package schrodinger :: Module structure
[hide private]
[frames] | no frames]

Module structure

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.structureutil module and schrodinger.structutils package provide additional functions and classes that operate on Structure objects.

The default error handler for the structure module is set to mm.error_handler. If no error handler is specified for error_handler arguments, its value is what will be used.

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.

Classes [hide private]
  _AtomIterator
Iterates over each _StructureAtom in a _Molecule, _Chain, _Residue or _Ring.
  _RingEdgeIterator
Iterates over edges(bonds) of a _Ring.
  _Ring
Class representing a ring.
  _Molecule
A class used to return molecule information when iterating over molecules in a Structure object.
  _Residue
A class which is returned by the ResidueIterator and contains information about the residue including the atoms which make it up.
  _Chain
A class used to return chain information when iterating over chains in a Structure object.
  _StructureMoleculeIterator
Iterates over _Molecule in a Structure.
  _ResidueIterator
Residue iterator.
  _StructureChainIterator
Class for iterating over chains in a Structure.
  _StructureRingIterator
Container for all rings in the Structure.
  _StructureAtomProperty
A dictionary of atom based properties.
  _StructureAtom
A class to make access of mmct atoms properties more pythonic.
  _StructureBondProperty
A dictionary of bond based properties.
  _StructureBond
A class for pythonic access to bond properties.
  _StructureAtomContainer
The class to provide access to _StructureAtom instances.
  _StructureBondContainer
The class to provide access to _StructureBond instances for each bond in the structure.
  _AtomBondContainer
The class to provide access to _StructureBond instances for each bond of an atom.
  _StructureProperty
A dictionary of Structure based properties, with all dict methods.
  _StructureDeleter
A resource cleanup class for a single Structure.
  _StructureManager
A class to handle Structure life-cycle events: initialization, termination, and deletion.
  Structure
A general chemical structure object, which may contain multiple molecules.
  MaestroTextReader
A class for reading structures from a Maestro format file.
  FormatReader
This is a base class for all file format readers.
  MaestroReader
A class for reading structures from a Maestro (M2io) format file.
  MaestroReaderWithPositions
A class for rapid random access to the structures in a Maestro file.
  OptionError
A parent exception class to indicate an error in setting an option.
  UnsupportedOption
An exception class to indicate an attempt to set an option that is not supported.
  UnsupportedOptionValue
An exception class to indicate an attempt to set an option to a value that is supported.
  _BaseWriter
This class provides a common implementation for structure writers.
  MaestroWriter
A class for more efficient appending of a large number of structures to a single maestro structure file.
  SDWriter
A class for more efficient appending of a large number of structures to a single SD structure file.
  Mol2Writer
Mol2 support for the StructureWriter class.
  PDBWriter
A class for writing PDB-formatted files.
  StructureWriter
A class for efficient writing of multiple structures to a single structure file.
  PDBReader
A class for reading structures from a PDB format file.
  SDReader
A class for reading structures from a SD format file.
  Mol2Reader
A class for reading structures from a mol2 format file.
  StructureReader
A class to read structures from files of various types.
  PropertyName
The PropertyName class can be used to display the "user-readable" version of an entry or atom property to the user.
  TextualStructure
A sub-class of Structure for use when reading from a Maestro format file and only the structure-level properties are needed.
  SmilesStructure
SMILES representation of a Structure that is returned by SmilesReader and SmilesCsvReader.
  SmilesReader
A class for reading structures from a SMILES formatted file.
  SmilesCsvReader
A class for reading structures from a SMILES CSV formatted file.
  SmilesWriter
A class for more efficient writing of a large number of structures to a single SMILES file.
  SmilesCsvWriter
A class for more efficient writing of a large number of structures to a single SMILES CSV file.
  MultiFileStructureReader
Provides a single iterator that reads structure from multiple files.
Functions [hide private]
 
_addBond(ct, atom1, atom2, bond_order)
Add a bond of the specified order between the two atoms atom1 and atom2.
 
read_ct(filename, index=1, error_handler=None)
Read a Structure from file 'filename', defaulting to the first one found.
 
_check_format(filename, format=None)
Get the format implied by the filename.
 
write_ct_to_string(ct, error_handler=None)
Return a string representation of the provided Structure, formatted as a Maestro file.
 
write_ct_to_sd_string(ct, error_handler=None)
Return a string representation of the provided Structure, formatted as an SD file.
 
write_ct(ct, filename, mode=2, error_handler=None)
Write a Structure to a Maestro format file.
 
write_ct_as_text(ct, filename, mode=2, error_handler=None)
Write a TextualStructure object to a Maestro format file.
 
write_ct_sd(ct, filename, mode=2, error_handler=None)
Write a Structure to a SD format file.
 
write_ct_mol2(ct, filename, mode=1, error_handler=None)
Write a Structure to a mol2 format file.
 
write_ct_pdb(ct, filename, mode='write', error_handler=None)
Write a Structure to a PDB format file.
 
write_ct_smiles(st, filename, mode='write')
Write a Structure object to a SMILES format file.
 
count_structures(filename, error_handler=None, format=None)
Returns the number of structures in the specified file.
 
create_new_structure(num_atoms=0)
Returns a new Structure object.
Structure._ResidueIterator
get_residues_by_connectivity(atom_container)
Access residues in N->C connectivity order
Structure._ResidueIterator
get_residues_unsorted(atom_container)
Access residues in the unsorted input order
Structure._ResidueIterator
_get_residues_by(atom_container, **kwargs)
Access residues in the specified order.
Variables [hide private]
  __doc__ = ...
  smiles = None
hash(x)
  canvas = None
hash(x)
  canvasutils = None
hash(x)
  NO_STEREO = 'none'
  STEREO_FROM_GEOMETRY = 'geometry'
  STEREO_FROM_ANNOTATION = 'annotation'
  STEREO_FROM_ANNOTATION_AND_GEOM = 'annotation_and_geom'
  STEREO_FROM_3D = '3d'
  stereo_options = set(['annotation', 'annotation_and_geom', 'ge...
  SS_NONE = -1
  SS_LOOP = 0
hash(x)
  SS_HELIX = 1
  SS_STRAND = 2
  SS_TURN = 3
hash(x)
  BOND_NOSTYLE = 0
hash(x)
  BOND_WIRE = 1
  BOND_TUBE = 2
  BOND_BALLNSTICK = 3
hash(x)
  ATOM_NOSTYLE = 0
hash(x)
  ATOM_CIRCLE = 1
  ATOM_CPK = 2
  ATOM_BALLNSTICK = 3
hash(x)
  NO_SPECIFIC_ISOTOPE = 0
hash(x)
  _pdb_lookup = {'ALA': 'A', 'ARG': 'R', 'ARN': 'R', 'ASH': 'D',...
  atom_prop_link = {'i_m_atomic_number': 'atomic_number', 'i_m_c...
  _res_sizes = {' A ': 22, ' C ': 20, ' G ': 23, ' U ': 20, ...
  _structure_manager = _StructureManager()
  PROP_LONG_NAME = {'chorus': 'Desmond', 'epik': 'Epik', 'glide'...
  PROP_SHORT_NAME = {'Desmond': 'chorus', 'Epik': 'epik', 'Glide...
  PROP_STRING = 's'
  PROP_FLOAT = 'r'
  PROP_REAL = 'r'
  PROP_INTEGER = 'i'
  PROP_BOOLEAN = 'b'
  __package__ = 'schrodinger'
  prop = 'sd'
Function Details [hide private]

_addBond(ct, atom1, atom2, bond_order)

 

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

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.

_check_format(filename, format=None)

 

Get the format implied by the filename. If format isn't None, simply return the format provided. Otherwise, check the filename suffix and return one of "maestro", "pdb", "sd", "mol2", "smiles," or "smilescsv".

raise ValueError: If the suffix is unrecognized.

write_ct_to_string(ct, error_handler=None)

 

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

Parameters:
  • ct (Structure)

write_ct_to_sd_string(ct, error_handler=None)

 

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

Parameters:
  • ct (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

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

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.

get_residues_by_connectivity(atom_container)

 

Access residues in N->C connectivity order

Parameters:
Returns: Structure._ResidueIterator
A residue iterator where the atoms are returned in N->C connectivity order

get_residues_unsorted(atom_container)

 

Access residues in the unsorted input order

Parameters:
Returns: Structure._ResidueIterator
A residue iterator where the atoms are returned in unsorted order

_get_residues_by(atom_container, **kwargs)

 

Access residues in the specified order. All keyword arguments are passed to _ResidueIterator.__init__.

Parameters:
Returns: Structure._ResidueIterator
A residue iterator where the atoms are returned in the requested order

Variables Details [hide private]

__doc__

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

L{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. L{Structure.measure}, L{Structure.adjust}, and L{Structure.merge}\
...

stereo_options

Value:
set(['annotation', 'annotation_and_geom', 'geometry', 'none'])

_pdb_lookup

Value:
{'ALA': 'A',
 'ARG': 'R',
 'ARN': 'R',
 'ASH': 'D',
 'ASN': 'N',
 'ASP': 'D',
 'CYS': 'C',
 'CYT': 'C',
...

atom_prop_link

Value:
{'i_m_atomic_number': 'atomic_number',
 'i_m_color': 'color',
 'i_m_formal_charge': 'formal_charge',
 'i_m_mass_value': 'isotope',
 'i_m_mmod_type': 'atom_type',
 'i_m_representation': 'style',
 'i_m_residue_number': 'resnum',
 'i_m_secondary_structure': 'secondary_structure',
...

_res_sizes

Value:
{'  A ': 22,
 '  C ': 20,
 '  G ': 23,
 '  U ': 20,
 ' DA ': 21,
 ' DC ': 19,
 ' DG ': 22,
 ' DT ': 20,
...

PROP_LONG_NAME

Value:
{'chorus': 'Desmond',
 'epik': 'Epik',
 'glide': 'Glide',
 'i': 'Impact',
 'j': 'Jaguar',
 'lp': 'LigPrep',
 'm': 'Maestro',
 'mmod': 'MacroModel',
...

PROP_SHORT_NAME

Value:
{'Desmond': 'chorus',
 'Epik': 'epik',
 'Glide': 'glide',
 'Impact': 'i',
 'Jaguar': 'j',
 'LigPrep': 'lp',
 'MacroModel': 'mmod',
 'Maestro': 'm',
...