Data structures¶
modpipe.serialize
– Serialization of data structures¶
This module contains classes that represent some fundamental objects used
in ModPipe (such as a Hit
or Model
). It also contains
methods to serialize these objects, i.e. to write them out to or read
them in from files (or any file-like object).
- class modpipe.serialize.Hit(id, sequence, alignment, region, fold_assignment_method, highest_sequence_identity, templates)¶
Representation of a single hit found by ModPipe.
- class modpipe.serialize.Model(id, sequence, alignment, region, fold_assignment_method, hetatms, waters, score, highest_sequence_identity, rating, templates)¶
Representation of a single model generated by ModPipe.
- modpipe.serialize.write_hits_file(hits, stream, append=False)¶
Write a list of
Hit
objects to the given stream. If append is set to True, no version header is written to the stream (it is assumed that the header is already there).
- modpipe.serialize.write_models_file(models, stream, append=False, separator=False)¶
Write a list of
Model
objects to the given stream. If append is set to True, no version header is written to the stream (it is assumed that the header is already there). If separator is set to True, then “—” will be written before the appended models.
- modpipe.serialize.read_hits_file(stream)¶
Read and return a list of
Hit
objects from the given stream, as a generator. Some checking is done to make sure the file is valid YAML format (e.g. that the file starts with a version header, and that each object is really aHit
.)
- modpipe.serialize.read_models_file(stream)¶
Read and return a list of
Model
objects from the given stream, as a generator. Some checking is done to make sure the file is valid YAML format (e.g. that the file starts with a version header, and that each object is really aModel
.)
For an example of using this module, see Using ModPipe from your own programs.