Skip to contents


cubar is a package for codon usage bias analysis in R. Main features are listed as follows:

  • Codon level analyses
    • Support NCBI and custom genetic codes
    • Calculate tRNA weights
    • Calculate relative synonymous codon usage (RSCU)
    • Machine learning-based inference of optimal codons
    • Visualization codon-anticodon pairing relationships
  • Gene level analyses
    • Codon frequency matrix
    • Codon Adaptation Index (CAI)
    • Mean Codon Stabilization Coefficients (CSCg)
    • Effective number of codons (ENC)
    • Fraction of optimal codons (Fop)
    • GC content at 4-fold degenerate sites (GC4d)
    • tRNA Adaptation Index (tAI)



  • R (>= 4.1.0)


  • Biostrings (>= 2.60.0),
  • IRanges (>= 2.34.0),
  • data.table (>= 1.14.0),
  • ggplot2 (>= 3.3.5),
  • rlang (>= 0.4.11)


The latest release of cubar can be installed with:

The latest developmental version of cubar can be installed with:

devtools::install_github("mt1022/cubar", dependencies = TRUE)


Documentation can be found within R (by typing ?function_name). The following tutorials are available from our website:


  • Biostrings for sequence input/output and manipulation.
  • Peptides for peptide- or protein-related indices.

Getting help

Please use GitHub issues for bug reports, questions, and feature requests.


GitHub Copilot was used to suggest code snippets in the development of this package. Thanks the GitHub Education teacher program for providing free access to GitHub Copilot.