58 my_length(template_length),
59 my_forward(search_forward(strand)),
60 my_reverse(search_reverse(strand))
62 if (my_length > max_size_) {
63 throw std::runtime_error(
"maximum template size should be " + std::to_string(max_size_) +
" bp");
67 for (
SeqLength i = 0; i < my_length; ++i) {
68 char b = template_seq[i];
70 add_base_to_hash(my_forward_ref, b);
71 add_mask_to_hash(my_forward_mask);
72 my_forward_mask_ambiguous.set(i);
74 shift_hash(my_forward_ref);
75 shift_hash(my_forward_mask);
76 add_variable_base(my_forward_variables, i);
81 for (
SeqLength i = 0; i < my_length; ++i) {
82 char b = template_seq[i];
84 add_variable_base(my_forward_variables, i);
90 for (
SeqLength i = 0; i < my_length; ++i) {
91 char b = template_seq[my_length - i - 1];
93 add_base_to_hash(my_reverse_ref, complement_base(b));
94 add_mask_to_hash(my_reverse_mask);
95 my_reverse_mask_ambiguous.set(i);
97 shift_hash(my_reverse_ref);
98 shift_hash(my_reverse_mask);
99 add_variable_base(my_reverse_variables, i);
162 out.len = read_length;
164 if (my_length <= read_length) {
165 for (
SeqLength i = 0; i < my_length - 1; ++i) {
166 char base = read_seq[i];
168 if (is_standard_base(base)) {
169 add_base_to_hash(out.state, base);
171 if (out.any_ambiguous) {
175 add_other_to_hash(out.state);
177 if (out.any_ambiguous) {
180 out.any_ambiguous =
true;
182 out.ambiguous.set(0);
183 out.last_ambiguous = i;
203 char base = state.seq[right];
205 if (is_standard_base(base)) {
206 add_base_to_hash(state.state, base);
207 if (state.any_ambiguous) {
208 state.ambiguous <<= 1;
213 if (state.last_ambiguous == state.
position) {
214 state.any_ambiguous =
false;
219 add_other_to_hash(state.state);
221 if (state.any_ambiguous) {
222 state.ambiguous <<= 1;
224 state.any_ambiguous =
true;
226 state.ambiguous.set(0);
227 state.last_ambiguous = right;
232 if (right + 1 == state.len) {
275 match.forward_mismatches = strand_match(match, my_forward_ref, my_forward_mask, my_forward_mask_ambiguous);
278 match.reverse_mismatches = strand_match(match, my_reverse_ref, my_reverse_mask, my_reverse_mask_ambiguous);