vg
tools for working with variation graphs
|
#include <xg.hpp>
Public Member Functions | |
XG (void)=default | |
~XG (void) | |
XG (const XG &other)=delete | |
XG (XG &&other)=delete | |
XG & | operator= (const XG &other)=delete |
XG & | operator= (XG &&other)=delete |
void | from_handle_graph (const HandleGraph &graph) |
build the graph from another simple graph More... | |
void | from_path_handle_graph (const PathHandleGraph &graph) |
build the graph from another path handle graph More... | |
void | from_enumerators (const std::function< void(const std::function< void(const std::string &seq, const nid_t &node_id)> &)> &for_each_sequence, const std::function< void(const std::function< void(const nid_t &from, const bool &from_rev, const nid_t &to, const bool &to_rev)> &)> &for_each_edge, const std::function< void(const std::function< void(const std::string &path_name, const nid_t &node_id, const bool &is_rev, const std::string &cigar, const bool &is_empty, const bool &is_circular)> &)> &for_each_path_element, bool validate=false, std::string basename="") |
void | from_gfa (const std::string &gfa_filename, bool validate=false, std::string basename="") |
Use a memory-mapped GFA file to build the index in low memory. More... | |
void | to_gfa (std::ostream &out) const |
uint32_t | get_magic_number (void) const |
Get the magic number used to prefix serialized streams. More... | |
size_t | serialize_and_measure (std::ostream &out, sdsl::structure_tree_node *s=nullptr, std::string name="") const |
Like serialize() (inherited from SerializableHandleGraph) but logs internal member sizes and returns total size. More... | |
void | dump_to_stream (std::ostream &out) const |
Dump information about the XG to the given stream for debugging. More... | |
virtual handle_t | get_handle (const nid_t &node_id, bool is_reverse=false) const |
Look up the handle for the node with the given ID in the given orientation. More... | |
virtual nid_t | get_id (const handle_t &handle) const |
Get the ID from a handle. More... | |
virtual bool | has_node (nid_t node_id) const |
If the node with the given id exists. More... | |
virtual bool | get_is_reverse (const handle_t &handle) const |
Get the orientation of a handle. More... | |
virtual handle_t | flip (const handle_t &handle) const |
Invert the orientation of a handle (potentially without getting its ID) More... | |
virtual size_t | get_length (const handle_t &handle) const |
Get the length of a node. More... | |
virtual std::string | get_sequence (const handle_t &handle) const |
virtual bool | follow_edges_impl (const handle_t &handle, bool go_left, const std::function< bool(const handle_t &)> &iteratee) const |
virtual bool | for_each_handle_impl (const std::function< bool(const handle_t &)> &iteratee, bool parallel=false) const |
virtual size_t | get_node_count () const |
Return the number of nodes in the graph. More... | |
virtual size_t | get_edge_count () const |
Return the number of edges in the graph. More... | |
virtual size_t | get_total_length () const |
Return the number of bases in the graph. More... | |
virtual nid_t | min_node_id () const |
Get the minimum node ID used in the graph, if any are used. More... | |
virtual nid_t | max_node_id () const |
Get the maximum node ID used in the graph, if any are used. More... | |
virtual char | get_base (const handle_t &handle, size_t index) const |
virtual std::string | get_subsequence (const handle_t &handle, size_t index, size_t size) const |
size_t | get_path_count (void) const |
Returns the number of paths stored in the graph. More... | |
bool | has_path (const std::string &path_name) const |
Determine if a path with a given name exists. More... | |
path_handle_t | get_path_handle (const std::string &path_name) const |
Look up the path handle for the given path name. More... | |
std::string | get_path_name (const path_handle_t &path_handle) const |
Look up the name of a path from a handle to it. More... | |
bool | get_is_circular (const path_handle_t &path_handle) const |
Look up whether a path is circular. More... | |
size_t | get_step_count (const path_handle_t &path_handle) const |
Returns the number of node steps in the path. More... | |
size_t | get_path_length (const path_handle_t &path_handle) const |
Returns the total length of sequence in the path. More... | |
handle_t | get_handle_of_step (const step_handle_t &step_handle) const |
Get a node handle (node ID and orientation) from a handle to a step on a path. More... | |
path_handle_t | get_path_handle_of_step (const step_handle_t &step_handle) const |
Returns a handle to the path that an step is on. More... | |
step_handle_t | path_begin (const path_handle_t &path_handle) const |
step_handle_t | path_end (const path_handle_t &path_handle) const |
step_handle_t | path_back (const path_handle_t &path_handle) const |
step_handle_t | path_front_end (const path_handle_t &path_handle) const |
bool | has_next_step (const step_handle_t &step_handle) const |
Returns true if the step is not the last step in a non-circular path. More... | |
bool | has_previous_step (const step_handle_t &step_handle) const |
Returns true if the step is not the first step in a non-circular path. More... | |
step_handle_t | get_next_step (const step_handle_t &step_handle) const |
step_handle_t | get_previous_step (const step_handle_t &step_handle) const |
bool | for_each_path_handle_impl (const std::function< bool(const path_handle_t &)> &iteratee) const |
Execute a function on each path in the graph. More... | |
bool | for_each_step_on_handle_impl (const handle_t &handle, const std::function< bool(const step_handle_t &)> &iteratee) const |
Executes a function on each step of a handle in any path. More... | |
size_t | get_position_of_step (const step_handle_t &step) const |
Gets the position of a given step in the path it's from. More... | |
step_handle_t | get_step_at_position (const path_handle_t &path, const size_t &position) const |
Get the step at a given position. More... | |
size_t | id_to_rank (const nid_t &id) const |
id to rank helper function More... | |
size_t | handle_rank (const handle_t &handle) const |
nid_t | rank_to_id (const size_t &rank) const |
rank to id helper function More... | |
size_t | max_node_rank (void) const |
size_t | node_vector_offset (const nid_t &id) const |
nid_t | node_at_vector_offset (const size_t &offset) const |
Return the node overlapping the given offset in the implicit node vector. More... | |
size_t | max_path_rank (void) const |
size_t | node_graph_idx (const nid_t &id) const |
const XGPath & | get_path (const std::string &name) const |
std::string | path_name (const size_t &rank) const |
std::vector< size_t > | path_ranks_by_prefix (const std::string &prefix) const |
std::vector< std::string > | path_names_by_prefix (const std::string &prefix) const |
std::vector< path_handle_t > | paths_of_handle (const handle_t &handle) const |
bool | path_contains_handle (const std::string &name, const handle_t &handle) const |
std::pair< pos_t, int64_t > | next_path_position (const pos_t &pos, const int64_t &max_search) const |
std::pair< nid_t, std::vector< path_handle_t > > | nearest_path_node (const nid_t &id, int64_t max_steps=16) const |
int64_t | min_approx_path_distance (const nid_t &id1, const nid_t &id2) const |
std::vector< size_t > | position_in_path (const handle_t &handle, const path_handle_t &path) const |
std::unordered_map< path_handle_t, std::vector< size_t > > | position_in_paths (const handle_t &handle, const size_t &offset) const |
void | for_path_range (const std::string &name, int64_t start, int64_t stop, std::function< void(const handle_t &)> lambda, bool is_rev) const |
std::unordered_map< path_handle_t, std::vector< std::pair< size_t, bool > > > | offsets_in_paths (const pos_t &gpos) const |
std::unordered_map< path_handle_t, std::vector< std::pair< size_t, bool > > > | nearest_offsets_in_paths (const pos_t &pos, int64_t max_search) const |
handle_t | handle_at_path_position (const path_handle_t &path, size_t pos) const |
size_t | node_start_at_path_position (const path_handle_t &path, size_t pos) const |
pos_t | graph_pos_at_path_position (const path_handle_t &path, size_t path_pos) const |
pos_t | graph_pos_at_path_position (const std::string &name, size_t path_pos) const |
char | pos_char (nid_t id, bool is_rev, size_t off) const |
std::string | pos_substr (nid_t id, bool is_rev, size_t off, size_t len) const |
size_t | edge_index (const edge_t &edge) const |
Return a unique index among edges in the graph. More... | |
size_t | get_g_iv_size (void) const |
Public Member Functions inherited from handlegraph::PathPositionHandleGraph | |
virtual | ~PathPositionHandleGraph ()=default |
virtual bool | for_each_step_position_on_handle (const handle_t &handle, const std::function< bool(const step_handle_t &, const bool &, const size_t &)> &iteratee) const |
Public Member Functions inherited from handlegraph::PathHandleGraph | |
virtual | ~PathHandleGraph ()=default |
virtual size_t | get_step_count (const handle_t &handle) const |
Returns the number of node steps on a handle. More... | |
template<typename Iteratee > | |
bool | for_each_path_handle (const Iteratee &iteratee) const |
template<typename Iteratee > | |
bool | for_each_step_on_handle (const handle_t &handle, const Iteratee &iteratee) const |
virtual std::vector< step_handle_t > | steps_of_handle (const handle_t &handle, bool match_orientation=false) const |
virtual bool | is_empty (const path_handle_t &path_handle) const |
Returns true if the given path is empty, and false otherwise. More... | |
PathForEachSocket | scan_path (const path_handle_t &path) const |
template<typename Iteratee > | |
bool | for_each_step_in_path (const path_handle_t &path, const Iteratee &iteratee) const |
Public Member Functions inherited from handlegraph::HandleGraph | |
virtual | ~HandleGraph ()=default |
template<typename Iteratee > | |
bool | follow_edges (const handle_t &handle, bool go_left, const Iteratee &iteratee) const |
template<typename Iteratee > | |
bool | for_each_handle (const Iteratee &iteratee, bool parallel=false) const |
virtual size_t | get_degree (const handle_t &handle, bool go_left) const |
virtual bool | has_edge (const handle_t &left, const handle_t &right) const |
bool | has_edge (const edge_t &edge) const |
Convenient wrapper of has_edge for edge_t argument. More... | |
handle_t | forward (const handle_t &handle) const |
Get the locally forward version of a handle. More... | |
edge_t | edge_handle (const handle_t &left, const handle_t &right) const |
handle_t | traverse_edge_handle (const edge_t &edge, const handle_t &left) const |
template<typename Iteratee > | |
bool | for_each_edge (const Iteratee &iteratee, bool parallel=false) const |
Public Member Functions inherited from handlegraph::PathMetadata | |
virtual | ~PathMetadata ()=default |
virtual PathSense | get_sense (const path_handle_t &handle) const |
What is the given path meant to be representing? More... | |
virtual std::string | get_sample_name (const path_handle_t &handle) const |
virtual std::string | get_locus_name (const path_handle_t &handle) const |
virtual size_t | get_haplotype (const path_handle_t &handle) const |
virtual size_t | get_phase_block (const path_handle_t &handle) const |
virtual subrange_t | get_subrange (const path_handle_t &handle) const |
template<typename Iteratee > | |
bool | for_each_path_of_sense (const PathSense &sense, const Iteratee &iteratee) const |
template<typename Iteratee > | |
bool | for_each_path_of_sample (const std::string &sample, const Iteratee &iteratee) const |
template<typename Iteratee > | |
bool | for_each_path_matching (const std::unordered_set< PathSense > *senses, const std::unordered_set< std::string > *samples, const std::unordered_set< std::string > *loci, const Iteratee &iteratee) const |
template<typename Iteratee > | |
bool | for_each_path_matching (const std::unordered_set< PathSense > &senses, const std::unordered_set< std::string > &samples, const std::unordered_set< std::string > &loci, const Iteratee &iteratee) const |
template<typename Iteratee > | |
bool | for_each_step_of_sense (const handle_t &visited, const PathSense &sense, const Iteratee &iteratee) const |
Public Member Functions inherited from handlegraph::Serializable | |
virtual | ~Serializable ()=default |
virtual void | serialize (std::ostream &out) const |
virtual void | serialize (const std::string &filename) const |
virtual void | deserialize (std::istream &in) |
virtual void | deserialize (const std::string &filename) |
virtual void | serialize (std::ostream &out) |
virtual void | serialize (const std::string &filename) |
Public Member Functions inherited from handlegraph::VectorizableHandleGraph | |
virtual | ~VectorizableHandleGraph ()=default |
Public Member Functions inherited from handlegraph::RankedHandleGraph | |
virtual size_t | handle_to_rank (const handle_t &handle) const |
virtual handle_t | rank_to_handle (const size_t &rank) const |
Return the handle with a given rank. More... | |
Public Attributes | |
size_t | seq_length = 0 |
size_t | node_count = 0 |
size_t | edge_count = 0 |
size_t | path_count = 0 |
Static Public Attributes | |
const static uint32_t | CURRENT_VERSION = 16 |
static const char | path_name_csa_delim = '$' |
static const char | old_version_path_name_start = '#' |
static const char | old_version_path_name_end = '$' |
Static Public Attributes inherited from handlegraph::PathMetadata | |
static const std::string | NO_SAMPLE_NAME = "" |
static const std::string | NO_LOCUS_NAME = "" |
static const size_t | NO_HAPLOTYPE = std::numeric_limits<size_t>::max() |
static const size_t | NO_PHASE_BLOCK = std::numeric_limits<size_t>::max() |
static const subrange_t | NO_SUBRANGE {PathMetadata::NO_END_POSITION, PathMetadata::NO_END_POSITION} |
static const offset_t | NO_END_POSITION = std::numeric_limits<offset_t>::max() |
Protected Member Functions | |
void | deserialize_members (std::istream &in) |
void | serialize_members (std::ostream &out) const |
Write the XG's contents to a stream aready prefixed with a magic number. More... | |
size_t | serialize_members_and_measure (std::ostream &out, sdsl::structure_tree_node *s=nullptr, std::string name="") const |
Like serialize_members() but logs internal member sizes and returns total size. More... | |
Protected Member Functions inherited from handlegraph::PathMetadata | |
virtual bool | for_each_path_matching_impl (const std::unordered_set< PathSense > *senses, const std::unordered_set< std::string > *samples, const std::unordered_set< std::string > *loci, const std::function< bool(const path_handle_t &)> &iteratee) const |
virtual bool | for_each_step_of_sense_impl (const handle_t &visited, const PathSense &sense, const std::function< bool(const step_handle_t &)> &iteratee) const |
Private Member Functions | |
void | orientation_from_old_edge_type (int type, bool &from_rev, bool &to_rev) const |
void | reencode_old_g_vector (const sdsl::int_vector<> &old_g_iv, const sdsl::rank_support_v< 1 > &old_g_bv_rank) |
void | index_path_names () |
void | index_node_to_path (const std::string &basename) |
void | print_graph () const |
Static Private Member Functions | |
static bool | edge_orientation (const uint64_t &raw_edge) |
static int64_t | edge_relative_offset (const uint64_t &raw_edge) |
static uint64_t | encode_edge (const size_t &offest_from, const size_t &offest_to, const bool &to_rev) |
Private Attributes | |
sdsl::int_vector | g_iv |
sdsl::bit_vector | g_bv |
delimit node records to allow lookup of nodes in g_civ by rank More... | |
sdsl::rank_support_v< 1 > | g_bv_rank |
sdsl::bit_vector::select_1_type | g_bv_select |
sdsl::int_vector | s_iv |
sdsl::bit_vector | s_bv |
sdsl::rank_support_v< 1 > | s_bv_rank |
sdsl::bit_vector::select_1_type | s_bv_select |
nid_t | min_id = 0 |
nid_t | max_id = 0 |
sdsl::int_vector | r_iv |
sdsl::int_vector | pn_iv |
sdsl::csa_wt | pn_csa |
sdsl::bit_vector | pn_bv |
sdsl::rank_support_v< 1 > | pn_bv_rank |
sdsl::bit_vector::select_1_type | pn_bv_select |
sdsl::int_vector | pi_iv |
std::vector< XGPath * > | paths |
sdsl::int_vector | np_iv |
sdsl::int_vector | nr_iv |
sdsl::int_vector | nx_iv |
sdsl::bit_vector | np_bv |
sdsl::bit_vector::select_1_type | np_bv_select |
Static Private Attributes | |
const static int | G_NODE_ID_OFFSET = 0 |
const static int | G_NODE_SEQ_START_OFFSET = 1 |
const static int | G_NODE_LENGTH_OFFSET = 2 |
const static int | G_NODE_LEFT_COUNT_OFFSET = 3 |
const static int | G_NODE_RIGHT_COUNT_OFFSET = 4 |
const static int | G_NODE_HEADER_LENGTH = 5 |
const static int | OLD_G_NODE_TO_COUNT_OFFSET = 3 |
const static int | OLD_G_NODE_FROM_COUNT_OFFSET = 4 |
const static int | OLD_G_EDGE_OFFSET_OFFSET = 0 |
const static int | OLD_G_EDGE_TYPE_OFFSET = 1 |
const static int | OLD_G_EDGE_LENGTH = 2 |
const static int | OLD_EDGE_TYPE_MIN = 1 |
const static int | OLD_EDGE_TYPE_END_START = 1 |
const static int | OLD_EDGE_TYPE_END_END = 2 |
const static int | OLD_EDGE_TYPE_START_START = 3 |
const static int | OLD_EDGE_TYPE_START_END = 4 |
const static int | OLD_EDGE_TYPE_MAX = 4 |
Additional Inherited Members | |
Static Public Member Functions inherited from handlegraph::PathMetadata | |
static PathSense | parse_sense (const std::string &path_name) |
static std::string | parse_sample_name (const std::string &path_name) |
static std::string | parse_locus_name (const std::string &path_name) |
static size_t | parse_haplotype (const std::string &path_name) |
static size_t | parse_phase_block (const std::string &path_name) |
static subrange_t | parse_subrange (const std::string &path_name) |
static void | parse_path_name (const std::string &path_name, PathSense &sense, std::string &sample, std::string &locus, size_t &haplotype, size_t &phase_block, subrange_t &subrange) |
Decompose a formatted path name into metadata. More... | |
static std::string | create_path_name (const PathSense &sense, const std::string &sample, const std::string &locus, const size_t &haplotype, const size_t &phase_block, const subrange_t &subrange) |
Provides succinct storage for a graph, its positional paths, and a set of embedded threads.
|
default |
xg::XG::~XG | ( | void | ) |
|
delete |
|
delete |
|
protectedvirtual |
Load this XG index from a stream from which the magic number has already been read. Throw an XGFormatError if the stream does not produce a valid XG file.
Implements handlegraph::Serializable.
void xg::XG::dump_to_stream | ( | std::ostream & | out | ) | const |
Dump information about the XG to the given stream for debugging.
|
virtual |
Return a unique index among edges in the graph.
Implements handlegraph::VectorizableHandleGraph.
|
staticprivate |
|
staticprivate |
|
staticprivate |
Invert the orientation of a handle (potentially without getting its ID)
Implements handlegraph::HandleGraph.
|
virtual |
Loop over all the handles to next/previous (right/left) nodes. Passes them to a callback which returns false to stop iterating and true to continue.
Implements handlegraph::HandleGraph.
|
virtual |
Loop over all the nodes in the graph in their local forward orientations, in their internal stored order. Stop if the iteratee returns false.
Implements handlegraph::HandleGraph.
|
virtual |
Execute a function on each path in the graph.
Implements handlegraph::PathHandleGraph.
|
virtual |
Executes a function on each step of a handle in any path.
Implements handlegraph::PathHandleGraph.
void xg::XG::for_path_range | ( | const std::string & | name, |
int64_t | start, | ||
int64_t | stop, | ||
std::function< void(const handle_t &)> | lambda, | ||
bool | is_rev | ||
) | const |
void xg::XG::from_enumerators | ( | const std::function< void(const std::function< void(const std::string &seq, const nid_t &node_id)> &)> & | for_each_sequence, |
const std::function< void(const std::function< void(const nid_t &from, const bool &from_rev, const nid_t &to, const bool &to_rev)> &)> & | for_each_edge, | ||
const std::function< void(const std::function< void(const std::string &path_name, const nid_t &node_id, const bool &is_rev, const std::string &cigar, const bool &is_empty, const bool &is_circular)> &)> & | for_each_path_element, | ||
bool | validate = false , |
||
std::string | basename = "" |
||
) |
Use external enumerators to drive graph construction. The order in which nodes are enumerated becomes the XG's node order. Note that we will get the best efficiency if the graph is enumerated in topological order.
void xg::XG::from_gfa | ( | const std::string & | gfa_filename, |
bool | validate = false , |
||
std::string | basename = "" |
||
) |
Use a memory-mapped GFA file to build the index in low memory.
void xg::XG::from_handle_graph | ( | const HandleGraph & | graph | ) |
build the graph from another simple graph
Build the graph from another simple graph. The order in which nodes are enumerated becomes the XG's node order. Note that we will get the best efficiency if the graph enumerates itself in topological order.
void xg::XG::from_path_handle_graph | ( | const PathHandleGraph & | graph | ) |
build the graph from another path handle graph
Build the graph from another path handle graph. The order in which nodes are enumerated becomes the XG's node order. Note that we will get the best efficiency if the graph enumerates itself in topological order.
|
virtual |
Returns one base of a handle's sequence, in the orientation of the handle.
Reimplemented from handlegraph::HandleGraph.
|
virtual |
Return the number of edges in the graph.
Reimplemented from handlegraph::HandleGraph.
size_t xg::XG::get_g_iv_size | ( | void | ) | const |
Look up the handle for the node with the given ID in the given orientation.
Implements handlegraph::HandleGraph.
|
virtual |
Get a node handle (node ID and orientation) from a handle to a step on a path.
Implements handlegraph::PathHandleGraph.
Get the ID from a handle.
Implements handlegraph::HandleGraph.
|
virtual |
Look up whether a path is circular.
Implements handlegraph::PathHandleGraph.
|
virtual |
Get the orientation of a handle.
Implements handlegraph::HandleGraph.
|
virtual |
Get the length of a node.
Implements handlegraph::HandleGraph.
|
virtual |
Get the magic number used to prefix serialized streams.
Implements handlegraph::Serializable.
|
virtual |
Returns a handle to the next step on the path. If the given step is the final step of a non-circular path, returns the past-the-last step that is also returned by path_end. In a circular path, the "last" step will loop around to the "first" (i.e. the one returned by path_begin). Note: to iterate over each step one time, even in a circular path, consider for_each_step_in_path.
Implements handlegraph::PathHandleGraph.
|
virtual |
Return the number of nodes in the graph.
Implements handlegraph::HandleGraph.
const XGPath& xg::XG::get_path | ( | const std::string & | name | ) | const |
|
virtual |
Returns the number of paths stored in the graph.
Implements handlegraph::PathHandleGraph.
|
virtual |
Look up the path handle for the given path name.
Implements handlegraph::PathHandleGraph.
|
virtual |
Returns a handle to the path that an step is on.
Implements handlegraph::PathHandleGraph.
|
virtual |
Returns the total length of sequence in the path.
Implements handlegraph::PathPositionHandleGraph.
|
virtual |
Look up the name of a path from a handle to it.
Implements handlegraph::PathHandleGraph.
|
virtual |
Gets the position of a given step in the path it's from.
Implements handlegraph::PathPositionHandleGraph.
|
virtual |
Returns a handle to the previous step on the path. If the given step is the first step of a non-circular path, this method has undefined behavior. In a circular path, it will loop around from the "first" step (i.e. the one returned by path_begin) to the "last" step. Note: to iterate over each step one time, even in a circular path, consider for_each_step_in_path.
Implements handlegraph::PathHandleGraph.
|
virtual |
Get the sequence of a node, presented in the handle's local forward orientation.
Implements handlegraph::HandleGraph.
|
virtual |
Get the step at a given position.
Implements handlegraph::PathPositionHandleGraph.
|
virtual |
Returns the number of node steps in the path.
Implements handlegraph::PathHandleGraph.
|
virtual |
Returns a substring of a handle's sequence, in the orientation of the handle. If the indicated substring would extend beyond the end of the handle's sequence, the return value is truncated to the sequence's end.
Reimplemented from handlegraph::HandleGraph.
|
virtual |
Return the number of bases in the graph.
Reimplemented from handlegraph::HandleGraph.
pos_t xg::XG::graph_pos_at_path_position | ( | const path_handle_t & | path, |
size_t | path_pos | ||
) | const |
pos_t xg::XG::graph_pos_at_path_position | ( | const std::string & | name, |
size_t | path_pos | ||
) | const |
handle_t xg::XG::handle_at_path_position | ( | const path_handle_t & | path, |
size_t | pos | ||
) | const |
size_t xg::XG::handle_rank | ( | const handle_t & | handle | ) | const |
|
virtual |
Returns true if the step is not the last step in a non-circular path.
Implements handlegraph::PathHandleGraph.
|
virtual |
If the node with the given id exists.
Implements handlegraph::HandleGraph.
|
virtual |
Determine if a path with a given name exists.
Implements handlegraph::PathHandleGraph.
|
virtual |
Returns true if the step is not the first step in a non-circular path.
Implements handlegraph::PathHandleGraph.
|
virtual |
id to rank helper function
Implements handlegraph::RankedHandleGraph.
|
private |
|
private |
|
virtual |
Get the maximum node ID used in the graph, if any are used.
Implements handlegraph::HandleGraph.
size_t xg::XG::max_node_rank | ( | void | ) | const |
size_t xg::XG::max_path_rank | ( | void | ) | const |
|
virtual |
Get the minimum node ID used in the graph, if any are used.
Implements handlegraph::HandleGraph.
std::unordered_map< path_handle_t, std::vector< std::pair< size_t, bool > > > xg::XG::nearest_offsets_in_paths | ( | const pos_t & | pos, |
int64_t | max_search | ||
) | const |
std::pair< nid_t, std::vector< path_handle_t > > xg::XG::nearest_path_node | ( | const nid_t & | id, |
int64_t | max_steps = 16 |
||
) | const |
std::pair< pos_t, int64_t > xg::XG::next_path_position | ( | const pos_t & | pos, |
const int64_t & | max_search | ||
) | const |
|
virtual |
Return the node overlapping the given offset in the implicit node vector.
Implements handlegraph::VectorizableHandleGraph.
size_t xg::XG::node_graph_idx | ( | const nid_t & | id | ) | const |
size_t xg::XG::node_start_at_path_position | ( | const path_handle_t & | path, |
size_t | pos | ||
) | const |
|
virtual |
Return the start position of the node in a (possibly implict) sorted array constructed from the concatenation of the node sequences
Implements handlegraph::VectorizableHandleGraph.
std::unordered_map< path_handle_t, std::vector< std::pair< size_t, bool > > > xg::XG::offsets_in_paths | ( | const pos_t & | gpos | ) | const |
|
private |
|
virtual |
Get a handle to the last step, which will be an arbitrary step in a circular path that we consider "last" based on our construction of the path. If the path is empty then the implementation must return the same value as path_front_end().
Implements handlegraph::PathHandleGraph.
|
virtual |
Get a handle to the first step, or in a circular path to an arbitrary step considered "first". If the path is empty, returns the past-the-last step returned by path_end.
Implements handlegraph::PathHandleGraph.
bool xg::XG::path_contains_handle | ( | const std::string & | name, |
const handle_t & | handle | ||
) | const |
|
virtual |
Get a handle to a fictitious position past the end of a path. This position is return by get_next_step for the final step in a path in a non-circular path. Note that get_next_step will NEVER return this value for a circular path.
Implements handlegraph::PathHandleGraph.
|
virtual |
Get a handle to a fictitious position before the beginning of a path. This position is return by get_previous_step for the first step in a path in a non-circular path. Note: get_previous_step will NEVER return this value for a circular path.
Implements handlegraph::PathHandleGraph.
std::string xg::XG::path_name | ( | const size_t & | rank | ) | const |
std::vector<std::string> xg::XG::path_names_by_prefix | ( | const std::string & | prefix | ) | const |
std::vector<size_t> xg::XG::path_ranks_by_prefix | ( | const std::string & | prefix | ) | const |
std::vector< path_handle_t > xg::XG::paths_of_handle | ( | const handle_t & | handle | ) | const |
char xg::XG::pos_char | ( | nid_t | id, |
bool | is_rev, | ||
size_t | off | ||
) | const |
std::string xg::XG::pos_substr | ( | nid_t | id, |
bool | is_rev, | ||
size_t | off, | ||
size_t | len | ||
) | const |
std::vector< size_t > xg::XG::position_in_path | ( | const handle_t & | handle, |
const path_handle_t & | path | ||
) | const |
std::unordered_map< path_handle_t, std::vector< size_t > > xg::XG::position_in_paths | ( | const handle_t & | handle, |
const size_t & | offset | ||
) | const |
|
private |
|
virtual |
rank to id helper function
Implements handlegraph::RankedHandleGraph.
|
private |
size_t xg::XG::serialize_and_measure | ( | std::ostream & | out, |
sdsl::structure_tree_node * | s = nullptr , |
||
std::string | name = "" |
||
) | const |
Like serialize() (inherited from SerializableHandleGraph) but logs internal member sizes and returns total size.
|
protectedvirtual |
Write the XG's contents to a stream aready prefixed with a magic number.
Implements handlegraph::Serializable.
|
protected |
Like serialize_members() but logs internal member sizes and returns total size.
void xg::XG::to_gfa | ( | std::ostream & | out | ) | const |
|
static |
size_t xg::XG::edge_count = 0 |
|
private |
delimit node records to allow lookup of nodes in g_civ by rank
|
private |
|
private |
|
private |
locally traversable graph storage
Encoding designed for efficient compression, cache locality, and relativistic traversal of the graph.
node := { header, left_side_edges, right_side_edges } header := { node_id, node_start, node_length, edges_left_count, edges_right_count } node_id := integer node_start := integer (offset in s_iv) node_length := integer edges_left_count := integer edges_right_count := integer left_side_edges := { edge, ... } right_side_edges := { edge, ... } edge := { relative_offset | target_is_rev } (bit-packed)
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
private |
|
private |
size_t xg::XG::node_count = 0 |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
static |
|
static |
size_t xg::XG::path_count = 0 |
|
static |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
size_t xg::XG::seq_length = 0 |