Skip to content

Commit

Permalink
renamed AnnotatedSequenceGraph::get_labels to get_stored_labels
Browse files Browse the repository at this point in the history
  • Loading branch information
hmusta committed Oct 11, 2024
1 parent a7a5741 commit a0ca81d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion metagraph/src/graph/annotated_dbg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ AnnotatedDBG::get_labels(const std::vector<std::pair<row_index, size_t>> &index_
}

std::vector<Label>
AnnotatedSequenceGraph::get_labels(node_index index) const {
AnnotatedSequenceGraph::get_stored_labels(node_index index) const {
assert(check_compatibility());
assert(index != SequenceGraph::npos);

Expand Down
7 changes: 5 additions & 2 deletions metagraph/src/graph/annotated_dbg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ class AnnotatedSequenceGraph {

virtual ~AnnotatedSequenceGraph() {}

virtual std::vector<Label> get_labels(node_index index) const;
// Return the labels explicitly stored at this node. Some annotation schemes
// may not store labels at all nodes
// (e.g., canonical-mode graphs only annotate canonical k-mers)
virtual std::vector<Label> get_stored_labels(node_index index) const;

// thread-safe, can be called from multiple threads concurrently
virtual void annotate_sequence(std::string_view sequence,
Expand Down Expand Up @@ -72,7 +75,7 @@ class AnnotatedDBG : public AnnotatedSequenceGraph {
std::unique_ptr<Annotator>&& annotation,
bool force_fast = false);

using AnnotatedSequenceGraph::get_labels;
using AnnotatedSequenceGraph::get_stored_labels;

const DeBruijnGraph& get_graph() const { return dbg_; }

Expand Down
4 changes: 2 additions & 2 deletions metagraph/tests/annotation/test_annotated_dbg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void check_labels(const AnnotatedDBG &anno_graph,
call_annotated_nodes_offsets(graph, sequence, [&](auto index, int64_t) {
ASSERT_NE(SequenceGraph::npos, index);
indices.insert(index);
auto cur_labels = anno_graph.get_labels(index);
auto cur_labels = anno_graph.get_stored_labels(index);
EXPECT_EQ(labels_present.size(), cur_labels.size());
EXPECT_EQ(convert_to_set(labels_present), convert_to_set(cur_labels));

Expand All @@ -46,7 +46,7 @@ void check_labels(const AnnotatedDBG &anno_graph,
convert_to_set(cur_labels));

for (DeBruijnGraph::node_index node = contig_id + 1; node <= last_node; ++node) {
EXPECT_TRUE(anno_graph.get_labels(node).empty());
EXPECT_TRUE(anno_graph.get_stored_labels(node).empty());
}
}
});
Expand Down

0 comments on commit a0ca81d

Please sign in to comment.