Skip to contents

get_cai calculates Codon Adaptation Index (CAI) of each input CDS

Usage

get_cai(cf, rscu, level = "subfam")

Arguments

cf

matrix of codon frequencies as calculated by count_codons().

rscu

rscu table containing CAI weight for each codon. This table could be generated with est_rscu or prepared manually.

level

"subfam" (default) or "amino_acid". For which level to determine CAI.

Value

a named vector of CAI values

References

Sharp PM, Li WH. 1987. The codon Adaptation Index–a measure of directional synonymous codon usage bias, and its potential applications. Nucleic Acids Res 15:1281-1295.

Examples

# estimate CAI of yeast genes based on RSCU of highly expressed genes
heg <- head(yeast_exp[order(-yeast_exp$fpkm), ], n = 500)
cf_all <- count_codons(yeast_cds)
cf_heg <- cf_all[heg$gene_id, ]
rscu_heg <- est_rscu(cf_heg)
cai <- get_cai(cf_all, rscu_heg)
head(cai)
#>   YPL071C   YLL050C   YMR172W   YOR185C   YLL032C   YBR225W 
#> 0.5590442 0.8212905 0.5112301 0.6534497 0.5670395 0.5485641 
hist(cai)