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 the pickle 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 the pickle 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 of float

coding_statistics

The coding statistics for the genome.

New in version 3.0.0.

Type:

memoryview

gc

The GC content of the training sequence, as a fraction.

Type:

float

missing_motif_weight

The weight for the case of no motif.

New in version 3.0.0.

Type:

float

motif_weights

The weights for upstream motifs.

Type:

memoryview

rbs_weights

The weights for RBS scores.

New in version 2.0.0.

Type:

memoryview

start_weight

The start score weight to use.

Type:

float

translation_table

The translation table used in the training sequence.

Type:

int

type_weights

The weights for each start codon.

Type:

memoryview of float

upstream_compositions

The base composition weights for upstream regions.

Type:

memoryview

uses_sd

True if the sequence uses a Shine/Dalgarno motif.

Type:

bool

class pyrodigal.MetagenomicBin

A pre-trained collection used to find genes in metagenomic mode.

training_info

The training info for this metagenomic bin.

Type:

TrainingInfo

__init__(*args, **kwargs)
description

A condensed text description for this metagenomic bin.

Type:

str