1 #ifndef GENESIS_SEQUENCE_KMER_KMER_H_
2 #define GENESIS_SEQUENCE_KMER_KMER_H_
68 template<
typename Tag = KmerTagDefault>
86 static_assert( CHAR_BIT == 8,
"CHAR_BIT != 8" );
131 if( k_ != 0 &&
k != k_ ) {
132 throw std::runtime_error(
"Cannot set k for a given Tag multiple times");
148 throw std::invalid_argument(
"Cannot use k-mer with k==" +
std::to_string(
k ));
160 if( position >= k_ ) {
161 throw std::runtime_error(
166 return ( data_ & dna_char_mask_[position] ) >> ( position *
BITS_PER_CHAR );
186 static const WordType all_1_ = (((1ul << 32) - 1) << 32) + ((1ul << 32) - 1);
193 static const std::array<WordType, MAX_CHARS_PER_KMER> dna_char_mask_;
238 template<
typename Tag>
239 uint8_t Kmer<Tag>::k_ = 0;
241 template<
typename Tag>
244 1ul << 0 | 1ul << 1, 1ul << 2 | 1ul << 3, 1ul << 4 | 1ul << 5, 1ul << 6 | 1ul << 7,
245 1ul << 8 | 1ul << 9, 1ul << 10 | 1ul << 11, 1ul << 12 | 1ul << 13, 1ul << 14 | 1ul << 15,
246 1ul << 16 | 1ul << 17, 1ul << 18 | 1ul << 19, 1ul << 20 | 1ul << 21, 1ul << 22 | 1ul << 23,
247 1ul << 24 | 1ul << 25, 1ul << 26 | 1ul << 27, 1ul << 28 | 1ul << 29, 1ul << 30 | 1ul << 31,
248 1ul << 32 | 1ul << 33, 1ul << 34 | 1ul << 35, 1ul << 36 | 1ul << 37, 1ul << 38 | 1ul << 39,
249 1ul << 40 | 1ul << 41, 1ul << 42 | 1ul << 43, 1ul << 44 | 1ul << 45, 1ul << 46 | 1ul << 47,
250 1ul << 48 | 1ul << 49, 1ul << 50 | 1ul << 51, 1ul << 52 | 1ul << 53, 1ul << 54 | 1ul << 55,
251 1ul << 56 | 1ul << 57, 1ul << 58 | 1ul << 59, 1ul << 60 | 1ul << 61, 1ul << 62 | 1ul << 63
257 #endif // include guard