vg
tools for working with variation graphs
Public Types | Public Member Functions | Protected Member Functions | List of all members
handlegraph::SnarlDecomposition Class Referenceabstract

#include <snarl_decomposition.hpp>

Inheritance diagram for handlegraph::SnarlDecomposition:
handlegraph::BuildableSnarlDecomposition

Public Types

enum  endpoint_t { START, END, TIP }
 

Public Member Functions

virtual ~SnarlDecomposition ()=default
 
virtual net_handle_t get_root () const =0
 
virtual bool is_root (const net_handle_t &net) const =0
 
virtual bool is_snarl (const net_handle_t &net) const =0
 
virtual bool is_chain (const net_handle_t &net) const =0
 
virtual bool is_node (const net_handle_t &net) const =0
 
virtual bool is_sentinel (const net_handle_t &net) const =0
 
virtual net_handle_t get_net (const handle_t &handle, const HandleGraph *graph) const =0
 
virtual handle_t get_handle (const net_handle_t &net, const HandleGraph *graph) const =0
 
virtual net_handle_t get_parent (const net_handle_t &child) const =0
 
virtual net_handle_t get_bound (const net_handle_t &snarl, bool get_end, bool face_in) const =0
 
virtual net_handle_t flip (const net_handle_t &net) const =0
 
virtual net_handle_t canonical (const net_handle_t &net) const =0
 
virtual endpoint_t starts_at (const net_handle_t &traversal) const =0
 
virtual endpoint_t ends_at (const net_handle_t &traversal) const =0
 
template<typename Iteratee >
bool for_each_child (const net_handle_t &parent, const Iteratee &iteratee) const
 
template<typename Iteratee >
bool for_each_traversal (const net_handle_t &item, const Iteratee &iteratee) const
 
template<typename Iteratee >
bool follow_net_edges (const net_handle_t &here, const HandleGraph *graph, bool go_left, const Iteratee &iteratee) const
 
template<typename Iteratee >
bool for_each_tippy_child (const net_handle_t &parent, const Iteratee &iteratee) const
 
virtual net_handle_t get_parent_traversal (const net_handle_t &traversal_start, const net_handle_t &traversal_end) const =0
 
template<typename Iteratee >
bool for_each_traversal_start (const net_handle_t &traversal, const Iteratee &) const
 
template<typename Iteratee >
bool for_each_traversal_end (const net_handle_t &traversal, const Iteratee &) const
 
net_handle_t get_start_bound (const net_handle_t &parent) const
 
net_handle_t get_end_bound (const net_handle_t &parent) const
 
bool starts_at_start (const net_handle_t &net) const
 
bool starts_at_end (const net_handle_t &net) const
 
bool starts_at_tip (const net_handle_t &net) const
 
bool ends_at_start (const net_handle_t &net) const
 
bool ends_at_end (const net_handle_t &net) const
 
bool ends_at_tip (const net_handle_t &net) const
 

Protected Member Functions

virtual bool for_each_child_impl (const net_handle_t &traversal, const std::function< bool(const net_handle_t &)> &iteratee) const =0
 
virtual bool for_each_traversal_impl (const net_handle_t &item, const std::function< bool(const net_handle_t &)> &iteratee) const =0
 
virtual bool follow_net_edges_impl (const net_handle_t &here, const HandleGraph *graph, bool go_left, const std::function< bool(const net_handle_t &)> &iteratee) const =0
 
virtual bool for_each_tippy_child_impl (const net_handle_t &parent, const std::function< bool(const net_handle_t &)> &iteratee) const
 
virtual bool for_each_traversal_start_impl (const net_handle_t &traversal, const std::function< bool(const net_handle_t &)> &iteratee) const
 
virtual bool for_each_traversal_end_impl (const net_handle_t &traversal, const std::function< bool(const net_handle_t &)> &iteratee) const
 

Member Enumeration Documentation

◆ endpoint_t

Represents a place that a traversal can start or end. Traversals can start or end at the start, end, or an internal tip of the thing they traverse.

Enumerator
START 
END 
TIP 

