genome_entropy.translate.translator

Translation of nucleotide sequences to amino acids.

Functions

translate_orf(orf[, table_id])

Translate an ORF to a protein sequence.

translate_orfs(orfs[, table_id])

Translate multiple ORFs to protein sequences.

Classes

ProteinRecord(orf, aa_sequence, aa_length)

Represents a translated protein from an ORF.

class genome_entropy.translate.translator.ProteinRecord(orf, aa_sequence, aa_length)[source]

Represents a translated protein from an ORF.

Parameters:
orf

The OrfRecord that was translated

Type:

genome_entropy.orf.types.OrfRecord

aa_sequence

The amino acid sequence

Type:

str

aa_length

Length of the amino acid sequence

Type:

int

orf: OrfRecord
aa_sequence: str
aa_length: int
__post_init__()[source]

Validate protein attributes.

Return type:

None

__init__(orf, aa_sequence, aa_length)
Parameters:
Return type:

None

genome_entropy.translate.translator.translate_orf(orf, table_id=11)[source]

Translate an ORF to a protein sequence.

Uses the pygenetic-code library for translation with NCBI genetic codes. Ambiguous codons (containing N or other IUPAC codes) are translated to ‘X’.

Parameters:
  • orf (OrfRecord) – OrfRecord to translate

  • table_id (int) – NCBI genetic code table ID (default: from config)

Returns:

ProteinRecord with translated sequence

Raises:

TranslationError – If translation fails

Return type:

ProteinRecord

genome_entropy.translate.translator.translate_orfs(orfs, table_id=11)[source]

Translate multiple ORFs to protein sequences.

Parameters:
  • orfs (List[OrfRecord]) – List of OrfRecord objects to translate

  • table_id (int) – NCBI genetic code table ID

Returns:

List of ProteinRecord objects

Return type:

List[ProteinRecord]