Codon

A C++ nucleotide library built for speed

  • C++
  • Bioinformatics
  • CLI
  • CMake

Codon is a small C++ library that stores a codon (a three-base DNA/RNA unit) in a single byte, enabling fast bit-manipulation operations for high-throughput genomic analysis. Each nucleotide is packed with two bits (A=00, G=01, C=10, T=11), plus an orientation marker โ€” so a full sequence can be scanned, reversed, complemented, or translated without ever falling back to one-character-per-base string handling.

The library ships with:

  • Seq โ€” a codon-aware sequence container with locator-based indexing that stays correct even across partial/shifted codons.
  • Codon โ€” the core single-byte building block, with getters, flip/reverse transforms, and VOID handling for empty state.
  • FASTA read/write and a CLI tool for common operations like reversing a range of bases directly from the command line.

Codon is still under active development โ€” breaking changes can happen, so building from the main branch and upgrading manually is recommended over pulling the latest automatically.

Head into the docs for the full API walkthrough, starting with the Codon primitive and working up through Seq and its locator system.

Esc