OpenStructure
The IO module

The io module

The io module deals with input and output of entities, multiple sequence alignments and map data. Importers for common file formats such as PDB, SDF, FASTA, CLUSTAL W, DX and the CHARMM files are available.

Loading sequences, maps and entities

Entities are loaded via LoadEntity() "LoadEntity()", maps with LoadImage() and LoadAlignment() loads seqence alignments. For all these functions the file format is automatically deduced fron the file extension, by probing against all the IO handlers known to the IO manager. The PDB importer, for example is used for files with extension .pdb and .ent. For files with other extensions, or files without extensions, the file format may be passed explicitly as the second parameter to one of these functions.

In addition to the generic load functions described above, PDB files can be loaded with LoadPDB() and LoadMultiPDB(). These functions offer a tighter control over the exact loading behaviour.

Some of the file formats for molecules do not explicitly define bonds. The IO handlers for these file formats make use of the conop module to infer connectivity information.

IO Handlers

The specific logic for loading and storing data is implemented in so-called IO handlers. For sequence alignments, the basic interface for the IO handler is defined by the SequenceIOHandler class, wheras EntityIOHandler is the base class for entity IO handlers. In addition, the module also defines an interface for density map io (MapIOHandler). The IO-handler concept allows for a modular architecture and makes it possible to add support for external IO Handlers with seamless integration into the import/export API.

Adding an IO Handler

Adding a new IO handler is fairly straight forward: