cuSBF
Loading...
Searching...
No Matches
Static Public Member Functions | Static Public Attributes | List of all members
cusbf::DnaAlphabet Struct Reference

An alphabet for encoding DNA sequences, consisting of the symbols A, C, G, and T. More...

Static Public Member Functions

constexpr __host__ __device__ static __forceinline__ uint8_t encode (const char *input)
 

Static Public Attributes

static constexpr uint64_t symbolWidth = 1
 
static constexpr uint64_t symbolCount = 4
 
static constexpr uint8_t invalidSymbol = 0xFFu
 
static constexpr uint8_t separator = 'N'
 
static constexpr char validBytes [] = "ACGT"
 

Detailed Description

An alphabet for encoding DNA sequences, consisting of the symbols A, C, G, and T.

Each symbol is encoded as a 2-bit value: A=0, C=1, T=2, G=3. Invalid bytes are encoded as 0xFF.

Definition at line 113 of file Alphabet.cuh.

Member Function Documentation

◆ encode()

constexpr __host__ __device__ static __forceinline__ uint8_t cusbf::DnaAlphabet::encode ( const char *  input)
inlinestaticconstexpr

Definition at line 120 of file Alphabet.cuh.

122 {
123 const auto byte = static_cast<uint8_t>(input[0]);
124 const uint8_t upper = byte & 0xDFu; // force upper for validation only
125 const uint8_t x = (byte >> 1u) & 3u; // A=0, C=1, T=2, G=3
126 const uint8_t valid = (upper == 'A') | (upper == 'C') | (upper == 'G') | (upper == 'T');
127 const uint8_t mask = -valid;
128 return (x & mask) | (invalidSymbol & ~mask);
129 }
static constexpr uint8_t invalidSymbol
Definition Alphabet.cuh:116
Here is the caller graph for this function:

Member Data Documentation

◆ invalidSymbol

constexpr uint8_t cusbf::DnaAlphabet::invalidSymbol = 0xFFu
staticconstexpr

Definition at line 116 of file Alphabet.cuh.

◆ separator

constexpr uint8_t cusbf::DnaAlphabet::separator = 'N'
staticconstexpr

Definition at line 117 of file Alphabet.cuh.

◆ symbolCount

constexpr uint64_t cusbf::DnaAlphabet::symbolCount = 4
staticconstexpr

Definition at line 115 of file Alphabet.cuh.

◆ symbolWidth

constexpr uint64_t cusbf::DnaAlphabet::symbolWidth = 1
staticconstexpr

Definition at line 114 of file Alphabet.cuh.

◆ validBytes

constexpr char cusbf::DnaAlphabet::validBytes[] = "ACGT"
staticconstexpr

Definition at line 118 of file Alphabet.cuh.


The documentation for this struct was generated from the following file: