btllib: include/btllib/nthash_lowlevel.hpp Source File

btllib

Loading...
Searching...
No Matches
nthash_lowlevel.hpp
1/*
2 * nthash_lowlevel.hpp
3 * Author: Hamid Mohamadi
4 * Genome Sciences Centre,
5 * British Columbia Cancer Agency
6 */
7
8#ifndef BTLLIB_NTHASH_LOWLEVEL_HPP
9#define BTLLIB_NTHASH_LOWLEVEL_HPP
10
11#include "btllib/nthash_consts.hpp"
12#include <array>
13#include <cstddef>
14#include <cstdint>
15#include <ctime>
16#include <iostream>
17#include <limits>
18#include <string>
19#include <vector>
20
21namespace btllib {
22
23template<typename T>
24inline T
25canonical(const T fwd, const T rev)
26{
27 return fwd + rev;
28}
29
30static_assert(std::numeric_limits<unsigned>::max() + 1 == 0,
31 "Integers don't overflow on this platform which is necessary for "
32 "ntHash canonical hash computation.");
33
34// Data structures for spaced seeds
35
36// List of don't care positions
37using SpacedSeed = std::vector<unsigned>;
38
39// Bx2 array representing block start and end positions.
40using SpacedSeedBlocks = std::vector<std::array<unsigned, 2>>;
41
42// List of blocks with sizes of one.
43using SpacedSeedMonomers = std::vector<unsigned>;
44
53inline uint64_t
54srol(const uint64_t x)
55{
56 uint64_t m = ((x & 0x8000000000000000ULL) >> 30) | // NOLINT
57 ((x & 0x100000000ULL) >> 32); // NOLINT
58 return ((x << 1) & 0xFFFFFFFDFFFFFFFFULL) | m; // NOLINT
59}
60
70inline uint64_t
71 srol(const uint64_t x, const unsigned d)
72{
73 uint64_t v = (x << d) | (x >> (64 - d)); // NOLINT
74 uint64_t y = (v ^ (v >> 33)) & // NOLINT
75 (std::numeric_limits<uint64_t>::max() >> (64 - d)); // NOLINT
76 return v ^ (y | (y << 33)); // NOLINT
77}
78
87inline uint64_t
88sror(const uint64_t x)
89{
90 uint64_t m = ((x & 0x200000000ULL) << 30) | ((x & 1ULL) << 32); // NOLINT
91 return ((x >> 1) & 0xFFFFFFFEFFFFFFFFULL) | m; // NOLINT
92}
93
102inline uint64_t
103ntf64(const char* kmer_seq, unsigned k)
104{
105 uint64_t h_val = 0;
106 for (unsigned i = 0; i < k / 4; i++) {
107 h_val = srol(h_val, 4);
108 const uint8_t curr_offset = 4 * i;
109 const uint8_t tetramer_loc =
110 64 * CONVERT_TAB[(unsigned char)kmer_seq[curr_offset]] + // NOLINT
111 16 * CONVERT_TAB[(unsigned char)kmer_seq[curr_offset + 1]] + // NOLINT
112 4 * CONVERT_TAB[(unsigned char)kmer_seq[curr_offset + 2]] +
113 CONVERT_TAB[(unsigned char)kmer_seq[curr_offset + 3]];
114 h_val ^= TETRAMER_TAB[tetramer_loc];
115 }
116 const unsigned remainder = k % 4;
117 h_val = srol(h_val, remainder);
118 if (remainder == 3) {
119 const uint8_t trimer_loc =
120 16 * CONVERT_TAB[(unsigned char)kmer_seq[k - 3]] + // NOLINT
121 4 * CONVERT_TAB[(unsigned char)kmer_seq[k - 2]] +
122 CONVERT_TAB[(unsigned char)kmer_seq[k - 1]];
123 h_val ^= TRIMER_TAB[trimer_loc];
124 } else if (remainder == 2) {
125 const uint8_t dimer_loc = 4 * CONVERT_TAB[(unsigned char)kmer_seq[k - 2]] +
126 CONVERT_TAB[(unsigned char)kmer_seq[k - 1]];
127 h_val ^= DIMER_TAB[dimer_loc];
128 } else if (remainder == 1) {
129 h_val ^= SEED_TAB[(unsigned char)kmer_seq[k - 1]];
130 }
131 return h_val;
132}
133
143inline uint64_t
144ntr64(const char* kmer_seq, unsigned k)
145{
146 uint64_t h_val = 0;
147 const unsigned remainder = k % 4;
148 if (remainder == 3) {
149 const uint8_t trimer_loc =
150 16 * RC_CONVERT_TAB[(unsigned char)kmer_seq[k - 1]] + // NOLINT
151 4 * RC_CONVERT_TAB[(unsigned char)kmer_seq[k - 2]] +
152 RC_CONVERT_TAB[(unsigned char)kmer_seq[k - 3]];
153 h_val ^= TRIMER_TAB[trimer_loc];
154 } else if (remainder == 2) {
155 const uint8_t dimer_loc =
156 4 * RC_CONVERT_TAB[(unsigned char)kmer_seq[k - 1]] +
157 RC_CONVERT_TAB[(unsigned char)kmer_seq[k - 2]];
158 h_val ^= DIMER_TAB[dimer_loc];
159 } else if (remainder == 1) {
160 h_val ^= SEED_TAB[(unsigned char)kmer_seq[k - 1] & CP_OFF];
161 }
162 for (unsigned i = 0; i < k / 4; i++) {
163 h_val = srol(h_val, 4);
164 const uint8_t curr_offset = 4 * (k / 4 - i) - 1;
165 const uint8_t tetramer_loc =
166 64 * RC_CONVERT_TAB[(unsigned char)kmer_seq[curr_offset]] + // NOLINT
167 16 * RC_CONVERT_TAB[(unsigned char)kmer_seq[curr_offset - 1]] + // NOLINT
168 4 * RC_CONVERT_TAB[(unsigned char)kmer_seq[curr_offset - 2]] +
169 RC_CONVERT_TAB[(unsigned char)kmer_seq[curr_offset - 3]];
170 h_val ^= TETRAMER_TAB[tetramer_loc];
171 }
172 return h_val;
173}
174
186inline uint64_t
187 ntf64(uint64_t fh_val,
188 unsigned k,
189 unsigned char char_out,
190 unsigned char char_in)
191{
192 uint64_t h_val = srol(fh_val);
193 h_val ^= SEED_TAB[char_in];
194 h_val ^= MS_TAB(char_out, k);
195 return h_val;
196}
197
210inline uint64_t
211 ntr64(uint64_t rh_val,
212 unsigned k,
213 unsigned char char_out,
214 unsigned char char_in)
215{
216 uint64_t h_val = rh_val ^ MS_TAB(char_in & CP_OFF, k);
217 h_val ^= SEED_TAB[char_out & CP_OFF];
218 h_val = sror(h_val);
219 return h_val;
220}
221
230inline uint64_t
231ntc64(const char* kmer_seq, unsigned k)
232{
233 uint64_t fh_val = 0, rh_val = 0;
234 fh_val = ntf64(kmer_seq, k);
235 rh_val = ntr64(kmer_seq, k);
236 return canonical(fh_val, rh_val);
237}
238
250inline uint64_t
251 ntc64(const char* kmer_seq, unsigned k, uint64_t& fh_val, uint64_t& rh_val)
252{
253 fh_val = ntf64(kmer_seq, k);
254 rh_val = ntr64(kmer_seq, k);
255 return canonical(fh_val, rh_val);
256}
257
269inline uint64_t
270 ntc64(unsigned char char_out,
271 unsigned char char_in,
272 unsigned k,
273 uint64_t& fh_val,
274 uint64_t& rh_val)
275{
276 fh_val = ntf64(fh_val, k, char_out, char_in);
277 rh_val = ntr64(rh_val, k, char_out, char_in);
278 return canonical(fh_val, rh_val);
279}
280
291inline uint64_t
292ntf64l(uint64_t rh_val,
293 unsigned k,
294 unsigned char char_out,
295 unsigned char char_in)
296{
297 uint64_t h_val = rh_val ^ MS_TAB(char_in, k);
298 h_val ^= SEED_TAB[char_out];
299 h_val = sror(h_val);
300 return h_val;
301}
302
313inline uint64_t
314ntr64l(uint64_t fh_val,
315 unsigned k,
316 unsigned char char_out,
317 unsigned char char_in)
318{
319 uint64_t h_val = srol(fh_val);
320 h_val ^= SEED_TAB[char_in & CP_OFF];
321 h_val ^= MS_TAB(char_out & CP_OFF, k);
322 return h_val;
323}
324
337inline uint64_t
338ntc64l(unsigned char char_out,
339 unsigned char char_in,
340 unsigned k,
341 uint64_t& fh_val,
342 uint64_t& rh_val)
343{
344 fh_val = ntf64l(fh_val, k, char_out, char_in);
345 rh_val = ntr64l(rh_val, k, char_out, char_in);
346 return canonical(fh_val, rh_val);
347}
348
357inline void
358nte64(uint64_t bh_val, unsigned k, unsigned h, uint64_t* h_val)
359{
360 uint64_t t_val;
361 h_val[0] = bh_val;
362 for (unsigned i = 1; i < h; i++) {
363 t_val = bh_val * (i ^ k * MULTISEED);
364 t_val ^= t_val >> MULTISHIFT;
365 h_val[i] = t_val;
366 }
367}
368
377inline void
378ntmc64(const char* kmer_seq, unsigned k, unsigned m, uint64_t* h_val)
379{
380 const uint64_t b_val = ntc64(kmer_seq, k);
381 nte64(b_val, k, m, h_val);
382}
383
395inline void
396ntmc64(const char* kmer_seq,
397 unsigned k,
398 unsigned m,
399 uint64_t& fh_val,
400 uint64_t& rh_val,
401 uint64_t* h_val)
402{
403 const uint64_t b_val = ntc64(kmer_seq, k, fh_val, rh_val);
404 nte64(b_val, k, m, h_val);
405}
406
418inline void
419ntmc64(unsigned char char_out,
420 unsigned char char_in,
421 unsigned k,
422 unsigned m,
423 uint64_t& fh_val,
424 uint64_t& rh_val,
425 uint64_t* h_val)
426{
427 const uint64_t b_val = ntc64(char_out, char_in, k, fh_val, rh_val);
428 nte64(b_val, k, m, h_val);
429}
430
442inline void
443ntmc64l(unsigned char char_out,
444 unsigned char char_in,
445 unsigned k,
446 unsigned m,
447 uint64_t& fh_val,
448 uint64_t& rh_val,
449 uint64_t* h_val)
450{
451 const uint64_t b_val = ntc64l(char_out, char_in, k, fh_val, rh_val);
452 nte64(b_val, k, m, h_val);
453}
454
467inline bool
468 ntc64(const char* kmer_seq, unsigned k, uint64_t& h_val, unsigned& loc_n)
469{
470 h_val = 0;
471 loc_n = 0;
472 uint64_t fh_val = 0, rh_val = 0;
473 for (int i = int(k - 1); i >= 0; i--) {
474 if (SEED_TAB[(unsigned char)kmer_seq[i]] == SEED_N) {
475 loc_n = i;
476 return false;
477 }
478 fh_val = srol(fh_val);
479 fh_val ^= SEED_TAB[(unsigned char)kmer_seq[k - 1 - i]];
480
481 rh_val = srol(rh_val);
482 rh_val ^= SEED_TAB[(unsigned char)kmer_seq[i] & CP_OFF];
483 }
484 h_val = canonical(fh_val, rh_val);
485 return true;
486}
487
501inline bool
502ntmc64(const char* kmer_seq,
503 unsigned k,
504 unsigned m,
505 unsigned& loc_n,
506 uint64_t* h_val)
507{
508 uint64_t b_val = 0, fh_val = 0, rh_val = 0;
509 loc_n = 0;
510 for (int i = int(k - 1); i >= 0; i--) {
511 if (SEED_TAB[(unsigned char)kmer_seq[i]] == SEED_N) {
512 loc_n = i;
513 return false;
514 }
515 fh_val = srol(fh_val);
516 fh_val ^= SEED_TAB[(unsigned char)kmer_seq[k - 1 - i]];
517
518 rh_val = srol(rh_val);
519 rh_val ^= SEED_TAB[(unsigned char)kmer_seq[i] & CP_OFF];
520 }
521 b_val = canonical(fh_val, rh_val);
522 nte64(b_val, k, m, h_val);
523 return true;
524}
525
540inline bool
541 ntc64(const char* kmer_seq,
542 unsigned k,
543 uint64_t& fh_val,
544 uint64_t& rh_val,
545 uint64_t& h_val,
546 unsigned& loc_n)
547{
548 h_val = fh_val = rh_val = 0;
549 loc_n = 0;
550 for (int i = int(k - 1); i >= 0; i--) {
551 if (SEED_TAB[(unsigned char)kmer_seq[i]] == SEED_N) {
552 loc_n = i;
553 return false;
554 }
555 fh_val = srol(fh_val);
556 fh_val ^= SEED_TAB[(unsigned char)kmer_seq[k - 1 - i]];
557
558 rh_val = srol(rh_val);
559 rh_val ^= SEED_TAB[(unsigned char)kmer_seq[i] & CP_OFF];
560 }
561 h_val = canonical(fh_val, rh_val);
562 return true;
563}
564
580inline bool
581ntmc64(const char* kmer_seq,
582 unsigned k,
583 unsigned m,
584 uint64_t& fh_val,
585 uint64_t& rh_val,
586 unsigned& loc_n,
587 uint64_t* h_val)
588{
589 fh_val = rh_val = 0;
590 uint64_t b_val = 0;
591 loc_n = 0;
592 for (int i = int(k - 1); i >= 0; i--) {
593 if (SEED_TAB[(unsigned char)kmer_seq[i]] == SEED_N) {
594 loc_n = i;
595 return false;
596 }
597 fh_val = srol(fh_val);
598 fh_val ^= SEED_TAB[(unsigned char)kmer_seq[k - 1 - i]];
599
600 rh_val = srol(rh_val);
601 rh_val ^= SEED_TAB[(unsigned char)kmer_seq[i] & CP_OFF];
602 }
603 b_val = canonical(fh_val, rh_val);
604 nte64(b_val, k, m, h_val);
605 return true;
606}
607
625inline bool
626ntmc64(const char* kmer_seq,
627 unsigned k,
628 unsigned m,
629 uint64_t& fh_val,
630 uint64_t& rh_val,
631 unsigned& loc_n,
632 uint64_t* h_val,
633 bool& h_stn)
634{
635 fh_val = rh_val = 0;
636 uint64_t b_val = 0;
637 loc_n = 0;
638 for (int i = int(k - 1); i >= 0; i--) {
639 if (SEED_TAB[(unsigned char)kmer_seq[i]] == SEED_N) {
640 loc_n = i;
641 return false;
642 }
643 fh_val = srol(fh_val);
644 fh_val ^= SEED_TAB[(unsigned char)kmer_seq[k - 1 - i]];
645
646 rh_val = srol(rh_val);
647 rh_val ^= SEED_TAB[(unsigned char)kmer_seq[i] & CP_OFF];
648 }
649 h_stn = rh_val < fh_val;
650 b_val = canonical(fh_val, rh_val);
651 nte64(b_val, k, m, h_val);
652 return true;
653}
654
668inline void
669ntmc64(unsigned char char_out,
670 unsigned char char_in,
671 unsigned k,
672 unsigned m,
673 uint64_t& fh_val,
674 uint64_t& rh_val,
675 uint64_t* h_val,
676 bool& h_stn)
677{
678 const uint64_t b_val = ntc64(char_out, char_in, k, fh_val, rh_val);
679 h_stn = rh_val < fh_val;
680 nte64(b_val, k, m, h_val);
681}
682
696inline uint64_t
697mask_hash(uint64_t& fk_val,
698 uint64_t& rk_val,
699 const char* seed_seq,
700 const char* kmer_seq,
701 unsigned k)
702{
703 uint64_t fs_val = fk_val, rs_val = rk_val;
704 for (unsigned i = 0; i < k; i++) {
705 if (seed_seq[i] != '1') {
706 fs_val ^= MS_TAB((unsigned char)kmer_seq[i], k - 1 - i);
707 rs_val ^= MS_TAB((unsigned char)kmer_seq[i] & CP_OFF, i);
708 }
709 }
710 return canonical(fs_val, rs_val);
711}
712
727inline void
728sub_hash(uint64_t fh_val,
729 uint64_t rh_val,
730 const char* kmer_seq,
731 const std::vector<unsigned>& positions,
732 const std::vector<unsigned char>& new_bases,
733 unsigned k,
734 unsigned m,
735 uint64_t* h_val)
736{
737 uint64_t b_val = 0;
738
739 for (size_t i = 0; i < positions.size(); i++) {
740 const auto pos = positions[i];
741 const auto new_base = new_bases[i];
742
743 fh_val ^= MS_TAB((unsigned char)kmer_seq[pos], k - 1 - pos);
744 fh_val ^= MS_TAB(new_base, k - 1 - pos);
745
746 rh_val ^= MS_TAB((unsigned char)kmer_seq[pos] & CP_OFF, pos);
747 rh_val ^= MS_TAB(new_base & CP_OFF, pos);
748 }
749
750 b_val = canonical(fh_val, rh_val);
751 nte64(b_val, k, m, h_val);
752}
753
778inline bool
779ntmsm64(const char* kmer_seq,
780 const std::vector<SpacedSeedBlocks>& seeds_blocks,
781 const std::vector<SpacedSeedMonomers>& seeds_monomers,
782 unsigned k,
783 unsigned m,
784 unsigned m2,
785 uint64_t* fh_nomonos,
786 uint64_t* rh_nomonos,
787 uint64_t* fh_val,
788 uint64_t* rh_val,
789 unsigned& loc_n,
790 uint64_t* h_val)
791{
792 unsigned i_base;
793 uint64_t fh_seed, rh_seed;
794 for (unsigned i_seed = 0; i_seed < m; i_seed++) {
795 fh_seed = 0;
796 rh_seed = 0;
797
798 for (const auto& block : seeds_blocks[i_seed]) {
799 for (unsigned pos = block[0]; pos < block[1]; pos++) {
800 if (kmer_seq[pos] == SEED_N) {
801 loc_n = pos;
802 return false;
803 }
804 fh_seed ^= MS_TAB((unsigned char)kmer_seq[pos], k - 1 - pos);
805 rh_seed ^= MS_TAB((unsigned char)kmer_seq[pos] & CP_OFF, pos);
806 }
807 }
808 fh_nomonos[i_seed] = fh_seed;
809 rh_nomonos[i_seed] = rh_seed;
810 for (const unsigned pos : seeds_monomers[i_seed]) {
811 fh_seed ^= MS_TAB((unsigned char)kmer_seq[pos], k - 1 - pos);
812 rh_seed ^= MS_TAB((unsigned char)kmer_seq[pos] & CP_OFF, pos);
813 }
814 fh_val[i_seed] = fh_seed;
815 rh_val[i_seed] = rh_seed;
816 i_base = i_seed * m2;
817 h_val[i_base] = canonical(fh_seed, rh_seed);
818 for (unsigned i_hash = 1; i_hash < m2; i_hash++) {
819 h_val[i_base + i_hash] = h_val[i_base] * (i_hash ^ k * MULTISEED);
820 h_val[i_base + i_hash] ^= h_val[i_base + i_hash] >> MULTISHIFT;
821 }
822 }
823 return true;
824}
825
826#define NTMSM64(ROL_HANDLING, IN_HANDLING, OUT_HANDLING, ROR_HANDLING) \
827 unsigned char char_out, char_in; \
828 uint64_t fh_seed, rh_seed; \
829 unsigned i_out, i_in, i_base; \
830 for (unsigned i_seed = 0; i_seed < m; i_seed++) { \
831 ROL_HANDLING /* NOLINT(bugprone-macro-parentheses) */ \
832 for (const auto& block : seeds_blocks[i_seed]) \
833 { \
834 IN_HANDLING \
835 OUT_HANDLING \
836 fh_seed ^= MS_TAB(char_out, k - i_out); \
837 fh_seed ^= MS_TAB(char_in, k - i_in); \
838 rh_seed ^= MS_TAB(char_out & CP_OFF, i_out); \
839 rh_seed ^= MS_TAB(char_in & CP_OFF, i_in); \
840 } \
841 ROR_HANDLING /* NOLINT(bugprone-macro-parentheses) */ \
842 fh_nomonos[i_seed] = fh_seed; \
843 rh_nomonos[i_seed] = rh_seed; \
844 for (const auto& pos : seeds_monomers[i_seed]) { \
845 fh_seed ^= MS_TAB((unsigned char)kmer_seq[pos + 1], k - 1 - pos); \
846 rh_seed ^= MS_TAB((unsigned char)kmer_seq[pos + 1] & CP_OFF, pos); \
847 } \
848 fh_val[i_seed] = fh_seed; \
849 rh_val[i_seed] = rh_seed; \
850 i_base = i_seed * m2; \
851 h_val[i_base] = canonical(fh_seed, rh_seed); \
852 for (unsigned i_hash = 1; i_hash < m2; i_hash++) { \
853 h_val[i_base + i_hash] = h_val[i_base] * (i_hash ^ k * MULTISEED); \
854 h_val[i_base + i_hash] ^= h_val[i_base + i_hash] >> MULTISHIFT; \
855 } \
856 }
857
879inline void
880ntmsm64(const char* kmer_seq,
881 const std::vector<SpacedSeedBlocks>& seeds_blocks,
882 const std::vector<SpacedSeedMonomers>& seeds_monomers,
883 unsigned k,
884 unsigned m,
885 unsigned m2,
886 uint64_t* fh_nomonos,
887 uint64_t* rh_nomonos,
888 uint64_t* fh_val,
889 uint64_t* rh_val,
890 uint64_t* h_val)
891{
892 NTMSM64(fh_seed = srol(fh_nomonos[i_seed]); rh_seed = rh_nomonos[i_seed];
893 , i_in = block[1];
894 char_in = (unsigned char)kmer_seq[i_in];
895 , i_out = block[0];
896 char_out = (unsigned char)kmer_seq[i_out];
897 , rh_seed = sror(rh_seed);)
898}
899
921inline void
922ntmsm64l(const char* kmer_seq,
923 const std::vector<SpacedSeedBlocks>& seeds_blocks,
924 const std::vector<SpacedSeedMonomers>& seeds_monomers,
925 unsigned k,
926 unsigned m,
927 unsigned m2,
928 uint64_t* fh_nomonos,
929 uint64_t* rh_nomonos,
930 uint64_t* fh_val,
931 uint64_t* rh_val,
932 uint64_t* h_val)
933{
934 NTMSM64(fh_seed = fh_nomonos[i_seed]; rh_seed = srol(rh_nomonos[i_seed]);
935 , i_in = block[0];
936 char_in = (unsigned char)kmer_seq[i_in];
937 , i_out = block[1];
938 char_out = (unsigned char)kmer_seq[i_out];
939 , fh_seed = sror(fh_seed);)
940}
941
963inline void
964ntmsm64(const char* kmer_seq,
965 char in,
966 const std::vector<SpacedSeedBlocks>& seeds_blocks,
967 const std::vector<SpacedSeedMonomers>& seeds_monomers,
968 unsigned k,
969 unsigned m,
970 unsigned m2,
971 uint64_t* fh_nomonos,
972 uint64_t* rh_nomonos,
973 uint64_t* fh_val,
974 uint64_t* rh_val,
975 uint64_t* h_val)
976{
977 NTMSM64(
978 fh_seed = srol(fh_nomonos[i_seed]); rh_seed = rh_nomonos[i_seed];
979 , i_in = block[1];
980 if (i_in > k - 1) { char_in = in; } else {
981 char_in = (unsigned char)kmer_seq[i_in];
982 },
983 i_out = block[0];
984 char_out = (unsigned char)kmer_seq[i_out];
985 , rh_seed = sror(rh_seed);)
986}
987
1009inline void
1010ntmsm64l(const char* kmer_seq,
1011 char in,
1012 const std::vector<SpacedSeedBlocks>& seeds_blocks,
1013 const std::vector<SpacedSeedMonomers>& seeds_monomers,
1014 unsigned k,
1015 unsigned m,
1016 unsigned m2,
1017 uint64_t* fh_nomonos,
1018 uint64_t* rh_nomonos,
1019 uint64_t* fh_val,
1020 uint64_t* rh_val,
1021 uint64_t* h_val)
1022{
1023 NTMSM64(
1024 fh_seed = fh_nomonos[i_seed]; rh_seed = srol(rh_nomonos[i_seed]);
1025 , i_in = block[0];
1026 if (i_in > k - 1) { char_in = in; } else {
1027 char_in = (unsigned char)kmer_seq[i_in];
1028 },
1029 i_out = block[1];
1030 char_out = (unsigned char)kmer_seq[i_out];
1031 , fh_seed = sror(fh_seed);)
1032}
1033
1034} // namespace btllib
1035
1036#endif
btllib
Definition aahash.hpp:15
btllib::ntf64l
uint64_t ntf64l(uint64_t rh_val, unsigned k, unsigned char char_out, unsigned char char_in)
Definition nthash_lowlevel.hpp:292
btllib::sub_hash
void sub_hash(uint64_t fh_val, uint64_t rh_val, const char *kmer_seq, const std::vector< unsigned > &positions, const std::vector< unsigned char > &new_bases, unsigned k, unsigned m, uint64_t *h_val)
Definition nthash_lowlevel.hpp:728
btllib::ntr64l
uint64_t ntr64l(uint64_t fh_val, unsigned k, unsigned char char_out, unsigned char char_in)
Definition nthash_lowlevel.hpp:314
btllib::srol
uint64_t srol(const uint64_t x)
Definition nthash_lowlevel.hpp:54
btllib::mask_hash
uint64_t mask_hash(uint64_t &fk_val, uint64_t &rk_val, const char *seed_seq, const char *kmer_seq, unsigned k)
Definition nthash_lowlevel.hpp:697
btllib::ntc64l
uint64_t ntc64l(unsigned char char_out, unsigned char char_in, unsigned k, uint64_t &fh_val, uint64_t &rh_val)
Definition nthash_lowlevel.hpp:338
btllib::sror
uint64_t sror(const uint64_t x)
Definition nthash_lowlevel.hpp:88
btllib::ntc64
uint64_t ntc64(const char *kmer_seq, unsigned k)
Definition nthash_lowlevel.hpp:231
btllib::ntr64
uint64_t ntr64(const char *kmer_seq, unsigned k)
Definition nthash_lowlevel.hpp:144
btllib::nte64
void nte64(uint64_t bh_val, unsigned k, unsigned h, uint64_t *h_val)
Definition nthash_lowlevel.hpp:358
btllib::ntf64
uint64_t ntf64(const char *kmer_seq, unsigned k)
Definition nthash_lowlevel.hpp:103