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

Class MaestroReader

                 object --+        
                          |        
_ReaderWriterContextManager --+    
                              |    
                   FormatReader --+
                                  |
                                 MaestroReader
Known Subclasses:

A class for reading structures from a Maestro (M2io) format file.

Instance Methods [hide private]
 
__init__(self, filename, index=1, error_handler=None, input_string=None)
Initialize the reader.
 
__del__(self)
 
__iter__(self)
 
getErrorHandler(self)
Returns the error handler by querying the m2io library and if the refcount is > 0 then return the error handler that is in use by m2io.
 
_open(self)
Internal function to open the file.
 
seek(self, position)
Set the file position to the given position.
 
read(self, position=None)
Return the next Structure object.
 
next(self)
Return the next Structure object from the file.
 
close(self)
Close the file.

Inherited from FormatReader: clearReadErrors, getReadErrors, startErrorQueuing, stopErrorQueuing

Inherited from _ReaderWriterContextManager: __enter__, __exit__

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

Class Variables [hide private]
  read_mode = 16
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, filename, index=1, error_handler=None, input_string=None)
(Constructor)

 

Initialize the reader.

Parameters:
  • filename (string) - The filename to read.
  • index (int) - The index of the first structure to read.
  • error_handler (int) - The handle of the mmerr object to use for error logging. Defaults to schrodinger.infra.mm.error_handler.
  • input_string (string) - A string with the contents of a Maestro format file. If provided, the filename argument is ignored.
Overrides: object.__init__

getErrorHandler(self)

 

Returns the error handler by querying the m2io library and if the refcount is > 0 then return the error handler that is in use by m2io. Otherwise None is returned.

Overrides: FormatReader.getErrorHandler

seek(self, position)

 

Set the file position to the given position. This raise an exception for zero size file.

read(self, position=None)

 

Return the next Structure object. If position is given, this will be honoured. Otherwise the current position is taken. This raise an exception for zero size file, reading structure beyond end of file indicator and m2io errors.

Raises:
  • EOFError - on EOF or zero size file.
  • Exception - otherwise.

next(self)

 

Return the next Structure object from the file. Set self.last_position to the file offset just before it was read.

Raises:
  • StopIteration - on EOF or zero size file.