Zip and Skip Tries
Loading...
Searching...
No Matches
nucleotide.hpp
Go to the documentation of this file.
1
14#pragma once
15
16#include <array>
17#include <cstdint> // for uint8_t
18#include <stdexcept> // for std::invalid_argument
19#include <fstream>
20
29enum class Nucleotide : uint8_t
30{
31 A = 0,
32 C = 1,
33 G = 2,
34 T = 3,
35 INVALID
36};
37
44static constexpr std::array<Nucleotide, 256> char_to_nucleotide = []() {
45 std::array<Nucleotide, 256> result;
46 result.fill(Nucleotide::INVALID);
47
48 // Initialize valid nucleotide mappings
49 result['A'] = Nucleotide::A;
50 result['a'] = Nucleotide::A;
51 result['C'] = Nucleotide::C;
52 result['c'] = Nucleotide::C;
53 result['G'] = Nucleotide::G;
54 result['g'] = Nucleotide::G;
55 result['T'] = Nucleotide::T;
56 result['t'] = Nucleotide::T;
57
58 return result;
59}();
60
69static constexpr std::array<char, 4> nucleotide_to_char = {
70 'A', 'C', 'G', 'T'
71};
72
83
98std::ostream& operator<<(std::ostream& os, const Nucleotide& nucleotide);
T * alloc_to_device(size_t size)
Allocates memory on the CUDA device.
bool is_valid_nucleotide(char nucleotide)
Checks if a character represents a valid nucleotide.
static constexpr std::array< char, 4 > nucleotide_to_char
Lookup table for converting nucleotides to characters.
Nucleotide
Enumerates the four nucleotides of DNA.
@ C
Cytosine.
@ A
Adenine.
@ T
Thymine.
@ INVALID
Invalid nucleotide.
@ G
Guanine.
std::ostream & operator<<(std::ostream &os, const Nucleotide &nucleotide)
Inserts a textual representation of a nucleotide into an output stream.
static constexpr std::array< Nucleotide, 256 > char_to_nucleotide
Lookup table for converting characters to nucleotides.