Constructor & Destructor Documentation

◆ ~SnarlDecomposition()

virtual handlegraph::SnarlDecomposition::~SnarlDecomposition ( )
virtualdefault

Member Function Documentation

◆ canonical()

virtual net_handle_t handlegraph::SnarlDecomposition::canonical ( const net_handle_t net) const
pure virtual

Get a canonical traversal handle from any net handle. All handles to the same net graph element have the same canonical traversal. That canonical traversal must be realizable, and might not always be start-to-end or even consistently be the same kind of traversal for different snarls, chains, or nodes. Mostly useful to normalize for equality comparisons.

◆ ends_at()

virtual endpoint_t handlegraph::SnarlDecomposition::ends_at ( const net_handle_t traversal) const
pure virtual

Return the kind of location at which the given traversal ends.

◆ ends_at_end()

bool handlegraph::SnarlDecomposition::ends_at_end ( const net_handle_t net) const
inline

Return true if the given net handle describes a category of traversal that ends at the local end of the snarl/chain/node.

◆ ends_at_start()

bool handlegraph::SnarlDecomposition::ends_at_start ( const net_handle_t net) const
inline

Return true if the given net handle describes a category of traversal that ends at the local start of the snarl/chain/node.

◆ ends_at_tip()

bool handlegraph::SnarlDecomposition::ends_at_tip ( const net_handle_t net) const
inline

Return true if the given net handle describes a category of traversal that ends at the an internal tip in the snarl/chain. Never true for nodes.

◆ flip()

virtual net_handle_t handlegraph::SnarlDecomposition::flip ( const net_handle_t net) const
pure virtual

Return a net handle to the same snarl/chain/node in the opposite orientation. No effect on tip-to-tip, start-to-start, or end-to-end net handles. Flips all the others.

◆ follow_net_edges()

template<typename Iteratee >
bool handlegraph::SnarlDecomposition::follow_net_edges ( const net_handle_t here,
const HandleGraph graph,
bool  go_left,
const Iteratee &  iteratee 
) const

Given a net handle to a traversal of a snarl, chain, or node, iterate over all kinds of traversals of all snarls, chains, or nodes that are reachable by going either left or right from the given traversal.

Does not check to see if the given traversal is possible given the internal connectivity of a snarl or chain being traversed.

Does not leave a chain; looking form a node traversal out the end of its chain will produce nothing.

Produces and accepts snarl start and end sentinels, and does not leave a snarl.

If you do want to leave a snarl or a chain, jump up to the parent with get_parent_traversal().

◆ follow_net_edges_impl()

virtual bool handlegraph::SnarlDecomposition::follow_net_edges_impl ( const net_handle_t here,
const HandleGraph graph,
bool  go_left,
const std::function< bool(const net_handle_t &)> &  iteratee 
) const
protectedpure virtual

Internal implementation for follow_net_edges.

◆ for_each_child()

template<typename Iteratee >
bool handlegraph::SnarlDecomposition::for_each_child ( const net_handle_t parent,
const Iteratee &  iteratee 
) const

Loop over the child snarls and nodes of a chain, or the child chains of a snarl. If the parent is a chain and is in start-to-end or end-to-start order, children are produced in the order and orientation they are encountered when viewing the chain that way. Otherwise, children are produced in arbitrary order and start-to-end orientation, even if that is not actually a realizable traversal of a snarl or chain.

Return false from the iteratee to stop, or void or true to keep going. Returns false if iteration was stopped early, and true otherwise.

◆ for_each_child_impl()

virtual bool handlegraph::SnarlDecomposition::for_each_child_impl ( const net_handle_t traversal,
const std::function< bool(const net_handle_t &)> &  iteratee 
) const
protectedpure virtual

Internal implementation for for_each_child.

◆ for_each_tippy_child()

template<typename Iteratee >
bool handlegraph::SnarlDecomposition::for_each_tippy_child ( const net_handle_t parent,
const Iteratee &  iteratee 
) const

Execute a function on each realizable traversal of a child of the given snarl or chain that begins with an internal tip. Traversals that end with tips are obtained by flipping the results.

