67typedef unsigned long long Count;
73 return x == SearchStrand::FORWARD || x == SearchStrand::BOTH;
77 return x == SearchStrand::REVERSE || x == SearchStrand::BOTH;
80template<
bool allow_n_ = false,
bool allow_iupac_ = false>
81char complement_base(
char b) {
98 if constexpr(allow_n_ || allow_iupac_) {
104 if constexpr(allow_iupac_) {
109 if constexpr(allow_iupac_) {
114 if constexpr(allow_iupac_) {
119 if constexpr(allow_iupac_) {
124 if constexpr(allow_iupac_) {
129 if constexpr(allow_iupac_) {
135 if constexpr(allow_iupac_) {
140 if constexpr(allow_iupac_) {
145 if constexpr(allow_iupac_) {
150 if constexpr(allow_iupac_) {
156 throw std::runtime_error(
"cannot complement unknown base '" + std::string(1, b) +
"'");
161inline bool is_standard_base(
char b) {
175void shift_hash(std::bitset<N>& x) {
180void add_base_to_hash(std::bitset<N>& x,
char b) {
196 throw std::runtime_error(
"unknown base '" + std::string(1, b) +
"'");
203void add_other_to_hash(std::bitset<N>& x) {
212inline constexpr int NUM_BASES = 4;
216inline std::size_t hash_combine(std::size_t seed, std::size_t other) {
242 static constexpr auto digits = std::numeric_limits<std::size_t>::digits;
244 if constexpr(digits == 64) {
246 size_t x = seed + 0x9e3779b9 + other;
247 const std::size_t m = 0xe9846af9b1a615d;
255 }
else if constexpr(digits == 32) {
257 std::size_t x = seed + 0x9e3779b9 + other;
258 const std::size_t m1 = 0x21f0aaad;
259 const std::size_t m2 = 0x735a2d97;
270 return seed ^ (0x9e3779b9 + other + (seed << 6) + (seed >> 2));
285template<
int num_variable_>
292 std::size_t
operator()(
const std::array<BarcodeIndex, num_variable_>& key)
const {
293 std::size_t seed = 0;
294 for (
int v = 0; v < num_variable_; ++v) {
295 seed = hash_combine(seed, key[v]);
Hash a combination of barcode indices.
Definition utils.hpp:286
std::size_t operator()(const std::array< BarcodeIndex, num_variable_ > &key) const
Definition utils.hpp:292
Namespace for the kaori barcode-matching library.
Definition BarcodePool.hpp:16
std::size_t SeqLength
Definition utils.hpp:37
constexpr BarcodeIndex STATUS_AMBIGUOUS
Definition utils.hpp:53
SearchStrand
Definition utils.hpp:31
constexpr BarcodeIndex STATUS_UNMATCHED
Definition utils.hpp:48
DuplicateAction
Definition utils.hpp:26
bool is_barcode_index_ok(BarcodeIndex index)
Definition utils.hpp:60
std::vector< constchar * >::size_type BarcodeIndex
Definition utils.hpp:43
unsigned long long Count
Definition utils.hpp:67