Class MultiFileStructureReader
object --+
|
_ReaderWriterContextManager --+
|
MultiFileStructureReader
Provides a single iterator that reads structure from multiple files.
Typical usage is idential to typical useage of the StructureReader class
except that the class is instantiated with a python list of file names
rather than a single file name.
By default, the StructureReader class is used to read the files, but
this is customizable with the reacer_class keyword.
API Example:
names = ['file1.mae', 'file2.mae', 'file3.pdb']
reader = MultiFileStructureReader(names)
first_struct = reader.next()
for struct in reader:
do stuff
By default, the reader skips files that raise Exceptions and stores
the list of skipped files in the failed_files property.
The current StructureReader can be accessed with the reader
property
|
__init__(self,
files,
*args,
**kwargs)
Create a MultiFileStructureReader |
|
|
|
__iter__(self)
Required to make the class an iterator |
|
|
|
|
|
next(self)
Get the next structure to process. |
|
|
Inherited from _ReaderWriterContextManager :
__enter__ ,
__exit__
Inherited from object :
__delattr__ ,
__format__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__sizeof__ ,
__str__ ,
__subclasshook__
|
|
reader_class
The class used to read files
|
|
pass_errors
False if exceptions should be raised, True if they should be caught
|
|
files
List of files remaining to be read
|
|
current_filename
The file currently being read
|
|
index_in_current_file
Index of current structure in current file
|
|
failed_files
List of (failed_file_name, error_message)
|
|
reader
Current file reader
|
__init__(self,
files,
*args,
**kwargs)
(Constructor)
|
|
Create a MultiFileStructureReader
- Parameters:
- Overrides:
object.__init__
|
Create a file reader for the next file. Sets self.reader = None if
there are no more files to be read.
|
Get the next structure to process. This might either be the next
structure in the currently open file, or might result in the next file
being opened.
- Raises:
StopIteration - When all structures in all files have been read
|