1#ifndef KAORI_SINGLE_BARCODE_SINGLE_END_HPP
2#define KAORI_SINGLE_BARCODE_SINGLE_END_HPP
4#include "../SimpleSingleMatch.hpp"
24template<
size_t max_size>
45 SearchStrand
strand = SearchStrand::FORWARD;
75 counts(barcode_pool.size()),
76 use_first(options.use_first)
86 State(
typename SimpleSingleMatch<max_size>::State s,
size_t nvar) : search(std::move(s)), counts(nvar) {}
88 typename SimpleSingleMatch<max_size>::State search;
89 std::vector<int> counts;
93 void process(State& state,
const std::pair<const char*, const char*>& x)
const {
96 found = matcher.search_first(x.first, x.second - x.first, state.search);
98 found = matcher.search_best(x.first, x.second - x.first, state.search);
101 ++(state.counts[state.search.index]);
106 static constexpr bool use_names =
false;
115 State initialize()
const {
116 return State(matcher.initialize(), counts.size());
119 void reduce(State& s) {
120 matcher.reduce(s.search);
121 for (
size_t i = 0; i < counts.size(); ++i) {
122 counts[i] += s.counts[i];
131 SimpleSingleMatch<max_size> matcher;
132 std::vector<int> counts;
Handler for single-end single barcodes.
Definition SingleBarcodeSingleEnd.hpp:25
const std::vector< int > & get_counts() const
Definition SingleBarcodeSingleEnd.hpp:141
SingleBarcodeSingleEnd(const char *template_seq, size_t template_length, const BarcodePool &barcode_pool, const Options &options)
Definition SingleBarcodeSingleEnd.hpp:62
int get_total() const
Definition SingleBarcodeSingleEnd.hpp:148
Namespace for the kaori barcode-matching library.
Definition BarcodePool.hpp:13
Pool of barcode sequences for a variable region.
Definition BarcodePool.hpp:21
Optional parameters for SimpleSingleMatch.
Definition SimpleSingleMatch.hpp:36
SearchStrand strand
Definition SimpleSingleMatch.hpp:50
int max_mismatches
Definition SimpleSingleMatch.hpp:40
DuplicateAction duplicates
Definition SimpleSingleMatch.hpp:45
Optional parameters for SingleBarcodeSingleEnd.
Definition SingleBarcodeSingleEnd.hpp:30
bool use_first
Definition SingleBarcodeSingleEnd.hpp:40
DuplicateAction duplicates
Definition SingleBarcodeSingleEnd.hpp:50
SearchStrand strand
Definition SingleBarcodeSingleEnd.hpp:45
int max_mismatches
Definition SingleBarcodeSingleEnd.hpp:34