count_codons: Count codon frequencies in coding sequences

View source: R/sequences.R

count_codonsR Documentation

Count codon frequencies in coding sequences

Description

count_codons tabulates the frequency of all 64 possible codons across input coding sequences. This function provides the foundation for most codon usage bias analyses in the cubar package.

Usage

count_codons(seqs, ...)

Arguments

seqs

Coding sequences as a DNAStringSet object, or compatible input that can be coerced to DNAStringSet.

...

Additional arguments passed to Biostrings::trinucleotideFrequency.

Value

A matrix where rows represent individual CDS sequences and columns represent the 64 possible codons. Each cell contains the frequency count of the corresponding codon in the respective sequence.

Examples

# Count codon frequencies across all yeast CDS sequences
cf_all <- count_codons(yeast_cds)
dim(cf_all)
cf_all[1:5, 1:5]

# Count codons for a single sequence
count_codons(yeast_cds[1])


cubar documentation built on Aug. 21, 2025, 5:40 p.m.