Skip to content

Commit 2f4b069

Browse files
committed
Remove odgi
1 parent 15cedd8 commit 2f4b069

24 files changed

Lines changed: 130 additions & 5073 deletions

CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,6 @@ add_library(bdsg_objs OBJECT
272272
${bdsg_DIR}/src/hash_graph.cpp
273273
${bdsg_DIR}/src/is_single_stranded.cpp
274274
${bdsg_DIR}/src/mapped_structs.cpp
275-
${bdsg_DIR}/src/node.cpp
276-
${bdsg_DIR}/src/odgi.cpp
277275
${bdsg_DIR}/src/packed_graph.cpp
278276
${bdsg_DIR}/src/packed_path_position_overlay.cpp
279277
${bdsg_DIR}/src/packed_reference_path_overlay.cpp

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ OBJS = $(OBJ_DIR)/eades_algorithm.o
1515
OBJS += $(OBJ_DIR)/hash_graph.o
1616
OBJS += $(OBJ_DIR)/is_single_stranded.o
1717
OBJS += $(OBJ_DIR)/mapped_structs.o
18-
OBJS += $(OBJ_DIR)/node.o
19-
OBJS += $(OBJ_DIR)/odgi.o
2018
OBJS += $(OBJ_DIR)/packed_graph.o
2119
OBJS += $(OBJ_DIR)/path_position_overlays.o
2220
OBJS += $(OBJ_DIR)/packed_path_position_overlay.o

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ Optimized **b**i**d**irected **s**equence **g**raph implementations for graph ge
66

77
## About
88

9-
The main purpose of `libbdsg` is to provide high performance implementations of sequence graphs for graph-based pangenomics applications. The repository contains three graph implementations with different performance tradeoffs:
9+
The main purpose of `libbdsg` is to provide high performance implementations of sequence graphs for graph-based pangenomics applications. The repository contains two graph implementations with different performance tradeoffs:
1010

1111
- HashGraph: prioritizes speed
12-
- ODGI: balances speed and low memory usage
1312
- PackedGraph: prioritizes low memory usage
1413

14+
Previously, a third implementation, ODGI, was provided, but that implementation is now part of its own [odgi project](https://github.com/pangenome/odgi#odgi).
15+
1516
All of these graph objects implement a common interface defined by [`libhandlegraph`](https://github.com/vgteam/libhandlegraph), so they can be used interchangeably and swapped easily.
1617

1718
Additionally, `libbdsg` provides a few "overlays", which are applied to the graph implementations in order to expand their functionality. The expanded functionality is also described generically using `libhandlegraph` interfaces.

bdsg/cmake_bindings/bdsg.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ void bind_bdsg_internal_is_single_stranded(std::function< pybind11::module &(std
2626
void bind_bdsg_internal_eades_algorithm(std::function< pybind11::module &(std::string const &namespace_) > &M);
2727
void bind_handlegraph_snarl_decomposition(std::function< pybind11::module &(std::string const &namespace_) > &M);
2828
void bind_std_bdsg_internal_binder_hook_bind(std::function< pybind11::module &(std::string const &namespace_) > &M);
29-
void bind_bdsg_odgi(std::function< pybind11::module &(std::string const &namespace_) > &M);
3029
void bind_handlegraph_path_position_handle_graph(std::function< pybind11::module &(std::string const &namespace_) > &M);
3130
void bind_bdsg_overlays_packed_path_position_overlay(std::function< pybind11::module &(std::string const &namespace_) > &M);
32-
void bind_bdsg_overlays_packed_subgraph_overlay(std::function< pybind11::module &(std::string const &namespace_) > &M);
31+
void bind_bdsg_overlays_packed_path_position_overlay_1(std::function< pybind11::module &(std::string const &namespace_) > &M);
3332
void bind_bdsg_overlays_path_position_overlays(std::function< pybind11::module &(std::string const &namespace_) > &M);
3433
void bind_bdsg_overlays_path_subgraph_overlay(std::function< pybind11::module &(std::string const &namespace_) > &M);
3534
void bind_bdsg_overlays_vectorizable_overlays(std::function< pybind11::module &(std::string const &namespace_) > &M);
@@ -80,10 +79,9 @@ PYBIND11_MODULE(bdsg, root_module) {
8079
bind_bdsg_internal_eades_algorithm(M);
8180
bind_handlegraph_snarl_decomposition(M);
8281
bind_std_bdsg_internal_binder_hook_bind(M);
83-
bind_bdsg_odgi(M);
8482
bind_handlegraph_path_position_handle_graph(M);
8583
bind_bdsg_overlays_packed_path_position_overlay(M);
86-
bind_bdsg_overlays_packed_subgraph_overlay(M);
84+
bind_bdsg_overlays_packed_path_position_overlay_1(M);
8785
bind_bdsg_overlays_path_position_overlays(M);
8886
bind_bdsg_overlays_path_subgraph_overlay(M);
8987
bind_bdsg_overlays_vectorizable_overlays(M);

bdsg/cmake_bindings/bdsg.sources

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ bdsg/internal/is_single_stranded.cpp
1717
bdsg/internal/eades_algorithm.cpp
1818
handlegraph/snarl_decomposition.cpp
1919
std/bdsg/internal/binder_hook_bind.cpp
20-
bdsg/odgi.cpp
2120
handlegraph/path_position_handle_graph.cpp
2221
bdsg/overlays/packed_path_position_overlay.cpp
23-
bdsg/overlays/packed_subgraph_overlay.cpp
22+
bdsg/overlays/packed_path_position_overlay_1.cpp
2423
bdsg/overlays/path_position_overlays.cpp
2524
bdsg/overlays/path_subgraph_overlay.cpp
2625
bdsg/overlays/vectorizable_overlays.cpp

bdsg/cmake_bindings/bdsg/odgi.cpp

Lines changed: 0 additions & 1107 deletions
This file was deleted.

bdsg/cmake_bindings/bdsg/overlays/packed_path_position_overlay.cpp

Lines changed: 54 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,32 @@ struct PyCallBack_bdsg_PackedPositionOverlay : public bdsg::PackedPositionOverla
425425
}
426426
return PackedPositionOverlay::get_path_handle_of_step(a0);
427427
}
428+
bool for_each_path_handle_impl(const class std::function<bool (const struct handlegraph::path_handle_t &)> & a0) const override {
429+
pybind11::gil_scoped_acquire gil;
430+
pybind11::function overload = pybind11::get_overload(static_cast<const bdsg::PackedPositionOverlay *>(this), "for_each_path_handle_impl");
431+
if (overload) {
432+
auto o = overload.operator()<pybind11::return_value_policy::reference>(a0);
433+
if (pybind11::detail::cast_is_temporary_value_reference<bool>::value) {
434+
static pybind11::detail::overload_caster_t<bool> caster;
435+
return pybind11::detail::cast_ref<bool>(std::move(o), caster);
436+
}
437+
else return pybind11::detail::cast_safe<bool>(std::move(o));
438+
}
439+
return PackedPositionOverlay::for_each_path_handle_impl(a0);
440+
}
441+
bool for_each_step_on_handle_impl(const struct handlegraph::handle_t & a0, const class std::function<bool (const struct handlegraph::step_handle_t &)> & a1) const override {
442+
pybind11::gil_scoped_acquire gil;
443+
pybind11::function overload = pybind11::get_overload(static_cast<const bdsg::PackedPositionOverlay *>(this), "for_each_step_on_handle_impl");
444+
if (overload) {
445+
auto o = overload.operator()<pybind11::return_value_policy::reference>(a0, a1);
446+
if (pybind11::detail::cast_is_temporary_value_reference<bool>::value) {
447+
static pybind11::detail::overload_caster_t<bool> caster;
448+
return pybind11::detail::cast_ref<bool>(std::move(o), caster);
449+
}
450+
else return pybind11::detail::cast_safe<bool>(std::move(o));
451+
}
452+
return PackedPositionOverlay::for_each_step_on_handle_impl(a0, a1);
453+
}
428454
unsigned long get_path_length(const struct handlegraph::path_handle_t & a0) const override {
429455
pybind11::gil_scoped_acquire gil;
430456
pybind11::function overload = pybind11::get_overload(static_cast<const bdsg::PackedPositionOverlay *>(this), "get_path_length");
@@ -477,48 +503,35 @@ struct PyCallBack_bdsg_PackedPositionOverlay : public bdsg::PackedPositionOverla
477503
}
478504
return PackedPositionOverlay::get_underlying_handle(a0);
479505
}
480-
bool for_each_step_position_on_handle(const struct handlegraph::handle_t & a0, const class std::function<bool (const struct handlegraph::step_handle_t &, const bool &, const unsigned long &)> & a1) const override {
506+
unsigned long scan_path(const struct handlegraph::path_handle_t & a0, void *& a1) override {
481507
pybind11::gil_scoped_acquire gil;
482-
pybind11::function overload = pybind11::get_overload(static_cast<const bdsg::PackedPositionOverlay *>(this), "for_each_step_position_on_handle");
508+
pybind11::function overload = pybind11::get_overload(static_cast<const bdsg::PackedPositionOverlay *>(this), "scan_path");
483509
if (overload) {
484510
auto o = overload.operator()<pybind11::return_value_policy::reference>(a0, a1);
485-
if (pybind11::detail::cast_is_temporary_value_reference<bool>::value) {
486-
static pybind11::detail::overload_caster_t<bool> caster;
487-
return pybind11::detail::cast_ref<bool>(std::move(o), caster);
488-
}
489-
else return pybind11::detail::cast_safe<bool>(std::move(o));
490-
}
491-
return PathPositionHandleGraph::for_each_step_position_on_handle(a0, a1);
492-
}
493-
unsigned long get_step_count(const struct handlegraph::handle_t & a0) const override {
494-
pybind11::gil_scoped_acquire gil;
495-
pybind11::function overload = pybind11::get_overload(static_cast<const bdsg::PackedPositionOverlay *>(this), "get_step_count");
496-
if (overload) {
497-
auto o = overload.operator()<pybind11::return_value_policy::reference>(a0);
498511
if (pybind11::detail::cast_is_temporary_value_reference<unsigned long>::value) {
499512
static pybind11::detail::overload_caster_t<unsigned long> caster;
500513
return pybind11::detail::cast_ref<unsigned long>(std::move(o), caster);
501514
}
502515
else return pybind11::detail::cast_safe<unsigned long>(std::move(o));
503516
}
504-
return PathHandleGraph::get_step_count(a0);
517+
return PackedPositionOverlay::scan_path(a0, a1);
505518
}
506-
bool for_each_path_handle_impl(const class std::function<bool (const struct handlegraph::path_handle_t &)> & a0) const override {
519+
void set_index_count(unsigned long a0) override {
507520
pybind11::gil_scoped_acquire gil;
508-
pybind11::function overload = pybind11::get_overload(static_cast<const bdsg::PackedPositionOverlay *>(this), "for_each_path_handle_impl");
521+
pybind11::function overload = pybind11::get_overload(static_cast<const bdsg::PackedPositionOverlay *>(this), "set_index_count");
509522
if (overload) {
510523
auto o = overload.operator()<pybind11::return_value_policy::reference>(a0);
511-
if (pybind11::detail::cast_is_temporary_value_reference<bool>::value) {
512-
static pybind11::detail::overload_caster_t<bool> caster;
513-
return pybind11::detail::cast_ref<bool>(std::move(o), caster);
524+
if (pybind11::detail::cast_is_temporary_value_reference<void>::value) {
525+
static pybind11::detail::overload_caster_t<void> caster;
526+
return pybind11::detail::cast_ref<void>(std::move(o), caster);
514527
}
515-
else return pybind11::detail::cast_safe<bool>(std::move(o));
528+
else return pybind11::detail::cast_safe<void>(std::move(o));
516529
}
517-
pybind11::pybind11_fail("Tried to call pure virtual function \"PathHandleGraph::for_each_path_handle_impl\"");
530+
return PackedPositionOverlay::set_index_count(a0);
518531
}
519-
bool for_each_step_on_handle_impl(const struct handlegraph::handle_t & a0, const class std::function<bool (const struct handlegraph::step_handle_t &)> & a1) const override {
532+
bool for_each_step_position_on_handle(const struct handlegraph::handle_t & a0, const class std::function<bool (const struct handlegraph::step_handle_t &, const bool &, const unsigned long &)> & a1) const override {
520533
pybind11::gil_scoped_acquire gil;
521-
pybind11::function overload = pybind11::get_overload(static_cast<const bdsg::PackedPositionOverlay *>(this), "for_each_step_on_handle_impl");
534+
pybind11::function overload = pybind11::get_overload(static_cast<const bdsg::PackedPositionOverlay *>(this), "for_each_step_position_on_handle");
522535
if (overload) {
523536
auto o = overload.operator()<pybind11::return_value_policy::reference>(a0, a1);
524537
if (pybind11::detail::cast_is_temporary_value_reference<bool>::value) {
@@ -527,7 +540,20 @@ struct PyCallBack_bdsg_PackedPositionOverlay : public bdsg::PackedPositionOverla
527540
}
528541
else return pybind11::detail::cast_safe<bool>(std::move(o));
529542
}
530-
pybind11::pybind11_fail("Tried to call pure virtual function \"PathHandleGraph::for_each_step_on_handle_impl\"");
543+
return PathPositionHandleGraph::for_each_step_position_on_handle(a0, a1);
544+
}
545+
unsigned long get_step_count(const struct handlegraph::handle_t & a0) const override {
546+
pybind11::gil_scoped_acquire gil;
547+
pybind11::function overload = pybind11::get_overload(static_cast<const bdsg::PackedPositionOverlay *>(this), "get_step_count");
548+
if (overload) {
549+
auto o = overload.operator()<pybind11::return_value_policy::reference>(a0);
550+
if (pybind11::detail::cast_is_temporary_value_reference<unsigned long>::value) {
551+
static pybind11::detail::overload_caster_t<unsigned long> caster;
552+
return pybind11::detail::cast_ref<unsigned long>(std::move(o), caster);
553+
}
554+
else return pybind11::detail::cast_safe<unsigned long>(std::move(o));
555+
}
556+
return PathHandleGraph::get_step_count(a0);
531557
}
532558
class std::vector<handlegraph::step_handle_t> steps_of_handle(const struct handlegraph::handle_t & a0, bool a1) const override {
533559
pybind11::gil_scoped_acquire gil;
@@ -721,8 +747,10 @@ void bind_bdsg_overlays_packed_path_position_overlay(std::function< pybind11::mo
721747
cl.def( pybind11::init( [](const class handlegraph::PathHandleGraph * a0){ return new bdsg::PackedPositionOverlay(a0); }, [](const class handlegraph::PathHandleGraph * a0){ return new PyCallBack_bdsg_PackedPositionOverlay(a0); } ), "doc");
722748
cl.def( pybind11::init<const class handlegraph::PathHandleGraph *, unsigned long>(), pybind11::arg("graph"), pybind11::arg("steps_per_index") );
723749

750+
cl.def( pybind11::init( [](){ return new bdsg::PackedPositionOverlay(); }, [](){ return new PyCallBack_bdsg_PackedPositionOverlay(); } ) );
724751
cl.def( pybind11::init( [](PyCallBack_bdsg_PackedPositionOverlay const &o){ return new PyCallBack_bdsg_PackedPositionOverlay(o); } ) );
725752
cl.def( pybind11::init( [](bdsg::PackedPositionOverlay const &o){ return new bdsg::PackedPositionOverlay(o); } ) );
753+
cl.def("assign", (class bdsg::PackedPositionOverlay & (bdsg::PackedPositionOverlay::*)(const class bdsg::PackedPositionOverlay &)) &bdsg::PackedPositionOverlay::operator=, "C++: bdsg::PackedPositionOverlay::operator=(const class bdsg::PackedPositionOverlay &) --> class bdsg::PackedPositionOverlay &", pybind11::return_value_policy::automatic, pybind11::arg("other"));
726754
cl.def("has_node", (bool (bdsg::PackedPositionOverlay::*)(long long) const) &bdsg::PackedPositionOverlay::has_node, "Method to check if a node exists by ID\n\nC++: bdsg::PackedPositionOverlay::has_node(long long) const --> bool", pybind11::arg("node_id"));
727755
cl.def("get_handle", [](bdsg::PackedPositionOverlay const &o, const long long & a0) -> handlegraph::handle_t { return o.get_handle(a0); }, "", pybind11::arg("node_id"));
728756
cl.def("get_handle", (struct handlegraph::handle_t (bdsg::PackedPositionOverlay::*)(const long long &, bool) const) &bdsg::PackedPositionOverlay::get_handle, "Look up the handle for the node with the given ID in the given orientation\n\nC++: bdsg::PackedPositionOverlay::get_handle(const long long &, bool) const --> struct handlegraph::handle_t", pybind11::arg("node_id"), pybind11::arg("is_reverse"));
@@ -759,23 +787,4 @@ void bind_bdsg_overlays_packed_path_position_overlay(std::function< pybind11::mo
759787
cl.def("get_step_at_position", (struct handlegraph::step_handle_t (bdsg::PackedPositionOverlay::*)(const struct handlegraph::path_handle_t &, const unsigned long &) const) &bdsg::PackedPositionOverlay::get_step_at_position, "Returns the step at this position, measured in bases of sequence starting at\n the step returned by path_begin(). If the position is past the end of the\n path, returns path_end().\n\nC++: bdsg::PackedPositionOverlay::get_step_at_position(const struct handlegraph::path_handle_t &, const unsigned long &) const --> struct handlegraph::step_handle_t", pybind11::arg("path"), pybind11::arg("position"));
760788
cl.def("get_underlying_handle", (struct handlegraph::handle_t (bdsg::PackedPositionOverlay::*)(const struct handlegraph::handle_t &) const) &bdsg::PackedPositionOverlay::get_underlying_handle, "Returns the handle in the underlying graph that corresponds to a handle in the\n overlay\n\nC++: bdsg::PackedPositionOverlay::get_underlying_handle(const struct handlegraph::handle_t &) const --> struct handlegraph::handle_t", pybind11::arg("handle"));
761789
}
762-
{ // bdsg::BBHashHelper file:bdsg/overlays/packed_path_position_overlay.hpp line:288
763-
pybind11::class_<bdsg::BBHashHelper, std::shared_ptr<bdsg::BBHashHelper>> cl(M("bdsg"), "BBHashHelper", "");
764-
{ // bdsg::BBHashHelper::iterator file:bdsg/overlays/packed_path_position_overlay.hpp line:298
765-
auto & enclosing_class = cl;
766-
pybind11::class_<bdsg::BBHashHelper::iterator, std::shared_ptr<bdsg::BBHashHelper::iterator>> cl(enclosing_class, "iterator", "");
767-
cl.def( pybind11::init( [](bdsg::BBHashHelper::iterator const &o){ return new bdsg::BBHashHelper::iterator(o); } ) );
768-
cl.def("assign", (struct bdsg::BBHashHelper::iterator & (bdsg::BBHashHelper::iterator::*)(const struct bdsg::BBHashHelper::iterator &)) &bdsg::BBHashHelper::iterator::operator=, "C++: bdsg::BBHashHelper::iterator::operator=(const struct bdsg::BBHashHelper::iterator &) --> struct bdsg::BBHashHelper::iterator &", pybind11::return_value_policy::automatic, pybind11::arg("other"));
769-
cl.def("plus_plus", (struct bdsg::BBHashHelper::iterator & (bdsg::BBHashHelper::iterator::*)()) &bdsg::BBHashHelper::iterator::operator++, "C++: bdsg::BBHashHelper::iterator::operator++() --> struct bdsg::BBHashHelper::iterator &", pybind11::return_value_policy::automatic);
770-
cl.def("__mul__", (struct handlegraph::step_handle_t (bdsg::BBHashHelper::iterator::*)() const) &bdsg::BBHashHelper::iterator::operator*, "C++: bdsg::BBHashHelper::iterator::operator*() const --> struct handlegraph::step_handle_t");
771-
cl.def("__eq__", (bool (bdsg::BBHashHelper::iterator::*)(const struct bdsg::BBHashHelper::iterator &) const) &bdsg::BBHashHelper::iterator::operator==, "C++: bdsg::BBHashHelper::iterator::operator==(const struct bdsg::BBHashHelper::iterator &) const --> bool", pybind11::arg("other"));
772-
cl.def("__ne__", (bool (bdsg::BBHashHelper::iterator::*)(const struct bdsg::BBHashHelper::iterator &) const) &bdsg::BBHashHelper::iterator::operator!=, "C++: bdsg::BBHashHelper::iterator::operator!=(const struct bdsg::BBHashHelper::iterator &) const --> bool", pybind11::arg("other"));
773-
}
774-
775-
cl.def( pybind11::init<const class handlegraph::PathHandleGraph *>(), pybind11::arg("graph") );
776-
777-
cl.def( pybind11::init( [](bdsg::BBHashHelper const &o){ return new bdsg::BBHashHelper(o); } ) );
778-
cl.def("begin", (struct bdsg::BBHashHelper::iterator (bdsg::BBHashHelper::*)() const) &bdsg::BBHashHelper::begin, "C++ style range begin over steps\n\nC++: bdsg::BBHashHelper::begin() const --> struct bdsg::BBHashHelper::iterator");
779-
cl.def("end", (struct bdsg::BBHashHelper::iterator (bdsg::BBHashHelper::*)() const) &bdsg::BBHashHelper::end, "C++ style range end over steps\n\nC++: bdsg::BBHashHelper::end() const --> struct bdsg::BBHashHelper::iterator");
780-
}
781790
}

0 commit comments

Comments
 (0)