26enum class DuplicateAction :
char { FIRST, LAST, NONE, ERROR };
31enum class SearchStrand :
char { FORWARD, REVERSE, BOTH };
37typedef std::size_t SeqLength;
43typedef typename std::vector<const char*>::size_type BarcodeIndex;
48inline constexpr BarcodeIndex STATUS_UNMATCHED =
static_cast<BarcodeIndex
>(-1);
53inline constexpr BarcodeIndex STATUS_AMBIGUOUS =
static_cast<BarcodeIndex
>(-2);
60inline bool is_barcode_index_ok(BarcodeIndex index) {
61 return index < STATUS_AMBIGUOUS;
67typedef unsigned long long Count;
72inline bool search_forward(SearchStrand x) {
73 return x == SearchStrand::FORWARD || x == SearchStrand::BOTH;
76inline bool search_reverse(SearchStrand x) {
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;
222template<
int num_variable_>
223class CombinationHash {
229 std::size_t operator()(
const std::array<BarcodeIndex, num_variable_>& key)
const {
230 unsigned long long seed = 0;
232 for (
int v = 0; v < num_variable_; ++v) {
237 unsigned long long x = seed + 0x9e3779b9 + key[v];
238 constexpr unsigned long long m = 0xe9846af9b1a615d;
Namespace for the kaori barcode-matching library.
Definition BarcodePool.hpp:16