codeine.CodonWeights

class codeine.CodonWeights(weights: Dict[str, Dict[str, float | int]], rna: bool | None = None, table: TranslationTable | None = None)[source]

Bases: object

A class to store codon weights, for example codon usage information for a specific organism.

Input weights are grouped by amino acid:

{
    'A': {'GCT': 1.0, 'GCC': 1.0, ...},
    'R': {'CGT': 1.0, 'CGC': 1.0, ...},
    ...
}

Stored weights are flat:

{
    'GCT': 0.25,
    'GCC': 0.25,
    ...
}

Weights are normalised per amino acid.

Parameters:
  • weights

    Codon weights grouped by amino acid, for codons in the TranslationTable.

    Example:

    {
        'A': {'GCT': 1.0, 'GCC': 1.0, 'GCA': 1.0, 'GCG': 1.0},
        'R': {'CGT': 1.0, 'CGC': 1.0, 'CGA': 1.0,
              'CGG': 1.0, 'AGA': 1.0, 'AGG': 1.0},
        ...
    }
    

  • rna – Whether to use rna (default is False, i.e. use DNA).

Methods

arabidopsis([rna])

Construct a CodonWeights object with codon probabilities corresponding to A.

by_aa(aa)

Return the codon weights corresponding to a particular AA.

drosophila([rna])

Construct a CodonWeights object with codon probabilities corresponding to D.

ecoli([rna])

Construct a CodonWeights object with codon probabilities corresponding to E.

human([rna])

Construct a CodonWeights object with codon probabilities corresponding to Human.

mouse([rna])

Construct a CodonWeights object with codon probabilities corresponding to Mouse.

uniform([table, rna])

Construct a CodonWeights object with uniform codon weights for a given translation table.

yeast([rna])

Construct a CodonWeights object with codon probabilities corresponding to 'yeast'.

classmethod CodonWeights.arabidopsis(rna: bool | None = None) CodonWeights[source]

Construct a CodonWeights object with codon probabilities corresponding to A. thaliana.

Weights are based on codon usage counts from GenScript:

https://www.genscript.com/tools/codon-frequency-table

Parameters:

rna – Whether to use RNA.

Return type:

A CodonWeights object corresponding to Arabidopsis thaliana.

CodonWeights.by_aa(aa: str) Dict[str, float][source]

Return the codon weights corresponding to a particular AA.

Parameters:

aa – The amino acid of interest.

Return type:

A set of codon weights keyed by codon.

classmethod CodonWeights.drosophila(rna: bool | None = None) CodonWeights[source]

Construct a CodonWeights object with codon probabilities corresponding to D. melanogaster.

Weights are based on codon usage counts from GenScript:

https://www.genscript.com/tools/codon-frequency-table

Parameters:

rna – Whether to use RNA.

Return type:

A CodonWeights object corresponding to Drosophila melanogaster.

classmethod CodonWeights.ecoli(rna: bool | None = None) CodonWeights[source]

Construct a CodonWeights object with codon probabilities corresponding to E. coli.

Weights are based on codon usage counts from GenScript:

https://www.genscript.com/tools/codon-frequency-table

Parameters:

rna – Whether to use RNA.

Return type:

A CodonWeights object corresponding to E. Coli

classmethod CodonWeights.human(rna: bool | None = None) CodonWeights[source]

Construct a CodonWeights object with codon probabilities corresponding to Human.

Weights are based on codon usage counts from GenScript:

https://www.genscript.com/tools/codon-frequency-table

Parameters:

rna – Whether to use RNA.

Return type:

A CodonWeights object corresponding to Human.

classmethod CodonWeights.mouse(rna: bool | None = None) CodonWeights[source]

Construct a CodonWeights object with codon probabilities corresponding to Mouse.

Weights are based on codon usage counts from GenScript:

https://www.genscript.com/tools/codon-frequency-table

Parameters:

rna – Whether to use RNA.

Return type:

A CodonWeights object corresponding to Mouse.

classmethod CodonWeights.uniform(table: TranslationTable | None = None, rna: bool | None = None) CodonWeights[source]

Construct a CodonWeights object with uniform codon weights for a given translation table.

Parameters:
  • table – The reference table. If blank, use the standard genetic code.

  • rna – Whether to use RNA.

Return type:

A uniform CodonWeights object.

classmethod CodonWeights.yeast(rna: bool | None = None) CodonWeights[source]

Construct a CodonWeights object with codon probabilities corresponding to ‘yeast’.

Weights are based on codon usage counts from GenScript:

https://www.genscript.com/tools/codon-frequency-table

Parameters:

rna – Whether to use RNA.

Return type:

A CodonWeights object corresponding to S. cerevisiea