TODO: allow to be restricted to those that can e.g. reach the start or end of the parent, or another internal tip.

◆ for_each_tippy_child_impl()

bool handlegraph::SnarlDecomposition::for_each_tippy_child_impl ( const net_handle_t parent,
const std::function< bool(const net_handle_t &)> &  iteratee 
) const
protectedvirtual

Internal implementation for for_each_tippy_child.

◆ for_each_traversal()

template<typename Iteratee >
bool handlegraph::SnarlDecomposition::for_each_traversal ( const net_handle_t item,
const Iteratee &  iteratee 
) const

Given a net handle to any type of traversal of a snarl, chain, or node, loop over only the types of traversals that are possible. Produces a net handle to the same snarl, chain, or node for each possible combination of traversal starts and ends (start, end, or internal tip) that is permitted by the internal connectivity of the snarl, chain, or node.

Return false from the iteratee to stop, or void or true to keep going. Returns false if iteration was stopped early, and true otherwise.

◆ for_each_traversal_end()

template<typename Iteratee >
bool handlegraph::SnarlDecomposition::for_each_traversal_end ( const net_handle_t traversal,
const Iteratee &  iteratee 
) const

Loop over all the child net graph item traversals that could potentially end the given traversal. For traversals ending at tips, no guarantee is made that there is a path to the yielded traversals from the overall traversal's initial position.

◆ for_each_traversal_end_impl()

bool handlegraph::SnarlDecomposition::for_each_traversal_end_impl ( const net_handle_t traversal,
const std::function< bool(const net_handle_t &)> &  iteratee 
) const
protectedvirtual

Internal implementation for for_each_traversal_end.

◆ for_each_traversal_impl()

virtual bool handlegraph::SnarlDecomposition::for_each_traversal_impl ( const net_handle_t item,
const std::function< bool(const net_handle_t &)> &  iteratee 
) const
protectedpure virtual

Internal implementation for for_each_traversal.

◆ for_each_traversal_start()

template<typename Iteratee >
bool handlegraph::SnarlDecomposition::for_each_traversal_start ( const net_handle_t traversal,
const Iteratee &  iteratee 
) const

Loop over all the child net graph item traversals that could potentially start the given traversal. For traversals starting at tips, no guarantee is made that there is a path from the yielded traversals to the overall traversal's final destination.

◆ for_each_traversal_start_impl()

bool handlegraph::SnarlDecomposition::for_each_traversal_start_impl ( const net_handle_t traversal,
const std::function< bool(const net_handle_t &)> &  iteratee 
) const
protectedvirtual

Internal implementation for for_each_traversal_start.

◆ get_bound()

virtual net_handle_t handlegraph::SnarlDecomposition::get_bound ( const net_handle_t snarl,
bool  get_end,
bool  face_in 
) const
pure virtual

Get the bounding handle for the snarl or chain referenced by the given net handle, getting the start or end facing in or out as appropriate.

For snarls, returns the bounding sentinel net handles. For chains, returns net handles for traversals of the bounding nodes of the chain.

Ignores traversal type.

May not be called on traversals of individual nodes.

◆ get_end_bound()

net_handle_t handlegraph::SnarlDecomposition::get_end_bound ( const net_handle_t parent) const
inline

Get a handle to the outward-facing traversal of the last node in a chain or the end boundary in a snarl.

This isn't necessarily where the traversal specified by the given handle actually ends (it may be start to start or tip to tip, for example).

◆ get_handle()

virtual handle_t handlegraph::SnarlDecomposition::get_handle ( const net_handle_t net,
const HandleGraph graph 
) const
pure virtual

For a net handle to a traversal of a single node, get the handle for that node in the orientation it is traversed. May not be called for other net handles.

◆ get_net()

virtual net_handle_t handlegraph::SnarlDecomposition::get_net ( const handle_t handle,
const HandleGraph graph 
) const
pure virtual

Turn a handle to an oriented node into a net handle for a start-to-end or end-to-start traversal of the node, as appropriate.

◆ get_parent()

virtual net_handle_t handlegraph::SnarlDecomposition::get_parent ( const net_handle_t child) const
pure virtual

Get the parent snarl of a chain, or the parent chain of a snarl or node. If the child is start-to-end or end-to-start, and the parent is a chain, the chain comes out facing the same way, accounting for the relative orientation of the child snarl or node in the chain. Otherwise, everything is produced as start-to-end, even if that is not actually a realizable traversal of a snarl or chain. May not be called on the root snarl.

Also works on snarl boundary sentinels.

◆ get_parent_traversal()

virtual net_handle_t handlegraph::SnarlDecomposition::get_parent_traversal ( const net_handle_t traversal_start,
const net_handle_t traversal_end 
) const
pure virtual

Get a net handle for traversals of a the snarl or chain that contains the given oriented bounding node traversals or sentinels. Given two sentinels for a snarl, produces a net handle to a start-to-end, end-to-end, end-to-start, or start-to-start traversal of that snarl. Given handles to traversals of the bounding nodes of a chain, similarly produces a net handle to a traversal of the chain.

For a chain, either or both handles can also be a snarl containing tips, for a tip-to-start, tip-to-end, start-to-tip, end-to-tip, or tip-to-tip traversal. Similarly, for a snarl, either or both handles can be a chain in the snarl that contains internal tips, or that has no edges on the appropriate end.

May only be called if a path actually exists between the given start and end.

◆ get_root()

virtual net_handle_t handlegraph::SnarlDecomposition::get_root ( ) const
pure virtual

Get a net handle referring to a tip-to-tip traversal of the contents of the root snarl. TODO: Special handling for circular things in the root snarl? Circular traversal type?

◆ get_start_bound()

net_handle_t handlegraph::SnarlDecomposition::get_start_bound ( const net_handle_t parent) const
inline

Get a handle to the inward-facing traversal of the first node in a chain or the start boundary in a snarl.

This isn't necessarily where the traversal specified by the given handle actually starts (it may be end to end or tip to tip, for example).

◆ is_chain()

virtual bool handlegraph::SnarlDecomposition::is_chain ( const net_handle_t net) const
pure virtual

Returns true if the given net handle refers to (a traversal of) a chain.

◆ is_node()

virtual bool handlegraph::SnarlDecomposition::is_node ( const net_handle_t net) const
pure virtual

Returns true if the given net handle refers to (a traversal of) a single node, and thus has a corresponding handle_t.

◆ is_root()

virtual bool handlegraph::SnarlDecomposition::is_root ( const net_handle_t net) const
pure virtual

Return true if the given handle refers to (a traversal of) the root snarl, and false otherwise.

◆ is_sentinel()

virtual bool handlegraph::SnarlDecomposition::is_sentinel ( const net_handle_t net) const
pure virtual

Return true if the given net handle is a snarl bound sentinel (in either inward or outward orientation), and false otherwise.

◆ is_snarl()

virtual bool handlegraph::SnarlDecomposition::is_snarl ( const net_handle_t net) const
pure virtual

Returns true if the given net handle refers to (a traversal of) a snarl.

◆ starts_at()

virtual endpoint_t handlegraph::SnarlDecomposition::starts_at ( const net_handle_t traversal) const
pure virtual

Return the kind of location at which the given traversal starts.

◆ starts_at_end()

bool handlegraph::SnarlDecomposition::starts_at_end ( const net_handle_t net) const
inline

Return true if the given net handle describes a category of traversal that starts at the local end of the snarl/chain/node.

◆ starts_at_start()

bool handlegraph::SnarlDecomposition::starts_at_start ( const net_handle_t net) const
inline

Return true if the given net handle describes a category of traversal that starts at the local start of the snarl/chain/node.

◆ starts_at_tip()

bool handlegraph::SnarlDecomposition::starts_at_tip ( const net_handle_t net) const
inline

Return true if the given net handle describes a category of traversal that starts at an internal tip in the snarl/chain. Never true for nodes.


The documentation for this class was generated from the following files: