Skip to content
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

Using SSHash submodule for graph representation #481

Merged
merged 130 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from 128 commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
bf6911c
Fix CI failures for MacOS
adamant-pwn May 2, 2024
a412023
update simde-no-tests
adamant-pwn May 2, 2024
2e70949
Switch to latest compiling simde-no-tests
adamant-pwn May 22, 2024
033bff0
replace restrict_to_mask_epi64 with fully scalar verison
hmusta May 23, 2024
27f2ce1
Update CMakeLists.txt
hmusta May 23, 2024
dce107e
Initial DBGSSHash commit
adamant-pwn Nov 6, 2023
9a68837
Use SSHash submodule instead of PTHash
adamant-pwn Nov 8, 2023
e49815f
trying to use sshash as a submodule
mmarzett Nov 23, 2023
d934254
fixed index conversion between ssh and metagraph
mmarzett Nov 30, 2023
3afa7f2
some changes to sshash, first try at avoiding the compile error in ss…
hmusta Dec 6, 2023
6ce2c71
changes for unit_test usage
mmarzett Dec 7, 2023
5f5eccf
new sshash version
mmarzett Dec 7, 2023
d54f216
ignore strict aliasing warning
mmarzett Jan 11, 2024
2071688
using sshash from cli
mmarzett Jan 11, 2024
381927a
general path
mmarzett Jan 11, 2024
d724d20
fixed serialization and loading
mmarzett Jan 18, 2024
76f8a72
no longer need k.txt file + clean-up
mmarzett Jan 23, 2024
4dca728
disabled tests that are incompatible with sshash
mmarzett Jan 23, 2024
f6909bb
fixes
hmusta Mar 21, 2024
c53b284
Update metagraph/src/graph/representation/hash/dbg_sshash.cpp
hmusta Mar 21, 2024
6d46cf4
update sshash
hmusta Mar 21, 2024
f069278
fix
hmusta Mar 21, 2024
9706fe9
gitignore
hmusta Mar 21, 2024
d46a5c2
comments
hmusta Mar 21, 2024
051e088
fix
hmusta Mar 21, 2024
8cd6483
fixes
hmusta Mar 21, 2024
dd6b90f
remove temp files
hmusta Mar 21, 2024
61dee1e
cleanup
hmusta Mar 21, 2024
d0ce00f
make sshash a system include
hmusta Mar 21, 2024
116ae9f
for now, disable empty graph tests for SSHash
hmusta Mar 21, 2024
1c7f829
no more unique_ptr
hmusta Mar 21, 2024
f668f18
remove redundant implementations
hmusta Mar 21, 2024
a1f067e
cleanup
hmusta Mar 21, 2024
37be4d6
use our impl of sshash, slight refactor
adamant-pwn Mar 27, 2024
f7b7e13
apply clang-format to dbg_sshash
adamant-pwn Mar 27, 2024
2f723d6
fix compile errors in sshash
adamant-pwn Mar 27, 2024
8b56e29
try to fix std::array compile error
adamant-pwn Mar 27, 2024
8703532
add sshash_sequences empty folder to git for CI
adamant-pwn Mar 27, 2024
8c2e1d1
wrap string_view, fix traverse_back bug
adamant-pwn Mar 28, 2024
eae57a2
true skip for NonASCII SSHash
adamant-pwn Mar 28, 2024
f6e7a7f
update sshash version
adamant-pwn Apr 16, 2024
24f0a09
use kmer.data() instead of string(kmer).c_str()
adamant-pwn Apr 16, 2024
707f7c2
pinpoint PuLP version for workflows
adamant-pwn Apr 17, 2024
a453980
serialize k and mode with the graph
hmusta May 23, 2024
4ec0d97
canonical tests for sshash
hmusta May 23, 2024
2c31e2c
Merge remote-tracking branch 'origin/master' into sshash_module
hmusta May 23, 2024
41954d6
remove data file
hmusta May 23, 2024
2bbcdd2
update sshash
hmusta May 27, 2024
fa49435
update sshash
hmusta May 28, 2024
7a8eb5f
pass mode even for empty graphs
hmusta May 28, 2024
db1fd2a
fixes for empty graphs
hmusta May 28, 2024
d0ecb99
update sshash
hmusta May 28, 2024
74b6032
more fixes
hmusta May 28, 2024
dca71e4
fix graph construction for tests
hmusta May 28, 2024
6463925
bug fix
hmusta May 28, 2024
ed592cb
silence sshash when not in verbose mode
hmusta May 28, 2024
4653999
fixes
hmusta May 29, 2024
9fddd66
fix traversal in canonical-mode sshash graphs
hmusta May 29, 2024
c23ea07
minor
hmusta May 29, 2024
8474dbd
naive implementation of DBGSSHash::operator==
hmusta May 29, 2024
f64cfb5
construct a DBGHashOrdered if DBGSSHash fails due to small input. ena…
hmusta May 29, 2024
09c57ce
enable one more test
hmusta May 29, 2024
3a3b5c8
revert some test changes
hmusta May 29, 2024
150576e
use default call_kmers
hmusta May 29, 2024
3a884e3
update sshash and allow for setting number of threads in build config
hmusta May 30, 2024
246af12
for now, don't use streamer
hmusta May 30, 2024
3a444f5
minor cleanup
hmusta May 30, 2024
0120fae
don't hard-code alphabet
hmusta May 30, 2024
add9fff
incomplete: protein k-mer support
hmusta May 30, 2024
b52810e
more progress
hmusta May 30, 2024
432d2f1
t
hmusta May 30, 2024
fee1bfd
update sshash
hmusta May 30, 2024
04e21f1
use aa_uint_kmer_t
hmusta May 30, 2024
df0d4b0
Update sshash
adamant-pwn May 30, 2024
9c9280c
Update sshash
adamant-pwn May 30, 2024
adc8391
Update sshash
adamant-pwn May 30, 2024
d493ded
Update sshash
adamant-pwn May 30, 2024
f1f1d7d
Update sshash
adamant-pwn May 30, 2024
b462786
Fix max_test_k for DBGSSHash
adamant-pwn May 30, 2024
e750cc7
update sshash
hmusta Jun 1, 2024
f25ee2d
work with larger word types
hmusta Jun 1, 2024
91fd0ae
fully reset the dictionary when loading
hmusta Jun 1, 2024
bb34cde
cleanup
hmusta Jun 1, 2024
0a53f23
k and m fixes
hmusta Jun 1, 2024
fd29250
Simplify traverse
hmusta Jun 2, 2024
c9a468c
header cleanup
hmusta Jun 3, 2024
afdabf5
Update metagraph/tests/graph/all/test_dbg_helpers.cpp
adamant-pwn Jun 6, 2024
81be5ab
Update metagraph/tests/graph/all/test_dbg_helpers.cpp
adamant-pwn Jun 6, 2024
34e21c1
Update metagraph/CMakeLists.txt
adamant-pwn Jun 6, 2024
5fbb4e7
Update metagraph/src/cli/build.cpp
adamant-pwn Jun 6, 2024
18038a1
Update metagraph/src/cli/build.cpp
adamant-pwn Jun 6, 2024
b5b5e6f
Update metagraph/src/cli/config/config.cpp
adamant-pwn Jun 6, 2024
e1b73aa
Merge remote-tracking branch 'origin/master' into sshash_module
hmusta Jun 19, 2024
f4ea65e
minor, addressed reviewer comments
hmusta Jun 19, 2024
e140590
minor
hmusta Jun 19, 2024
c666900
minor
hmusta Jun 19, 2024
99c74dc
clean
hmusta Jun 19, 2024
690ad30
correct error
hmusta Jun 19, 2024
95d31ee
fix
hmusta Jun 19, 2024
379e204
reviewer comment
hmusta Jun 19, 2024
141754f
use std::variant for dictionary
hmusta Jun 19, 2024
39aa7e2
code simplification
hmusta Jun 19, 2024
b263c87
reviewer comment
hmusta Jun 19, 2024
eae3e29
fix
hmusta Jun 19, 2024
0e171b8
move DeBruijnGraph::operator== to parent
hmusta Jun 19, 2024
05a181a
allow the number of chars to be specified beforehand
hmusta Jun 19, 2024
cb8e314
this doesn't link, fix it
hmusta Jun 19, 2024
07b4653
this works
hmusta Jun 20, 2024
c0a6906
minor
hmusta Jun 20, 2024
ae5c786
reviewer comment
hmusta Jun 20, 2024
a01e9b5
Revert "this works"
hmusta Jun 20, 2024
faeb485
corner case
hmusta Jun 20, 2024
25aaf02
minor
hmusta Jun 20, 2024
147edb4
added stop_early to call_kmers. replace bad_function_call throws with…
hmusta Jun 20, 2024
fe6a5d6
addressed reviewer comment
hmusta Jun 20, 2024
5d12145
minor
hmusta Jun 20, 2024
e0cb5d5
make sure to properly override
hmusta Jun 20, 2024
8e48e58
make load and serialize work for general istream and ostream
hmusta Jun 20, 2024
ff7d906
Add generic implementation of adjacent_*_nodes
hmusta Jun 20, 2024
45c9ae6
fix
hmusta Jun 20, 2024
72cfae2
update sshash
hmusta Jun 20, 2024
6c24e8e
num_nodes -> max_index, remove_const_ref -> decay_t
adamant-pwn Jun 20, 2024
1460c6b
Update sshash, use essentials generic visitors
adamant-pwn Jun 20, 2024
6bb3cb2
Update sshash
adamant-pwn Jul 1, 2024
abf27f6
Update htslib (#490) (#491)
adamant-pwn Jul 1, 2024
ef644e4
Install libdeflate on clang
adamant-pwn Jul 1, 2024
3c94fed
Merge branch 'master' into sshash_module
adamant-pwn Jul 2, 2024
261d608
Put early_term in sequence_graph, silence sshash with rdbuf swap
adamant-pwn Jul 2, 2024
da9ec07
Preserve failbit state
adamant-pwn Jul 2, 2024
61c75b4
only use DBGSSHash in build_graph<DBGSSHash>
adamant-pwn Jul 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.fa
*.fai
.vscode
!metagraph/tests/data/*.fa
!metagraph/tests/data/*.fai
metagraph/tests/data/*dump_test*
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,6 @@
[submodule "metagraph/external-libraries/htslib"]
path = metagraph/external-libraries/htslib
url = https://github.com/samtools/htslib
[submodule "metagraph/external-libraries/sshash"]
path = metagraph/external-libraries/sshash
url = https://github.com/ratschlab/sshash
6 changes: 6 additions & 0 deletions metagraph/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@ include_directories(
PUBLIC SYSTEM
external-libraries/asio/asio/include
external-libraries/simde-no-tests
external-libraries/sshash
external-libraries/sshash/include
external-libraries/sshash/external/pthash
external-libraries/sshash/external/pthash/external/essentials/include
)

add_library(ips4o INTERFACE)
Expand Down Expand Up @@ -319,6 +323,7 @@ IF(APPLE)
set(THREADS_PREFER_PTHREAD_FLAG ON)
ENDIF()
add_subdirectory(external-libraries/spdlog)
add_subdirectory(external-libraries/sshash SYSTEM)
add_subdirectory(external-libraries/DYNAMIC)
add_subdirectory(external-libraries/zlib)
target_compile_options(zlib
Expand Down Expand Up @@ -409,6 +414,7 @@ set(METALIBS ${METALIBS}
mersenne_twister
sdust
spdlog::spdlog
sshash_static
XXSDS_DYNAMIC
ips4o
caches
Expand Down
1 change: 1 addition & 0 deletions metagraph/external-libraries/sshash
Submodule sshash added at 2b7eeb
13 changes: 13 additions & 0 deletions metagraph/src/cli/build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "graph/representation/hash/dbg_hash_ordered.hpp"
#include "graph/representation/hash/dbg_hash_string.hpp"
#include "graph/representation/hash/dbg_hash_fast.hpp"
#include "graph/representation/hash/dbg_sshash.hpp"
#include "graph/representation/bitmap/dbg_bitmap.hpp"
#include "graph/representation/bitmap/dbg_bitmap_construct.hpp"
#include "graph/representation/succinct/dbg_succinct.hpp"
Expand Down Expand Up @@ -249,6 +250,13 @@ int build_graph(Config *config) {
get_verbose()));
}

} else if (config->graph_type == Config::GraphType::SSHASH && !config->dynamic) {
graph.reset(new DBGSSHash(files.at(0), config->k, config->graph_mode, config->num_chars));
if (files.size() > 1) {
logger->error("DBGSSHash does not support multiple input files.");
exit(1);
}

} else {
//slower method
switch (config->graph_type) {
Expand Down Expand Up @@ -284,6 +292,11 @@ int build_graph(Config *config) {
" in dynamic regime is not supported");
exit(1);

case Config::GraphType::SSHASH:
logger->error("SSHash-graph construction"
" in dynamic regime is not supported");
hmusta marked this conversation as resolved.
Show resolved Hide resolved
exit(1);

case Config::GraphType::INVALID:
assert(false);
}
Expand Down
7 changes: 6 additions & 1 deletion metagraph/src/cli/config/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ Config::Config(int argc, char *argv[]) {
alignment_post_chain = true;
} else if (!strcmp(argv[i], "--align-no-seed-complexity-filter")) {
alignment_seed_complexity_filter = false;
} else if (!strcmp(argv[i], "--num-chars")) {
num_chars = atoll(get_value(i++));
} else if (!strcmp(argv[i], "--max-hull-depth")) {
max_hull_depth = atoll(get_value(i++));
} else if (!strcmp(argv[i], "--batch-align")) {
Expand Down Expand Up @@ -815,6 +817,8 @@ Config::GraphType Config::string_to_graphtype(const std::string &string) {
} else if (string == "bitmap") {
return GraphType::BITMAP;

} else if (string == "sshash") {
return GraphType::SSHASH;
} else {
std::cerr << "Error: unknown graph representation" << std::endl;
exit(1);
Expand Down Expand Up @@ -956,12 +960,13 @@ if (advanced) {
fprintf(stderr, "\t --max-count-q [INT] \tmax k-mer abundance quantile (max-count is used by default) [1.0]\n");
fprintf(stderr, "\t --reference [STR] \tbasename of reference sequence (for parsing VCF files) []\n");
fprintf(stderr, "\n");
fprintf(stderr, "\t --graph [STR] \tgraph representation: succinct / bitmap / hash / hashstr / hashfast [succinct]\n");
fprintf(stderr, "\t --graph [STR] \tgraph representation: succinct / bitmap / hash / hashstr / hashfast [succinct] / sshash\n");
fprintf(stderr, "\t --state [STR] \tstate of succinct graph: small / dynamic / stat / fast [stat]\n");
fprintf(stderr, "\t --inplace \t\tconstruct succinct graph in-place and serialize without loading to RAM [off]\n");
fprintf(stderr, "\t --count-kmers \tcount k-mers and build weighted graph [off]\n");
fprintf(stderr, "\t --count-width \tnumber of bits used to represent k-mer abundance [8]\n");
fprintf(stderr, "\t --index-ranges [INT]\tindex all node ranges in BOSS for suffixes of given length [%zu]\n", kDefaultIndexSuffixLen);
fprintf(stderr, "\t --num-chars [INT]\tif the number of characters is known beforehand, enter it here [0]\n");
fprintf(stderr, "\t-k --kmer-length [INT] \tlength of the k-mer to use [3]\n");
#if ! _PROTEIN_GRAPH
fprintf(stderr, "\t --mode \t\tk-mer indexing mode: basic / canonical / primary [basic]\n");
Expand Down
2 changes: 2 additions & 0 deletions metagraph/src/cli/config/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class Config {
unsigned long long int num_rows_subsampled = 1'000'000;
unsigned long long int num_singleton_kmers = 0;
unsigned long long int max_hull_depth = -1; // the default is a function of input
unsigned long long int num_chars = 0;

uint8_t count_width = 8;

Expand Down Expand Up @@ -223,6 +224,7 @@ class Config {
HASH_PACKED,
HASH_STR,
HASH_FAST,
SSHASH,
BITMAP,
};

Expand Down
8 changes: 6 additions & 2 deletions metagraph/src/cli/load/load_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "graph/representation/hash/dbg_hash_ordered.hpp"
#include "graph/representation/hash/dbg_hash_string.hpp"
#include "graph/representation/hash/dbg_hash_fast.hpp"
#include "graph/representation/hash/dbg_sshash.hpp"
#include "graph/representation/bitmap/dbg_bitmap.hpp"
#include "graph/representation/succinct/dbg_succinct.hpp"
#include "cli/config/config.hpp"
Expand Down Expand Up @@ -36,6 +37,9 @@ Config::GraphType parse_graph_type(const std::string &filename) {
} else if (utils::ends_with(filename, graph::DBGBitmap::kExtension)) {
return Config::GraphType::BITMAP;

} else if (utils::ends_with(filename, graph::DBGSSHash::kExtension)) {
return Config::GraphType::SSHASH;

} else {
return Config::GraphType::INVALID;
}
Expand All @@ -58,10 +62,10 @@ std::shared_ptr<DeBruijnGraph> load_critical_dbg(const std::string &filename) {

case Config::GraphType::HASH_FAST:
return load_critical_graph_from_file<DBGHashFast>(filename);

case Config::GraphType::BITMAP:
return load_critical_graph_from_file<graph::DBGBitmap>(filename);

case Config::GraphType::SSHASH:
return load_critical_graph_from_file<graph::DBGSSHash>(filename);
case Config::GraphType::INVALID:
logger->error("Cannot load graph from file '{}', needs a valid file extension",
filename);
Expand Down
4 changes: 2 additions & 2 deletions metagraph/src/graph/alignment/aligner_labeled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ void LabeledExtender::call_alignments(score_t end_score,
}

if (label_it == label_end_it)
throw std::bad_function_call();
throw early_term();

if (c < *label_it)
return;
Expand All @@ -431,7 +431,7 @@ void LabeledExtender::call_alignments(score_t end_score,
}
}
);
} catch (const std::bad_function_call&) {}
} catch (const early_term&) {}
}

if (alignment.label_coordinates.empty())
Expand Down
6 changes: 3 additions & 3 deletions metagraph/src/graph/alignment/dbg_aligner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ ::align_both_directions(std::string_view forward,
[&](Chain&& chain, score_t score) {
if (config_.num_alternative_paths <= 1
&& finished_columns.size() == all_columns.size()) {
throw std::bad_function_call();
throw early_term();
}

double exact_match_fraction
Expand All @@ -595,7 +595,7 @@ ::align_both_directions(std::string_view forward,
#endif

if (exact_match_fraction < config_.min_exact_match)
throw std::bad_function_call();
throw early_term();

extend_chain(chain[0].first.get_orientation() ? reverse : forward,
chain[0].first.get_orientation() ? forward : reverse,
Expand All @@ -613,7 +613,7 @@ ::align_both_directions(std::string_view forward,
[&](Alignment::Column column) { return finished_columns.count(column); }
);
num_explored_nodes += this_num_explored;
} catch (const std::bad_function_call&) {}
} catch (const early_term&) {}

for (Alignment &alignment : aggregator.get_alignments()) {
if (alignment.get_score() < get_min_path_score(alignment))
Expand Down
5 changes: 4 additions & 1 deletion metagraph/src/graph/representation/base/dbg_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ class DBGWrapper : public DeBruijnGraph {
const std::function<bool()> &stop_early
= [](){ return false; }) const override = 0;

virtual void call_kmers(const std::function<void(node_index, const std::string&)> &callback) const override = 0;
virtual void call_kmers(const std::function<void(node_index,
const std::string&)> &callback,
const std::function<bool()> &stop_early
= [](){ return false; }) const override = 0;

protected:
std::shared_ptr<const Graph> graph_;
Expand Down
39 changes: 34 additions & 5 deletions metagraph/src/graph/representation/base/sequence_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,33 @@ bool DeBruijnGraph::find(std::string_view sequence,
return num_kmers_missing <= max_kmers_missing;
}

bool DeBruijnGraph::operator==(const DeBruijnGraph &) const {
throw std::runtime_error("Not implemented");
return false;
void DeBruijnGraph
::adjacent_outgoing_nodes(node_index node,
const std::function<void(node_index)> &callback) const {
assert(node > 0 && node <= max_index());
call_outgoing_kmers(node, [&](auto child, char) { callback(child); });
}

void DeBruijnGraph
::adjacent_incoming_nodes(node_index node,
const std::function<void(node_index)> &callback) const {
assert(node > 0 && node <= max_index());
adamant-pwn marked this conversation as resolved.
Show resolved Hide resolved
call_incoming_kmers(node, [&](auto parent, char) { callback(parent); });
}

bool DeBruijnGraph::operator==(const DeBruijnGraph &other) const {
bool not_equal = false;
other.call_kmers([&](node_index, const std::string &kmer) {
if (!find(kmer))
not_equal = true;
}, [&]() { return not_equal; });

call_kmers([&](node_index, const std::string &kmer) {
if (!other.find(kmer))
not_equal = true;
}, [&]() { return not_equal; });

return !not_equal;
}

void DeBruijnGraph::traverse(node_index start,
Expand Down Expand Up @@ -400,7 +424,12 @@ void DeBruijnGraph::call_unitigs(const CallPath &callback,
* Traverse graph and iterate over all nodes
*/
void DeBruijnGraph
::call_kmers(const std::function<void(node_index, const std::string&)> &callback) const {
::call_kmers(const std::function<void(node_index,
const std::string&)> &callback,
const std::function<bool()> &stop_early) const {
if (stop_early())
return;

sdsl::bit_vector visited(max_index() + 1, false);
std::stack<std::pair<node_index, std::string>> nodes;

Expand Down Expand Up @@ -444,7 +473,7 @@ ::call_kmers(const std::function<void(node_index, const std::string&)> &callback
sequence.push_back(next_c);
}
}
});
}, stop_early);
}

