Training Info¶
- class pyrodigal.TrainingInfo¶
A collection of parameters obtained after training.
New in version 0.5.0.
New in version 3.0.0: Propert constructor and setters to all properties.
- __init__(*args, **kwargs)¶
- dump(fp)¶
Write a training info to a file-like handle.
- Parameters:
fp (file-like object) – An file-like handle opened in binary mode, into which the training info should be written.
Danger
This method is not safe to use across different machines. The internal binary structure will be dumped as-is, and because the C types can change in size and representation between CPUs and OS, the file will not portable. This method is only provided to offer the same kind of features as the Prodigal binary. For a safe way of storing and sharing a
TrainingInfo
, use thepickle
module.New in version 0.6.4.
- classmethod load(fp)¶
Load a training info from a file-like handle.
- Parameters:
fp (file-like object) – An file-like handle opened in binary mode, from which to read the training info.
- Returns:
TrainingInfo
– The deserialized training info.
Danger
This method is not safe to use across different machines. The internal binary structure will be loaded as-is, and because the C types can change in size and representation between CPUs and OS, the deserialized data may be invalid. This method is only provided to load a training info file created by the Prodigal binary. For a safe way of sharing and loading a
TrainingInfo
, use thepickle
module.- Raises:
EOFError – When less bytes than expected could be read from the source file handle.
New in version 0.6.4.
- to_dict()¶
Convert this training info to a dictionary.
This method can be useful to save and load a
TrainingInfo
to JSON format for language and platform-agnostic exchange of the training info. The keys of the dictionary are the same as the Python constructor.Example
Save the training info to a JSON string using the
json
module:>>> data = METAGENOMIC_BINS[0].training_info.to_dict() >>> serialized = json.dumps(data)
The deserialized dictionary can be loaded back directly:
>>> tinf = TrainingInfo(**json.loads(serialized)) >>> list(tinf.bias) [2.312, 0.463, 0.226]
- bias¶
The GC bias for each frame.
- Type:
memoryview
offloat
- coding_statistics¶
The coding statistics for the genome.
New in version 3.0.0.
- Type:
- motif_weights¶
The weights for upstream motifs.
- Type:
- rbs_weights¶
The weights for RBS scores.
New in version 2.0.0.
- Type:
- type_weights¶
The weights for each start codon.
- Type:
memoryview
offloat
- upstream_compositions¶
The base composition weights for upstream regions.
- Type: