Skip to content

Commit

Permalink
Add ensure_vg() into mcmc_main subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
susannamorin committed Apr 1, 2021
1 parent b95d2aa commit f33c41d
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions src/subcommand/mcmc_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,36 @@ int main_mcmc(int argc, char** argv) {
unique_ptr<SnarlManager> snarls = (vg::io::VPKG::load_one<SnarlManager>(snarls_file));

// // create a PathHandleGraph
unique_ptr<VG> vg_graph;
unique_ptr<PathHandleGraph> path_hgraph;
bdsg::PathPositionOverlayHelper overlay_helper;
vg_graph = vg::io::VPKG::load_one<VG>(graph_file);
path_hgraph = vg::io::VPKG::load_one<PathHandleGraph>(graph_file);

if(vg_graph.get() == nullptr || vg_graph.get() == 0){
// Some stuff below here needs a vg graph.
VG* vg_graph = dynamic_cast<vg::VG*>(path_hgraph.get());

// Call this to populate the vg_graph if it isn't populated.
auto ensure_vg = [&]() -> vg::VG* {
if (vg_graph == nullptr) {
// Copy instead.
vg_graph = new vg::VG();
handlealgs::copy_path_handle_graph(path_hgraph.get(), vg_graph);
// Give the unique_ptr ownership and delete the graph we loaded.
path_hgraph.reset(vg_graph);
// Make sure the paths are all synced up
vg_graph->paths.to_graph(vg_graph->graph);
}
return vg_graph;
};

//convert to VG graph if needed
ensure_vg();

if(vg_graph == nullptr || vg_graph == 0){
cerr << "Graph is NULL" <<endl;
exit(1);
}
PathPositionHandleGraph* graph = nullptr;
graph = overlay_helper.apply(vg_graph.get());
graph = overlay_helper.apply(vg_graph);


// Check our paths
Expand Down

1 comment on commit f33c41d

@adamnovak
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vg CI tests complete for branch min-cut-graph. View the full report here.

16 tests passed, 0 tests failed and 0 tests skipped in 11726 seconds

Please sign in to comment.