Skip to content

Commit

Permalink
Merge pull request #189 from vgteam/packed-edge-count
Browse files Browse the repository at this point in the history
Fix PackedGraph edge counting
  • Loading branch information
adamnovak authored Jun 15, 2023
2 parents 321928a + 36863a8 commit 8e47864
Show file tree
Hide file tree
Showing 42 changed files with 4,476 additions and 4,529 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/testmac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
jobs:
testmac:
name: Test on Mac
runs-on: macos-10.15
runs-on: macos-latest

steps:
- name: Checkout code with submodules
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ if (BUILD_PYTHON_BINDINGS)
# Binder (because some generated bindings depend on headers packaged with Binder)
ExternalProject_Add(binder
GIT_REPOSITORY "https://github.com/RosettaCommons/binder.git"
GIT_TAG "788ab422f9e919478944d79d5890441a964dd1db"
GIT_TAG "ee2ecff151d125c3add072a7765aebad6f42a70d"
# we don't actually build or install Binder via its CMake because we just need its headers
#CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_DIR}
CONFIGURE_COMMAND ""
Expand All @@ -209,7 +209,7 @@ if (BUILD_PYTHON_BINDINGS)
if (NOT EXISTS "${PROJECT_SOURCE_DIR}/pybind11")
message(WARNING "Running on CMake without FetchContent_Declare; attempting to download pybind11 manually")
execute_process(COMMAND git clone https://github.com/RosettaCommons/pybind11.git "${PROJECT_SOURCE_DIR}/pybind11")
execute_process(COMMAND git checkout 4f72ef846fe8453596230ac285eeaa0ce3278bb4
execute_process(COMMAND git checkout 5b0a6fc2017fcc176545afe3e09c9f9885283242
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/pybind11")
endif()

Expand All @@ -225,7 +225,7 @@ if (BUILD_PYTHON_BINDINGS)
FetchContent_Declare(
pybind11
GIT_REPOSITORY https://github.com/RosettaCommons/pybind11.git
GIT_TAG 4f72ef846fe8453596230ac285eeaa0ce3278bb4
GIT_TAG 5b0a6fc2017fcc176545afe3e09c9f9885283242
)
FetchContent_GetProperties(pybind11)
if (NOT pybind11_POPULATED)
Expand Down
31 changes: 20 additions & 11 deletions bdsg/cmake_bindings/bdsg.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#include <map>
#include <algorithm>
#include <functional>
#include <memory>
#include <stdexcept>
#include <functional>
#include <string>

#include <pybind11/pybind11.h>
Expand All @@ -12,20 +13,20 @@ void bind_handlegraph_types(std::function< pybind11::module &(std::string const
void bind_handlegraph_handle_graph(std::function< pybind11::module &(std::string const &namespace_) > &M);
void bind_handlegraph_path_metadata(std::function< pybind11::module &(std::string const &namespace_) > &M);
void bind_handlegraph_path_handle_graph(std::function< pybind11::module &(std::string const &namespace_) > &M);
void bind_std_bdsg_internal_binder_hook_bind(std::function< pybind11::module &(std::string const &namespace_) > &M);
void bind_handlegraph_mutable_path_metadata(std::function< pybind11::module &(std::string const &namespace_) > &M);
void bind_handlegraph_mutable_path_mutable_handle_graph(std::function< pybind11::module &(std::string const &namespace_) > &M);
void bind_bdsg_graph_proxy(std::function< pybind11::module &(std::string const &namespace_) > &M);
void bind_bdsg_graph_proxy_1(std::function< pybind11::module &(std::string const &namespace_) > &M);
void bind_bdsg_internal_wang_hash(std::function< pybind11::module &(std::string const &namespace_) > &M);
void bind_bdsg_internal_mapped_structs(std::function< pybind11::module &(std::string const &namespace_) > &M);
void bind_bdsg_internal_mapped_structs_1(std::function< pybind11::module &(std::string const &namespace_) > &M);
void bind_bdsg_internal_mapped_structs_2(std::function< pybind11::module &(std::string const &namespace_) > &M);
void bind_bdsg_internal_utility(std::function< pybind11::module &(std::string const &namespace_) > &M);
void bind_bdsg_internal_hash_map(std::function< pybind11::module &(std::string const &namespace_) > &M);
void bind_handlegraph_expanding_overlay_graph(std::function< pybind11::module &(std::string const &namespace_) > &M);
void bind_bdsg_overlays_strand_split_overlay(std::function< pybind11::module &(std::string const &namespace_) > &M);
void bind_bdsg_internal_is_single_stranded(std::function< pybind11::module &(std::string const &namespace_) > &M);
void bind_bdsg_internal_eades_algorithm(std::function< pybind11::module &(std::string const &namespace_) > &M);
void bind_handlegraph_snarl_decomposition(std::function< pybind11::module &(std::string const &namespace_) > &M);
void bind_std_bdsg_internal_binder_hook_bind(std::function< pybind11::module &(std::string const &namespace_) > &M);
void bind_bdsg_internal_base_packed_graph(std::function< pybind11::module &(std::string const &namespace_) > &M);
void bind_handlegraph_path_position_handle_graph(std::function< pybind11::module &(std::string const &namespace_) > &M);
void bind_bdsg_overlays_packed_path_position_overlay(std::function< pybind11::module &(std::string const &namespace_) > &M);
void bind_bdsg_overlays_packed_path_position_overlay_1(std::function< pybind11::module &(std::string const &namespace_) > &M);
Expand All @@ -50,35 +51,43 @@ PYBIND11_MODULE(bdsg, root_module) {

modules[""] = root_module;

static std::vector<std::string> const reserved_python_words {"nonlocal", "global", };

auto mangle_namespace_name(
[](std::string const &ns) -> std::string {
if ( std::find(reserved_python_words.begin(), reserved_python_words.end(), ns) == reserved_python_words.end() ) return ns;
else return ns+'_';
}
);

std::vector< std::pair<std::string, std::string> > sub_modules {
{"", "bdsg"},
{"bdsg", "algorithms"},
{"bdsg", "yomo"},
{"", "handlegraph"},
{"", "std"},
};
for(auto &p : sub_modules ) modules[p.first.size() ? p.first+"::"+p.second : p.second] = modules[p.first].def_submodule(p.second.c_str(), ("Bindings for " + p.first + "::" + p.second + " namespace").c_str() );
for(auto &p : sub_modules ) modules[p.first.size() ? p.first+"::"+p.second : p.second] = modules[p.first].def_submodule( mangle_namespace_name(p.second).c_str(), ("Bindings for " + p.first + "::" + p.second + " namespace").c_str() );

//pybind11::class_<std::shared_ptr<void>>(M(""), "_encapsulated_data_");

bind_handlegraph_types(M);
bind_handlegraph_handle_graph(M);
bind_handlegraph_path_metadata(M);
bind_handlegraph_path_handle_graph(M);
bind_std_bdsg_internal_binder_hook_bind(M);
bind_handlegraph_mutable_path_metadata(M);
bind_handlegraph_mutable_path_mutable_handle_graph(M);
bind_bdsg_graph_proxy(M);
bind_bdsg_graph_proxy_1(M);
bind_bdsg_internal_wang_hash(M);
bind_bdsg_internal_mapped_structs(M);
bind_bdsg_internal_mapped_structs_1(M);
bind_bdsg_internal_mapped_structs_2(M);
bind_bdsg_internal_utility(M);
bind_bdsg_internal_hash_map(M);
bind_handlegraph_expanding_overlay_graph(M);
bind_bdsg_overlays_strand_split_overlay(M);
bind_bdsg_internal_is_single_stranded(M);
bind_bdsg_internal_eades_algorithm(M);
bind_handlegraph_snarl_decomposition(M);
bind_std_bdsg_internal_binder_hook_bind(M);
bind_bdsg_internal_base_packed_graph(M);
bind_handlegraph_path_position_handle_graph(M);
bind_bdsg_overlays_packed_path_position_overlay(M);
bind_bdsg_overlays_packed_path_position_overlay_1(M);
Expand Down
2 changes: 1 addition & 1 deletion bdsg/cmake_bindings/bdsg.modules
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bdsg bdsg.algorithms bdsg.yomo handlegraph std
bdsg bdsg.algorithms handlegraph std
8 changes: 4 additions & 4 deletions bdsg/cmake_bindings/bdsg.sources
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ handlegraph/types.cpp
handlegraph/handle_graph.cpp
handlegraph/path_metadata.cpp
handlegraph/path_handle_graph.cpp
std/bdsg/internal/binder_hook_bind.cpp
handlegraph/mutable_path_metadata.cpp
handlegraph/mutable_path_mutable_handle_graph.cpp
bdsg/graph_proxy.cpp
bdsg/graph_proxy_1.cpp
bdsg/internal/wang_hash.cpp
bdsg/internal/mapped_structs.cpp
bdsg/internal/mapped_structs_1.cpp
bdsg/internal/mapped_structs_2.cpp
bdsg/internal/utility.cpp
bdsg/internal/hash_map.cpp
handlegraph/expanding_overlay_graph.cpp
bdsg/overlays/strand_split_overlay.cpp
bdsg/internal/is_single_stranded.cpp
bdsg/internal/eades_algorithm.cpp
handlegraph/snarl_decomposition.cpp
std/bdsg/internal/binder_hook_bind.cpp
bdsg/internal/base_packed_graph.cpp
handlegraph/path_position_handle_graph.cpp
bdsg/overlays/packed_path_position_overlay.cpp
bdsg/overlays/packed_path_position_overlay_1.cpp
Expand Down
Loading

0 comments on commit 8e47864

Please sign in to comment.