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

Class TextualStructure

object --+    
         |    
 Structure --+
             |
            TextualStructure

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.

Instance Methods [hide private]
 
__init__(self, ct, txt)
Initialize the TextualStructure object.
 
__str__(self)
Return the structure object as a text string
 
_getStructureAtomContainer(self)
 
_getStructureMoleculeIterator(self)
 
_getStructureChainIterator(self)
 
_getStructureResidueIterator(self)
 
_getStructureRingIterator(self)
 
_getStructureProperty(self)
Redefine the get structure property as read-only
 
write(self, filename, format=None)
Write the structure to a file, overwriting any previous content.
 
append(self, filename, format=None)
Append the structure to the file.
 
putToM2ioFile(self, filehandle)
Used by the Maestro writer - put a single structure to the (already open) filehandle
 
closeBlockIfNecessary(self, filehandle)
Used by the Maestro writer to leave the header block if necessary.

Inherited from Structure: __copy__, __eq__, __getstate__, __int__, __ne__, __repr__, __setstate__, addAtom, addAtoms, addBond, addBonds, adjust, applyStyle, areBound, bond, copy, deleteAtoms, deleteBond, extend, extract, findResidue, find_rings, get3dStructure, getAtomIndices, getBond, getChainAtoms, getMoleculeAtoms, getMovingAtoms, getResidueAtoms, getXYZ, has3dCoords, inRing, isEquivalent, measure, merge, retype, setXYZ, update, writeToString

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Static Methods [hide private]

Inherited from Structure: read

Class Variables [hide private]
  _doc = '\n Dictionary-like container of structure propertie...
Properties [hide private]
  atom
An iterable of structure atoms, each of which is a _StructureAtom instance.
  molecule
An iterable of molecules in the structure, each of which is a _Molecule instance.
  chain
An iterable of chains in the structure, each of which is a _Chain instance.
  residue
An iterable of residues in the structure, each of which is a _Residue instance.
  ring
An iterable of rings in the structure, each of which is a _Ring instance.
  property
Dictionary-like container of structure properties.

Inherited from Structure: atom_total, formal_charge, manage_handle, manual_update, mol_total, title, total_weight

Inherited from object: __class__

Method Details [hide private]

__init__(self, ct, txt)
(Constructor)

 

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.

Overrides: object.__init__

__str__(self)
(Informal representation operator)

 

Return the structure object as a text string

Overrides: object.__str__

_getStructureResidueIterator(self)

 
Overrides: Structure._getStructureResidueIterator

_getStructureProperty(self)

 

Redefine the get structure property as read-only

Overrides: Structure._getStructureProperty

write(self, filename, format=None)

 

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

Overrides: Structure.write

append(self, filename, format=None)

 

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

Parameters:
  • format - 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.
Overrides: Structure.append

putToM2ioFile(self, filehandle)

 

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

Overrides: Structure.putToM2ioFile

closeBlockIfNecessary(self, filehandle)

 

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

Overrides: Structure.closeBlockIfNecessary

Class Variable Details [hide private]

_doc

Value:
'''
    Dictionary-like container of structure properties. Keys are string\
s of 
    the form C{type_family_name} as described in the L{PropertyName}
    documentation.

    @note: Unlike the L{Structure.property} dictionary, this dictionar\
y is
...

Property Details [hide private]

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)
Get Method:
_getStructureAtomContainer(self)

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)
Get Method:
_getStructureMoleculeIterator(self)

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)
Get Method:
_getStructureChainIterator(self)

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)
Get Method:
_getStructureResidueIterator(self)

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)
Get Method:
_getStructureRingIterator(self)

property

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

Get Method:
_getStructureProperty(self) - Redefine the get structure property as read-only
Set Method:
unreachable._setStructureProperty(self, d)

Note: Unlike the Structure.property dictionary, this dictionary is read-only.