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

Class MaestroWriter

                 object --+        
                          |        
_ReaderWriterContextManager --+    
                              |    
                    _BaseWriter --+
                                  |
                                 MaestroWriter

A class for more efficient appending of a large number of structures to a single maestro structure file.

For writing single structures, just use the Structure.write method. For appending a small (less than a thousand) number of structures, the Structure.append method will perform acceptably.

Instance Methods [hide private]
 
__init__(self, filename, overwrite=True)
Initialize needed mmlibs and open the file 'filename'.
 
append(self, ct)
Append the provided structure to the open mae file.
 
close(self)
Close the file.
 
__del__(self)
Close the file and terminate the mmlibs.

Inherited from _BaseWriter: setOption

Inherited from _ReaderWriterContextManager: __enter__, __exit__

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, filename, overwrite=True)
(Constructor)

 

Initialize needed mmlibs and open the file 'filename'.

Note that the file will not be completely written until it is explicitly closed or the object is garbage collected.

Parameters:
  • filename (str) - The filename to write to.
  • overwrite (bool) - If False, append to an existing file if it exists.
Overrides: object.__init__

append(self, ct)

 

Append the provided structure to the open mae file. Set self.last_position to the file offset just before it was appended.

The use of this class and method should be preferred for large numbers of structures (say, >1000), but for smaller numbers of structures you can use the Structure.append method directly.