Bio.SeqUtils.CodonUsage module

Methods for codon usage calculations.

class Bio.SeqUtils.CodonUsage.CodonAdaptationIndex

Bases: object

A codon adaptation index (CAI) implementation.

Implements the codon adaptation index (CAI) described by Sharp and Li (Nucleic Acids Res. 1987 Feb 11;15(3):1281-95).

NOTE - This implementation does not currently cope with alternative genetic codes: only the synonymous codons in the standard table are considered.

__init__()

Initialize the class.

set_cai_index(index)

Set up an index to be used when calculating CAI for a gene.

Just pass a dictionary similar to the SharpEcoliIndex in the CodonUsageIndices module.

generate_index(fasta_file)

Generate a codon usage index from a FASTA file of CDS sequences.

Takes a location of a Fasta file containing CDS sequences (which must all have a whole number of codons) and generates a codon usage index.

cai_for_gene(dna_sequence)

Calculate the CAI (float) for the provided DNA sequence (string).

This method uses the Index (either the one you set or the one you generated) and returns the CAI for the DNA sequence.

__str__()

Return str(self).

print_index()

Print out the index used.

This just gives the index when the objects is printed.