Skip to main content

Module encoding

Module encoding 

Source
Expand description

DNA nucleotide encoding

This module implements the 2-bit encoding scheme for DNA nucleotides, matching the C++ SSHash implementation exactly.

Default encoding (SSHash custom):

  • A (65/97) -> 00
  • C (67/99) -> 01
  • G (71/103) -> 11
  • T (84/116) -> 10

Enums§

EncodingError
Error type for encoding operations

Functions§

complement_base
Get the complement of a DNA base (encoded)
decode_base
Decode a 2-bit value to DNA nucleotide (uppercase)
decode_string
Decode a bit-packed representation back to a DNA string
encode_base
Encode a single DNA nucleotide to 2 bits
encode_sequence
Encode a DNA sequence (byte slice) to a bit-packed representation
encode_string
Encode a DNA string to a bit-packed representation