Skip to content

Commit 6dbaa5b

Browse files
committed
Merge remote-tracking branch 'origin/master' into altpaths
2 parents 78b699f + b676ef8 commit 6dbaa5b

17 files changed

Lines changed: 111 additions & 106 deletions

.github/workflows/testmac.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ jobs:
6161
brew update && \
6262
brew install protobuf && \
6363
brew install libomp && \
64+
brew install bwa graphviz && \
6465
npm install -g [email protected] && \
6566
brew config && \
6667
(brew doctor || echo "brew doctor is unhappy")

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ test/.*
2323
test/*.lcp
2424
test/*/*.lcp
2525
test/**/*.index/
26+
test/wiki-data/mock-hs37d5/graphs/
27+
test/wiki-data/mock-hs37d5/indexes/
28+
test/wiki-data/mock-hs37d5/logs/
2629
trash
2730
src/*.gch
2831
.vscode

.gitlab-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ before_script:
1515
- sudo apt-get -q -y update
1616
# Make sure we have some curl stuff for pycurl which we need for some Python stuff
1717
# And the CI report upload needs uuidgen from uuid-runtime
18-
- sudo apt-get -q -y install --no-upgrade docker.io python3-pip python3-virtualenv libcurl4-gnutls-dev python-dev-is-python3 npm nodejs node-gyp uuid-runtime libgnutls28-dev doxygen libzstd-dev bcftools
18+
- sudo apt-get -q -y install --no-upgrade docker.io python3-pip python3-virtualenv libcurl4-gnutls-dev python-dev-is-python3 npm nodejs node-gyp uuid-runtime libgnutls28-dev doxygen libzstd-dev bcftools bwa graphviz
1919
- which junit-merge || sudo npm install -g junit-merge
2020
# Configure Docker to use a mirror for Docker Hub and restart the daemon
2121
- |
@@ -85,7 +85,7 @@ local-build-test-job:
8585
- obj/
8686
before_script:
8787
- sudo apt-get -q -y update
88-
- sudo apt-get install -y gcc-${COMPILER_VERSION} g++-${COMPILER_VERSION}
88+
- sudo apt-get install -y gcc-${COMPILER_VERSION} g++-${COMPILER_VERSION} bwa graphviz
8989
- sudo rm -f /usr/bin/gcc && sudo ln -s /usr/bin/gcc-${COMPILER_VERSION} /usr/bin/gcc
9090
- sudo rm -f /usr/bin/g++ && sudo ln -s /usr/bin/g++-${COMPILER_VERSION} /usr/bin/g++
9191
# We need to make sure we get the right submodule files for this version

doc/wiki

Submodule wiki updated from 3d3c56f to 47c537c

src/gbwt_extender.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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;

src/index_registry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4011,7 +4011,7 @@ IndexRegistry VGIndexes::get_vg_index_registry() {
40114011

40124012
// jointly generate the GBWT and record sequences
40134013
unique_ptr<gbwt::GBWT> gbwt_index;
4014-
unique_ptr<gbwtgraph::SequenceSource> seq_source;
4014+
unique_ptr<gbwtgraph::NaiveGraph> seq_source;
40154015
tie(gbwt_index, seq_source) = gbwtgraph::gfa_to_gbwt(gfa_filename, params);
40164016

40174017
// convert sequences into GBZ and save

src/primer_filter.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,9 @@ static string get_haplotype_sequence(gbwt::size_type sequence_visit_offset, hand
242242
if (curr == end_handle) {
243243
return haplotype;
244244
}
245-
gbwtgraph::view_type view = gbwt_graph.get_sequence_view(curr);
246-
size_t offset = (view.second > start_max ? view.second - start_max : 0);
247-
haplotype.append(view.first + offset, view.second - offset);
245+
std::string_view view = gbwt_graph.get_sequence_view(curr);
246+
size_t offset = (view.size() > start_max ? view.size() - start_max : 0);
247+
haplotype.append(view.data() + offset, view.size() - offset);
248248

249249
while (true) {
250250
pos = gbwt_graph.index->LF(pos);
@@ -254,10 +254,10 @@ static string get_haplotype_sequence(gbwt::size_type sequence_visit_offset, hand
254254
curr = gbwtgraph::GBWTGraph::node_to_handle(pos.first);
255255
view = gbwt_graph.get_sequence_view(curr);
256256
if (curr == end_handle) {
257-
haplotype.append(view.first, std::min(view.second, end_max));
257+
haplotype.append(view.data(), std::min(view.size(), end_max));
258258
break;
259259
} else {
260-
haplotype.append(view.first, view.second);
260+
haplotype.append(view.data(), view.size());
261261
}
262262
}
263263
return haplotype;

src/recombinator.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -921,10 +921,10 @@ std::vector<std::string> generate_haplotype(
921921
if (curr == end) {
922922
return haplotype;
923923
}
924-
gbwtgraph::view_type view = partitioner.gbz.graph.get_sequence_view(curr);
925-
size_t offset = (view.second > start_max ? view.second - start_max : 0);
924+
std::string_view view = partitioner.gbz.graph.get_sequence_view(curr);
925+
size_t offset = (view.size() > start_max ? view.size() - start_max : 0);
926926
haplotype.emplace_back();
927-
haplotype.back().append(view.first + offset, view.second - offset);
927+
haplotype.back().append(view.data() + offset, view.size() - offset);
928928

929929
while (true) {
930930
pos = partitioner.gbz.index.LF(pos);
@@ -948,10 +948,10 @@ std::vector<std::string> generate_haplotype(
948948
curr = gbwtgraph::GBWTGraph::node_to_handle(pos.first);
949949
view = partitioner.gbz.graph.get_sequence_view(curr);
950950
if (curr == end) {
951-
haplotype.back().append(view.first, std::min(view.second, end_max));
951+
haplotype.back().append(view.data(), std::min(view.size(), end_max));
952952
break;
953953
} else {
954-
haplotype.back().append(view.first, view.second);
954+
haplotype.back().append(view.data(), view.size());
955955
}
956956
}
957957

0 commit comments

Comments
 (0)