@@ -210,20 +210,20 @@ void set_score(GaplessExtension& extension, const Aligner* aligner) {
210210
211211// Match the initial node, assuming that read_offset or node_offset is 0.
212212// Updates internal_score and old_score; use set_score() to compute score.
213- void match_initial (GaplessExtension& match, const std::string& seq, gbwtgraph::view_type target) {
213+ void match_initial (GaplessExtension& match, const std::string& seq, std::string_view target) {
214214 size_t node_offset = match.offset ;
215- size_t left = std::min (seq.length () - match.read_interval .second , target.second - node_offset);
215+ size_t left = std::min (seq.length () - match.read_interval .second , target.size () - node_offset);
216216 while (left > 0 ) {
217217 size_t len = std::min (left, sizeof (std::uint64_t ));
218218 std::uint64_t a = 0 , b = 0 ;
219219 std::memcpy (&a, seq.data () + match.read_interval .second , len);
220- std::memcpy (&b, target.first + node_offset, len);
220+ std::memcpy (&b, target.data () + node_offset, len);
221221 if (a == b) {
222222 match.read_interval .second += len;
223223 node_offset += len;
224224 } else {
225225 for (size_t i = 0 ; i < len; i++) {
226- if (seq[match.read_interval .second ] != target. first [node_offset]) {
226+ if (seq[match.read_interval .second ] != target[node_offset]) {
227227 match.internal_score ++;
228228 }
229229 match.read_interval .second ++;
@@ -238,20 +238,20 @@ void match_initial(GaplessExtension& match, const std::string& seq, gbwtgraph::v
238238// Match forward but stop before the mismatch count reaches the limit.
239239// Updates internal_score; use set_score() to recompute score.
240240// Returns the tail offset (the number of characters matched).
241- size_t match_forward (GaplessExtension& match, const std::string& seq, gbwtgraph::view_type target, uint32_t mismatch_limit) {
241+ size_t match_forward (GaplessExtension& match, const std::string& seq, std::string_view target, uint32_t mismatch_limit) {
242242 size_t node_offset = 0 ;
243- size_t left = std::min (seq.length () - match.read_interval .second , target.second - node_offset);
243+ size_t left = std::min (seq.length () - match.read_interval .second , target.size () - node_offset);
244244 while (left > 0 ) {
245245 size_t len = std::min (left, sizeof (std::uint64_t ));
246246 std::uint64_t a = 0 , b = 0 ;
247247 std::memcpy (&a, seq.data () + match.read_interval .second , len);
248- std::memcpy (&b, target.first + node_offset, len);
248+ std::memcpy (&b, target.data () + node_offset, len);
249249 if (a == b) {
250250 match.read_interval .second += len;
251251 node_offset += len;
252252 } else {
253253 for (size_t i = 0 ; i < len; i++) {
254- if (seq[match.read_interval .second ] != target. first [node_offset]) {
254+ if (seq[match.read_interval .second ] != target[node_offset]) {
255255 if (match.internal_score + 1 >= mismatch_limit) {
256256 return node_offset;
257257 }
@@ -269,19 +269,19 @@ size_t match_forward(GaplessExtension& match, const std::string& seq, gbwtgraph:
269269// Match forward but stop before the mismatch count reaches the limit.
270270// Starts from the offset in the match and updates it.
271271// Updates internal_score; use set_score() to recompute score.
272- void match_backward (GaplessExtension& match, const std::string& seq, gbwtgraph::view_type target, uint32_t mismatch_limit) {
272+ void match_backward (GaplessExtension& match, const std::string& seq, std::string_view target, uint32_t mismatch_limit) {
273273 size_t left = std::min (match.read_interval .first , match.offset );
274274 while (left > 0 ) {
275275 size_t len = std::min (left, sizeof (std::uint64_t ));
276276 std::uint64_t a = 0 , b = 0 ;
277277 std::memcpy (&a, seq.data () + match.read_interval .first - len, len);
278- std::memcpy (&b, target.first + match.offset - len, len);
278+ std::memcpy (&b, target.data () + match.offset - len, len);
279279 if (a == b) {
280280 match.read_interval .first -= len;
281281 match.offset -= len;
282282 } else {
283283 for (size_t i = 0 ; i < len; i++) {
284- if (seq[match.read_interval .first - 1 ] != target. first [match.offset - 1 ]) {
284+ if (seq[match.read_interval .first - 1 ] != target[match.offset - 1 ]) {
285285 if (match.internal_score + 1 >= mismatch_limit) {
286286 return ;
287287 }
@@ -373,9 +373,9 @@ void find_mismatches(const std::string& seq, const gbwtgraph::CachedGBWTGraph& g
373373 extension.mismatch_positions .reserve (extension.internal_score );
374374 size_t node_offset = extension.offset , read_offset = extension.read_interval .first ;
375375 for (const handle_t & handle : extension.path ) {
376- gbwtgraph::view_type target = graph.get_sequence_view (handle);
377- while (node_offset < target.second && read_offset < extension.read_interval .second ) {
378- if (target. first [node_offset] != seq[read_offset]) {
376+ std::string_view target = graph.get_sequence_view (handle);
377+ while (node_offset < target.size () && read_offset < extension.read_interval .second ) {
378+ if (target[node_offset] != seq[read_offset]) {
379379 extension.mismatch_positions .push_back (read_offset);
380380 }
381381 node_offset++;
@@ -1546,10 +1546,10 @@ struct WFANode {
15461546 bool append_node (const gbwtgraph::CachedGBWTGraph& graph, gbwt::SearchState next, pos_t target) {
15471547 this ->state = next;
15481548 this ->path .push_back (this ->state .node );
1549- gbwtgraph::view_type view = graph.get_sequence_view (gbwtgraph::GBWTGraph::node_to_handle (this ->state .node ));
1550- this ->node_sequence .append (view.first , view.second );
1549+ std::string_view view = graph.get_sequence_view (gbwtgraph::GBWTGraph::node_to_handle (this ->state .node ));
1550+ this ->node_sequence .append (view.data () , view.size () );
15511551 if (gbwt::Node::encode (id (target), is_rev (target)) == this ->state .node ) {
1552- this ->target_offset = this ->node_sequence .length () - (view.second - offset (target));
1552+ this ->target_offset = this ->node_sequence .length () - (view.size () - offset (target));
15531553 return true ;
15541554 }
15551555 return false ;
0 commit comments