75 my_counts(barcode_pool.size()),
76 my_use_first(options.use_first)
85 State(
typename SimpleSingleMatch<max_size_>::State s,
typename std::vector<Count>::size_type nvar) : search(std::move(s)), counts(nvar) {}
87 typename SimpleSingleMatch<max_size_>::State search;
88 std::vector<Count> counts;
92 void process(State& state,
const std::pair<const char*, const char*>& r1,
const std::pair<const char*, const char*>& r2)
const {
94 if (my_matcher.search_first(r1.first, r1.second - r1.first, state.search)) {
95 ++state.counts[state.search.index];
96 }
else if (my_matcher.search_first(r2.first, r2.second - r2.first, state.search)) {
97 ++state.counts[state.search.index];
100 bool found1 = my_matcher.search_best(r1.first, r1.second - r1.first, state.search);
101 auto id1 = state.search.index;
102 auto mm1 = state.search.mismatches;
104 bool found2 = my_matcher.search_best(r2.first, r2.second - r2.first, state.search);
105 auto id2 = state.search.index;
106 auto mm2 = state.search.mismatches;
108 if (found1 && !found2) {
110 }
else if (!found1 && found2) {
112 }
else if (found1 && found2) {
115 }
else if (mm1 > mm2) {
117 }
else if (id1 == id2) {
125 static constexpr bool use_names =
false;
134 State initialize()
const {
135 return State(my_matcher.initialize(), my_counts.size());
138 void reduce(State& s) {
139 my_matcher.reduce(s.search);
140 for (
decltype(my_counts.size()) i = 0, end = my_counts.size(); i < end; ++i) {
141 my_counts[i] += s.counts[i];
150 SimpleSingleMatch<max_size_> my_matcher;
151 std::vector<Count> my_counts;
153 bool my_use_first =
true;
SingleBarcodePairedEnd(const char *template_seq, SeqLength template_length, const BarcodePool &barcode_pool, const Options &options)
Definition SingleBarcodePairedEnd.hpp:62