| Trees | Indices | Help |
|
|---|
|
|
object --+
|
_ReaderWriterContextManager --+
|
FormatReader --+
|
MaestroReader --+
|
MaestroReaderWithPositions
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)
|
|||
|
|||
|
|||
|
Inherited from Inherited from Inherited from Inherited from Inherited from |
|||
|
|||
|
Inherited from |
|||
|
|||
|
|||
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.
|
Return the next requested Structure object from the file. Set self.last_position to the file offset it was read from.
|
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Wed Aug 3 07:59:57 2016 | http://epydoc.sourceforge.net |