void DeBruijnGraph::print(std::ostream &out) const {
Expand Down
16 changes: 14 additions & 2 deletions metagraph/src/graph/representation/base/sequence_graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <iostream>
#include <memory>


namespace utils {
std::string make_suffix(const std::string &str, const std::string &suffix);
} // namespace utils
Expand All @@ -16,6 +15,11 @@ namespace utils {
namespace mtg {
namespace graph {

class early_term : public std::exception {
public:
const char* what() const noexcept override { return "Finished iteration"; }
};

class SequenceGraph {
public:
// Node indexes [1,...,max_index], but only num_nodes of them are real.
Expand Down Expand Up @@ -195,7 +199,8 @@ class DeBruijnGraph : public SequenceGraph {
size_t min_tip_size = 1,
bool kmers_in_single_form = false) const;

virtual void call_kmers(const std::function<void(node_index, const std::string&)> &callback) const;
virtual void call_kmers(const std::function<void(node_index, const std::string&)> &callback,
const std::function<bool()> &stop_early = [](){ return false; }) const;

virtual size_t outdegree(node_index) const = 0;
virtual bool has_single_outgoing(node_index node) const { return outdegree(node) == 1; }
Expand All @@ -217,6 +222,13 @@ class DeBruijnGraph : public SequenceGraph {
virtual void call_incoming_kmers(node_index kmer,
const IncomingEdgeCallback &callback) const = 0;

// Given a node index, call the target nodes of all edges outgoing from it.
virtual void adjacent_outgoing_nodes(node_index node,
const std::function<void(node_index)> &callback) const override;
// Given a node index, call the source nodes of all edges incoming to it.
virtual void adjacent_incoming_nodes(node_index node,
const std::function<void(node_index)> &callback) const override;

// Check whether graph contains fraction of nodes from the sequence
virtual bool find(std::string_view sequence, double discovery_fraction = 1) const;

Expand Down
14 changes: 0 additions & 14 deletions metagraph/src/graph/representation/bitmap/dbg_bitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,20 +196,6 @@ size_t DBGBitmap::indegree(node_index node) const {
- kmers_.rank1(first.data());
}

void DBGBitmap::adjacent_outgoing_nodes(node_index node,
const std::function<void(node_index)> &callback) const {
assert(node > 0 && node <= num_nodes());

call_outgoing_kmers(node, [&](node_index child, char) { callback(child); });
}

void DBGBitmap::adjacent_incoming_nodes(node_index node,
const std::function<void(node_index)> &callback) const {
assert(node > 0 && node <= num_nodes());

call_incoming_kmers(node, [&](node_index parent, char) { callback(parent); });
}

DBGBitmap::node_index DBGBitmap::to_node(const Kmer &kmer) const {
uint64_t index = kmer.data() + 1;

Expand Down
7 changes: 0 additions & 7 deletions metagraph/src/graph/representation/bitmap/dbg_bitmap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,6 @@ class DBGBitmap : public DeBruijnGraph {
// Traverse the incoming edge
node_index traverse_back(node_index node, char prev_char) const;

// Given a node index, call the target nodes of all edges outgoing from it.
void adjacent_outgoing_nodes(node_index node,
const std::function<void(node_index)> &callback) const;
// Given a node index, call the source nodes of all edges incoming to it.
void adjacent_incoming_nodes(node_index node,
const std::function<void(node_index)> &callback) const;

size_t outdegree(node_index) const;
bool has_single_outgoing(node_index) const;
bool has_multiple_outgoing(node_index) const;
Expand Down
Loading
Loading