Codon

A C++ nucleotide library built for size and 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. Resembling the natural building blocks this naturally recudes the size by a third while still retaining fast bit-manipulation operations for high-throughput genomic analysis. Each nucleotide is encoded via two bits (A=00, G=01, C=10, T=11), plus an marker indicating the size. This setup guarentees a fast O(1) length lookup and a natural integration with commonly used genomic operations (e.g. flipping/transcription and translation) without ever falling back to string handling.

The library ships with:

  • Codon โ€” the core single-byte building block, with getters, setters, flip/reverse transforms and more.
  • Seq โ€” A custom dynamically resizable container that is compatible with C++20 ranges and built on top of std::vector that enforces strict guarantees, search and a familiar API. Using Seq makes the library much easier to use but it is not necessary and you can easily create your own wrapper, if for example you want to perform operations during compile time.
  • read/write and a CLI tool for input/output and output. The CLI also accept additional flags and operation (e.g. flipping or reversing a subrange), allowing you to quickly verify findings or test out things without having to write any code.

โš ๏ธCodon is still under active development but is rapidly approaching its first 0.0.1 release. Breaking changes are not uncommon, especially for the Seq API which is currently experiencing a larger refactor. The [main] branch is stable but might not align with documentation that is already being updated to include new 0.0.1 features.

Head into the docs for the brisk API walkthrough, starting with the Codon primitive and working up through the rest.

Project philosophy

This project aims to stay/be relatively small, performant and easy to use. It aims to provide the necessary tools for performant nucleotid operations and nothing more. This, however, does not mean that this library will be header only.

Esc