Scaffolding
0.1
This program can assemble genome scaffolds using the pairing information in paired-end reads.
|
the main graph class More...
#include <scaffold_graph.hpp>
Public Member Functions | |
ScaffoldGraph () | |
constructor initializing an empty graph | |
ScaffoldGraph (const Graph &g) | |
constructor initializing a copy of the given graph g | |
ScaffoldGraph (Graph *const g) | |
constructor initializing using the given graph pointer; no copy is performed More... | |
ScaffoldGraph (const ScaffoldGraph &g, Matching< Graph > *const translate, const bool update_infos=true) | |
constructor initializing a copy of the given graph g and returning the translate map in translate; update infos if requested More... | |
~ScaffoldGraph () | |
destructor deleting _the_graph | |
void | update_vertex_indices (const unsigned first_index=0) |
recompute vertex indices; useful after deleting vertices or uniting scaffold graphs | |
const VertexIndexMap | get_index_map () const |
get an index map to use in various boost algorithms | |
std::pair< Edge, bool > | find_edge (const Vertex &u, const Vertex &v) const |
find an edge in _the_graph, given its endpoints More... | |
void | clear_vertex (const Vertex &u) |
remove all non-matching edges incident with u | |
void | delete_vertex (const Vertex &u, const bool update_indices=true, const bool update_infos=true) |
remove a vertex and all its incident edges More... | |
const VertexProperty & | operator[] (const Vertex &u) const |
get a const reference to the vertex properties of u | |
VertexProperty & | operator[] (const Vertex &u) |
get a reference to the vertex properties of u | |
const EdgeProperty & | operator[] (const Edge &e) const |
get a const reference to the edge properties of e | |
EdgeProperty & | operator[] (const Edge &e) |
get a reference to the edge properties of e | |
const EdgeProperty & | operator[] (const VertexPair< Graph > &uv) const |
get a const reference to the edge properties of uv, throwing invalid_assumption if uv does not exist | |
EdgeProperty & | operator[] (const VertexPair< Graph > &uv) |
get a reference to the edge properties of uv, throwing invalid_assumption if uv does not exist | |
const GraphProperty & | get_graph_property () const |
return a const reference to the graph properties | |
Vertex | source (const Edge &e) const |
get a copy of the source vertex of e | |
Vertex | target (const Edge &e) const |
get a copy of the target vertex of e | |
const GraphInfos< Graph > & | get_infos () const |
get a const reference to the graph infos | |
const Graph & | get_graph () const |
get a const reference to the underlying graph | |
const Matching< Graph > & | get_matching () const |
get a const reference to the perfect matching in _the_graph | |
const Vertex & | matched_with (const Vertex &v) const |
get a const reference to the vertex matched with v | |
const bool | is_matching_edge (const VertexPair< Graph > &uv) const |
return whether the given VertexPair is matched More... | |
const Edge | incident_matching_edge (const Vertex &v) const |
return the matching edge that is incident with v | |
const unsigned | degree (const Vertex &v) const |
return the degree of v | |
bool | adjacent (const Vertex &u, const Vertex &v) const |
return whether u & v are adjacent | |
void | get_neighbors (const Vertex &u, VertexSet &nh) const |
put all neighbors of u into nh | |
unsigned | get_max_multiplicity () const |
compute the maximum multiplicity occuring in g | |
std::pair< Edge, int > | get_max_non_contig_length () const |
return a non-contig edge of maximum length in the graph | |
void | delete_edge (const Edge &e, const bool update_infos=true) |
delete an edge e and update infos if requested More... | |
bool | delete_edge (const Vertex &u, const Vertex &v) |
delete an edge e and update infos if requested; return whether the edge had existed before or not | |
bool | delete_edge (const VertexPair< Graph > &uv) |
convenience function to delete pairs of vertices | |
Vertex const * | find_vertex_by_name (const VertexName &name) const |
find a vertex given its name More... | |
Edge const * | find_edge_by_name (const EdgeName &name) const |
delete edge by name More... | |
const Vertex | add_vertex (const VertexProperty &p, const bool update_infos=true) |
add a new vertex and return it | |
const Vertex | add_vertex (const std::string name, const bool update_infos=true, const unsigned index=UINT_MAX) |
add a new vertex and return it; use the given name & index More... | |
const Vertex | add_vertex (const Vertex &u, const bool update_infos=true) |
add a new vertex and return it; copy the name from vertex u More... | |
std::pair< Edge, bool > | add_edge (const Vertex &u, const Vertex &v, const EdgeProperty &ep=EdgeProperty(), const bool update_infos=true) |
add a new edge unless it is already there; return it and whether an insertion took place More... | |
std::pair< Edge, bool > | add_matching_edge (const Vertex &u, const Vertex &v, const EdgeProperty &ep=EdgeProperty(), const bool update_infos=true) |
add a matching edge unless the edge already exists; return the edge and whether an insertion took place More... | |
EdgeName | get_edge_name (const VertexPair< Graph > &uv) const |
get a copy of the name of the edge uv; independent of its presence | |
EdgeName | get_edge_name (const Edge &e) const |
get a copy of the name of an edge | |
bool | is_bridge (const ScafVertex &u, const ScafVertex &v) |
return whether the given vertex pair constitutes a bridge, updating infos if necessary | |
bool | is_bridge_const (const ScafVertex &u, const ScafVertex &v) const |
return whether the given vertex pair constitutes a bridge without updating the infos | |
bool | is_on_alternating_cycle (const ScafVertex &u, const ScafVertex &v) const |
return whether the given edge is on an alternating cycle | |
unsigned | weight () const |
return the total weight of the graph | |
template<class Predicate = TruePredicate<Edge>> | |
Predicated_EdgeIter< Graph, Predicate, EdgeIter< Graph > > | get_edges (const Predicate &pred=Predicate()) const |
get all edges satisfying a predicate | |
Predicated_EdgeIter< Graph, MatchingPredicate< Graph >, EdgeIter< Graph > > | get_matching_edges () const |
convenience fuction to get all matching edges | |
Predicated_EdgeIter< Graph, MatchingPredicate< Graph >, EdgeIter< Graph > > | get_non_matching_edges () const |
convenience fuction to get all non-matching edges | |
template<class Predicate = TruePredicate<Edge>> | |
Predicated_EdgeIter< Graph, Predicate > | get_incident (const Vertex &u, const Predicate &pred=Predicate()) const |
get incident edges of u satisfying a predicate | |
Predicated_EdgeIter< Graph, MatchingPredicate< Graph > > | get_incident_non_matching (const Vertex &u) const |
convenience function to get all incident non-matching edges of u | |
Graph *const | split_off_component () |
if _the_graph is disconnected, split off & return a connected compoenent, otherwise return NULL | |
void | disjoint_union (const ScaffoldGraph &g) |
merge g into our graph | |
void | print_statistics () |
print various statistics | |
void | remove_contigs () |
remove all contig edges from the graph More... | |
Protected Member Functions | |
void | copy_and_init_matching (const ScaffoldGraph &g, Matching< Graph > *const translate, const bool update_infos) |
outsource common constructor work: copy a given graph, construct a matching from the translate map, and update infos if requested | |
void | parse_matching_from_graph () |
compute the matching by parsing the properties of all edges | |
void | delete_matching (const Vertex &u) |
remove the indication that uv is a matching edge | |
Protected Attributes | |
Graph *const | _the_graph |
the underlying boost graph | |
Matching< Graph > | matched |
a perfect matching in _the_graph | |
GraphInfos< Graph > | infos |
a set of graph properties of the underlying graph More... | |
the main graph class
the ScaffoldGraph class is the main graph class, providing infrastructure around a boost::adjacency_list graph, such as managing the matching, getting incident edges, and managing graph properties (max degree, components, ...)
|
inline |
constructor initializing using the given graph pointer; no copy is performed
be extra cautious with this, as this leaves you with a direct pointer to _the_graph with, among others, should never be freed manually (the destructor of the ScaffoldGraph will free it)!
|
inline |
constructor initializing a copy of the given graph g and returning the translate map in translate; update infos if requested
the translate map will translate vertices of g into their representation in _the_graph
|
inline |
add a new edge unless it is already there; return it and whether an insertion took place
the edge will have the given EdgeProperties
|
inline |
add a matching edge unless the edge already exists; return the edge and whether an insertion took place
if the edge is already present, it will still be marked as a matching edge
|
inline |
add a new vertex and return it; use the given name & index
if no index is given, the old number of vertices is used as index
|
inline |
add a new vertex and return it; copy the name from vertex u
the index of the new vertex will be the old number of vertices
|
inline |
delete an edge e and update infos if requested
if no update of the infos is requested, they will be invalidated to stay consistent
|
inline |
remove a vertex and all its incident edges
If update_indices is false, then vertex indices are not updated, you'll have to update them before running certain boost algorithms. If update_infos is false, then graph infos will not be updated, but just invalidated.
|
inline |
find an edge in _the_graph, given its endpoints
if uv is found in _the_graph, return (uv, true), otherwise return a pair of garbage and false
|
inline |
delete edge by name
NOTE: avoid if possible as this uses find_vertex_by_name() which is highly inefficient
|
inline |
find a vertex given its name
NOTE: avoid if possible as this scans all vertices, which is highly inefficient
|
inline |
return whether the given VertexPair is matched
compared to operator[](find_edge(u, v)), we save an edge lookup
|
inline |
remove all contig edges from the graph
useful to determine graph parameters relating to this graph
|
protected |
a set of graph properties of the underlying graph
although edge properties have is_matching_edge(), this allows finding the matched vertex in O(1) average time