8 #include <boost/graph/graph_traits.hpp>
9 #include <utils/graph_typedefs.hpp>
10 #include <boost/graph/graphviz.hpp>
17 template <
class WhatToWrite>
19 const RawScaffoldGraph& g;
23 void write_property(std::ostream& out,
const std::string& name,
const std::string& value,
const std::string& middle =
"")
const{
24 out << name <<
" = \""<< middle << value <<
"\"";
26 void write_property(std::ostream& out,
const std::string& name,
const unsigned& value,
const std::string& middle =
"")
const{
27 out << name <<
" = "<< middle << value;
38 void operator()(std::ostream& out)
const
41 this->write_property(out,
"insert_size", g[graph_bundle].insert_size);
43 out <<
"];" << std::endl;
52 void write_properties(std::ostream& out,
const ScafVertex& u)
const
54 this->write_property(out,
"label", g[u].name);
56 void operator()(std::ostream& out,
const ScafVertex& u)
const
59 write_properties(out, u);
69 void write_properties(std::ostream& out,
const ScafEdge& e)
const{
70 if(g[e].is_matching_edge()){
71 this->write_property(out,
"style",
"bold");
72 const size_t mult = g[e].multiplicity;
73 this->write_property(out,
", mult", mult);
75 this->write_property(out,
", color",
"darkgreen");
77 this->write_property(out,
"label", g[e].weight,
" ");
80 void operator()(std::ostream& out,
const ScafEdge& e)
const{
82 write_properties(out, e);
88 using gviz_simple_edge_writer::g;
89 ScafEdgeSet jump_edges;
93 jump_edges(default_buckets, _g)
96 jump_edges.insert(jump.contig);
97 for(
const ScafEdge& e : jump.path) jump_edges.insert(e);
100 void write_properties(std::ostream& out,
const ScafEdge& e)
const{
102 if(g[e].is_matching_edge())
103 this->write_property(out,
"color",
"purple");
105 this->write_property(out,
"color",
"blue");
108 if(g[e].is_matching_edge() && (g[e].length < (
int)g[graph_bundle].insert_size)){
109 this->write_property(out,
"color",
"red");
113 gviz_simple_edge_writer::write_properties(out, e);
115 void operator()(std::ostream& out,
const ScafEdge& e)
const{
117 write_properties(out, e);
123 template<
class EdgeWriter>
124 void _write_scaffold_as_dot(std::ostream& out,
const RawScaffoldGraph& g,
const EdgeWriter& ew){
127 boost::write_graphviz(out, g, vw, ew, gw, boost::get(&ScafVertexProperty::index, g));
131 void write_scaffold_as_dot(std::ostream& out,
const RawScaffoldGraph& g){
132 _write_scaffold_as_dot(out, g, gviz_simple_edge_writer(g));
136 void write_scaffold_as_dot(std::ostream& out,
const RawScaffoldGraph& g,
const std::list<contig_jump>& jumps){
137 std::cout <<
"writing with "<<jumps.size()<<
" jump contigs"<<std::endl;
138 _write_scaffold_as_dot(out, g, gviz_edge_writer_with_jumps(g, jumps));
Definition: write_dot.hpp:18
Definition: read_adj_list.hpp:22
Definition: read_phytree.hpp:10
Definition: write_dot.hpp:65
Definition: write_dot.hpp:33
Definition: write_dot.hpp:48
Definition: scaffolding_typedefs.hpp:155
Definition: write_dot.hpp:87
bool contains(const Set &s, const Element &el)
a more readable containment check
Definition: utils.hpp:171