Skip to contents

get_codon_table creates a standardized codon table based on genetic codes cataloged by NCBI. This function provides the mapping between codons and amino acids for different organisms and organelles, which is essential for accurate codon usage analysis.

Usage

get_codon_table(gcid = "1")

Arguments

gcid

A character string specifying the NCBI genetic code ID. Use show_codon_tables() to view all available genetic codes and their corresponding IDs. Default is "1" (standard genetic code).

Value

A data.table with four columns:

  • aa_code: Single-letter amino acid code

  • amino_acid: Three-letter amino acid abbreviation

  • codon: Three-nucleotide codon sequence

  • subfam: Codon subfamily identifier (amino_acid_XY format)

Examples

# Standard genetic code (used by most organisms)
standard_code <- get_codon_table()
head(standard_code)
#>    aa_code amino_acid  codon subfam
#>     <char>     <char> <char> <char>
#> 1:       F        Phe    TTT Phe_TT
#> 2:       F        Phe    TTC Phe_TT
#> 3:       L        Leu    TTA Leu_TT
#> 4:       L        Leu    TTG Leu_TT
#> 5:       S        Ser    TCT Ser_TC
#> 6:       S        Ser    TCC Ser_TC

# Vertebrate mitochondrial genetic code
mito_code <- get_codon_table(gcid = '2')
head(mito_code)
#>    aa_code amino_acid  codon subfam
#>     <char>     <char> <char> <char>
#> 1:       F        Phe    TTT Phe_TT
#> 2:       F        Phe    TTC Phe_TT
#> 3:       L        Leu    TTA Leu_TT
#> 4:       L        Leu    TTG Leu_TT
#> 5:       S        Ser    TCT Ser_TC
#> 6:       S        Ser    TCC Ser_TC