-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use RowDiff with DBGHashFast in test_aligner_labeled #505
Open
adamant-pwn
wants to merge
22
commits into
rowdiff
Choose a base branch
from
rowdiff-2
base: rowdiff
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
740691b
Update download-artifact
adamant-pwn 4f7b681
Touch commit for workflows
adamant-pwn cebb02c
Update upload-artifact to @v4
adamant-pwn f2f320f
Own artifact name for _noAVX
adamant-pwn 5af4aca
Fix for queries with invalid characters (#502)
hmusta 70fb7ff
user-selectable error k-mer percentile (#506)
hmusta fd3a981
Fix typo in help menu
hmusta 9ed4bfd
Use RowDiff with DBGHashFast
adamant-pwn 275149e
Fix unit test and compilation errors
adamant-pwn 40cb43e
vla-cxx-extension -> vla-extension (older versions don't support it)
adamant-pwn 0767479
Add GDB debugging to integration test + fix
adamant-pwn 6c89455
Update
adamant-pwn fac4222
Update
adamant-pwn 29ded0f
Throw on invalid final state
adamant-pwn aa8b9fb
Distinguish dummy nodes and nodes with zero outdegree
adamant-pwn 2d1379e
Fixes
adamant-pwn 2bfaa47
Apply review suggestions
adamant-pwn 090a969
fix
hmusta b9f4da0
Merge remote-tracking branch 'origin/master' into rowdiff-2
hmusta c808190
Multithreaded get_last
hmusta c13196f
Update row_diff_builder.cpp
hmusta e706240
Update row_diff_builder.cpp
hmusta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,27 @@ | |
|
||
namespace mtg { | ||
namespace annot { | ||
|
||
using node_index = graph::DeBruijnGraph::node_index; | ||
|
||
node_index row_diff_successor(const graph::DeBruijnGraph &graph, | ||
node_index node, | ||
const bit_vector &rd_succ) { | ||
if (auto* dbg_succ = dynamic_cast<graph::DBGSuccinct const*>(&graph)) { | ||
return dbg_succ->get_boss().row_diff_successor(node, rd_succ); | ||
} else { | ||
node_index succ = graph::DeBruijnGraph::npos; | ||
graph.adjacent_outgoing_nodes(node, [&](node_index adjacent_node) { | ||
if (rd_succ[adjacent_node]) { | ||
succ = adjacent_node; | ||
} | ||
}); | ||
assert(graph.in_graph(succ) && "a row diff successor must exist"); | ||
return succ; | ||
} | ||
} | ||
|
||
|
||
namespace matrix { | ||
|
||
void IRowDiff::load_anchor(const std::string &filename) { | ||
|
@@ -41,7 +62,7 @@ void IRowDiff::load_fork_succ(const std::string &filename) { | |
std::tuple<std::vector<BinaryMatrix::Row>, std::vector<std::vector<size_t>>, std::vector<size_t>> | ||
IRowDiff::get_rd_ids(const std::vector<BinaryMatrix::Row> &row_ids) const { | ||
assert(graph_ && "graph must be loaded"); | ||
assert(!fork_succ_.size() || fork_succ_.size() == graph_->get_boss().get_last().size()); | ||
assert(!fork_succ_.size() || fork_succ_.size() == graph_->max_index() + 1); | ||
|
||
using Row = BinaryMatrix::Row; | ||
|
||
|
@@ -54,34 +75,36 @@ IRowDiff::get_rd_ids(const std::vector<BinaryMatrix::Row> &row_ids) const { | |
// been reached before, and thus, will be reconstructed before this one. | ||
std::vector<std::vector<size_t>> rd_paths_trunc(row_ids.size()); | ||
|
||
const graph::boss::BOSS &boss = graph_->get_boss(); | ||
const bit_vector &rd_succ = fork_succ_.size() ? fork_succ_ : boss.get_last(); | ||
|
||
for (size_t i = 0; i < row_ids.size(); ++i) { | ||
Row row = row_ids[i]; | ||
|
||
graph::boss::BOSS::edge_index boss_edge = | ||
graph::AnnotatedSequenceGraph::anno_to_graph_index(row); | ||
node_index node = graph::AnnotatedSequenceGraph::anno_to_graph_index(row); | ||
|
||
while (true) { | ||
if (graph_->is_valid(boss_edge)) { | ||
row = graph::AnnotatedSequenceGraph::graph_to_anno_index(boss_edge); | ||
|
||
auto [it, is_new] = node_to_rd.try_emplace(row, node_to_rd.size()); | ||
rd_paths_trunc[i].push_back(it.value()); | ||
|
||
// If a node had been reached before, we interrupt the diff path. | ||
// The annotation for that node will have been reconstructed earlier | ||
// than for other nodes in this path as well. Thus, we will start | ||
// reconstruction from that node and don't need its successors. | ||
if (!is_new) | ||
break; | ||
|
||
if (anchor_[row]) | ||
break; | ||
assert(graph_->in_graph(node)); | ||
row = graph::AnnotatedSequenceGraph::graph_to_anno_index(node); | ||
|
||
auto [it, is_new] = node_to_rd.try_emplace(row, node_to_rd.size()); | ||
rd_paths_trunc[i].push_back(it.value()); | ||
|
||
// If a node had been reached before, we interrupt the diff path. | ||
// The annotation for that node will have been reconstructed earlier | ||
// than for other nodes in this path as well. Thus, we will start | ||
// reconstruction from that node and don't need its successors. | ||
if (!is_new) | ||
break; | ||
|
||
if (anchor_[row]) | ||
break; | ||
|
||
if (fork_succ_.size()) { | ||
node = row_diff_successor(*graph_, node, fork_succ_); | ||
} else { // Only happens in DBGSuccinct | ||
auto *dbg_succ = dynamic_cast<graph::DBGSuccinct const*>(graph_); | ||
assert(dbg_succ); | ||
node = row_diff_successor(*graph_, node, dbg_succ->get_boss().get_last()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be problematic to, instead of doing this, assign |
||
} | ||
|
||
boss_edge = boss.row_diff_successor(boss_edge, rd_succ); | ||
|
||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This number decreases if
valid_edges
is generated and serialized for DBGSuccinct. Probably because dummy nodes are excluded this way. Same with the change above.