vg
tools for working with variation graphs
|
#include <path.hpp>
Public Member Functions | |
Paths (void) | |
Paths (const Paths &other) | |
Paths (Paths &&other) noexcept | |
Paths & | operator= (const Paths &other) |
Paths & | operator= (Paths &&other) noexcept |
int64_t | get_path_id (const string &name) const |
Get the lazily assigned numeric ID for a path, by name. More... | |
const string & | get_path_name (int64_t id) const |
Get the name of a path, by numeric ID. More... | |
void | sort_by_mapping_rank (void) |
void | rebuild_mapping_aux (void) |
Reassign ranks and rebuild indexes, treating the mapping lists in _paths as the truth. More... | |
bool | is_head_or_tail_node (id_t) |
vector< string > | all_path_names (void) |
void | make_circular (const string &name) |
void | make_linear (const string &name) |
void | rebuild_node_mapping (void) |
list< mapping_t >::iterator | find_mapping (mapping_t *m) |
list< mapping_t >::iterator | remove_mapping (mapping_t *m) |
list< mapping_t >::iterator | insert_mapping (list< mapping_t >::iterator w, const string &path_name, const mapping_t &m) |
pair< mapping_t *, mapping_t * > | divide_mapping (mapping_t *m, const Position &pos) |
pair< mapping_t *, mapping_t * > | divide_mapping (mapping_t *m, size_t offset) |
pair< mapping_t *, mapping_t * > | replace_mapping (mapping_t *m, pair< mapping_t, mapping_t > n) |
void | remove_paths (const set< string > &names) |
void | remove_path (const string &name) |
void | keep_paths (const set< string > &name) |
void | remove_node (id_t id) |
bool | has_path (const string &name) const |
void | to_json (ostream &out) |
list< mapping_t > & | get_path (const string &name) |
list< mapping_t > & | get_create_path (const string &name) |
list< mapping_t > & | create_path (const string &name) |
bool | has_mapping (const string &name, int32_t rank) |
bool | has_node_mapping (id_t id) const |
bool | has_node_mapping (Node *n) const |
map< int64_t, set< mapping_t * > > & | get_node_mapping (Node *n) |
map< int64_t, set< mapping_t * > > & | get_node_mapping (id_t id) |
const map< int64_t, set< mapping_t * > > & | get_node_mapping (id_t id) const |
map< string, set< mapping_t * > > | get_node_mapping_by_path_name (Node *n) |
map< string, set< mapping_t * > > | get_node_mapping_by_path_name (id_t id) |
map< string, map< int, mapping_t * > > | get_node_mappings_by_rank (id_t id) |
map< string, map< int, mapping_t > > | get_node_mapping_copies_by_rank (id_t id) |
mapping_t * | traverse_left (mapping_t *mapping) |
mapping_t * | traverse_right (mapping_t *mapping) |
const string | mapping_path_name (mapping_t *m) |
int64_t | mapping_path_id (mapping_t *m) |
set< string > | of_node (id_t id) |
map< string, int > | node_path_traversal_counts (id_t id, bool rev=false) |
vector< string > | node_path_traversals (id_t id, bool rev=false) |
bool | are_consecutive_nodes_in_path (id_t id1, id_t id2, const string &path_name) |
vector< string > | over_edge (id_t id1, bool rev1, id_t id2, bool rev2, vector< string > following) |
vector< string > | over_directed_edge (id_t id1, bool rev1, id_t id2, bool rev2, vector< string > following) |
size_t | size (void) const |
bool | empty (void) const |
void | clear (void) |
void | clear_mapping_ranks (void) |
void | compact_ranks (void) |
void | load (istream &in) |
void | write (ostream &out) |
Write paths to the given stream, ending with an EOF marker. More... | |
void | to_graph (Graph &g) |
Add all paths into the given Protobuf graph. Creates a new path for every path. More... | |
Path | path (const string &name) |
void | append_mapping (const string &name, const mapping_t &m, bool warn_on_duplicates=false) |
void | append_mapping (const string &name, id_t id, bool is_reverse, size_t length, size_t rank=0, bool warn_on_duplicates=false) |
void | prepend_mapping (const string &name, const Mapping &m, bool warn_on_duplicates=false) |
void | prepend_mapping (const string &name, id_t id, bool is_reverse, size_t length, size_t rank=0, bool warn_on_duplicates=false) |
size_t | get_next_rank (const string &name) |
void | append (const Paths &paths, bool warn_on_duplicates=false, bool rebuild_indexes=true) |
void | append (const Graph &g, bool warn_on_duplicates=false, bool rebuild_indexes=true) |
void | extend (const Paths &paths, bool warn_on_duplicates=false, bool rebuild_indexes=true) |
void | extend (const Path &p, bool warn_on_duplicates=false, bool rebuild_indexes=true) |
void | extend (const vector< Path > &paths, bool warn_on_duplicates=false, bool rebuild_indexes=true) |
void | for_each (const function< void(const Path &)> &lambda) |
void | for_each_name (const function< void(const string &)> &lambda) const |
bool | for_each_name_stoppable (const function< bool(const string &)> &lambda) const |
void | for_each_stream (istream &in, const function< void(Path &)> &lambda) |
void | increment_node_ids (id_t inc) |
void | swap_node_ids (const std::function< nid_t(const nid_t &)> &get_new_id) |
void | swap_node_ids (hash_map< id_t, id_t > &id_mapping) |
void | reassign_node (id_t new_id, mapping_t *m) |
void | for_each_mapping (const function< void(mapping_t &)> &lambda) |
Static Public Member Functions | |
static string | strip_subrange (const string &path_name, subrange_t *subrange=nullptr) |
Public Attributes | |
map< string, list< mapping_t > > | _paths |
hash_map< const mapping_t *, pair< list< mapping_t >::iterator, int64_t > > | mapping_itr |
map< string, hash_map< int32_t, mapping_t * > > | mappings_by_rank |
hash_map< id_t, map< int64_t, set< mapping_t * > > > | node_mapping |
set< id_t > | head_tail_nodes |
set< string > | circular |
Static Public Attributes | |
const static function< bool(const string &)> | is_alt |
Private Attributes | |
int64_t | max_path_id |
map< string, int64_t > | name_to_id |
map< int64_t, string > | id_to_name |
vg::Paths::Paths | ( | void | ) |
|
inline |
|
inlinenoexcept |
vector< string > vg::Paths::all_path_names | ( | void | ) |
void vg::Paths::append | ( | const Graph & | g, |
bool | warn_on_duplicates = false , |
||
bool | rebuild_indexes = true |
||
) |
void vg::Paths::append | ( | const Paths & | paths, |
bool | warn_on_duplicates = false , |
||
bool | rebuild_indexes = true |
||
) |
void vg::Paths::append_mapping | ( | const string & | name, |
const mapping_t & | m, | ||
bool | warn_on_duplicates = false |
||
) |
void vg::Paths::append_mapping | ( | const string & | name, |
id_t | id, | ||
bool | is_reverse, | ||
size_t | length, | ||
size_t | rank = 0 , |
||
bool | warn_on_duplicates = false |
||
) |
void vg::Paths::clear | ( | void | ) |
void vg::Paths::clear_mapping_ranks | ( | void | ) |
void vg::Paths::compact_ranks | ( | void | ) |
list< mapping_t > & vg::Paths::create_path | ( | const string & | name | ) |
bool vg::Paths::empty | ( | void | ) | const |
void vg::Paths::extend | ( | const Path & | p, |
bool | warn_on_duplicates = false , |
||
bool | rebuild_indexes = true |
||
) |
void vg::Paths::extend | ( | const Paths & | paths, |
bool | warn_on_duplicates = false , |
||
bool | rebuild_indexes = true |
||
) |
void vg::Paths::extend | ( | const vector< Path > & | paths, |
bool | warn_on_duplicates = false , |
||
bool | rebuild_indexes = true |
||
) |
void vg::Paths::for_each | ( | const function< void(const Path &)> & | lambda | ) |
void vg::Paths::for_each_mapping | ( | const function< void(mapping_t &)> & | lambda | ) |
void vg::Paths::for_each_name | ( | const function< void(const string &)> & | lambda | ) | const |
bool vg::Paths::for_each_name_stoppable | ( | const function< bool(const string &)> & | lambda | ) | const |
void vg::Paths::for_each_stream | ( | istream & | in, |
const function< void(Path &)> & | lambda | ||
) |
list< mapping_t > & vg::Paths::get_create_path | ( | const string & | name | ) |
size_t vg::Paths::get_next_rank | ( | const string & | name | ) |
list< mapping_t > & vg::Paths::get_path | ( | const string & | name | ) |
int64_t vg::Paths::get_path_id | ( | const string & | name | ) | const |
Get the lazily assigned numeric ID for a path, by name.
const string & vg::Paths::get_path_name | ( | int64_t | id | ) | const |
Get the name of a path, by numeric ID.
bool vg::Paths::has_mapping | ( | const string & | name, |
int32_t | rank | ||
) |
bool vg::Paths::has_node_mapping | ( | id_t | id | ) | const |
bool vg::Paths::has_node_mapping | ( | Node * | n | ) | const |
bool vg::Paths::has_path | ( | const string & | name | ) | const |
void vg::Paths::increment_node_ids | ( | id_t | inc | ) |
list< mapping_t >::iterator vg::Paths::insert_mapping | ( | list< mapping_t >::iterator | w, |
const string & | path_name, | ||
const mapping_t & | m | ||
) |
bool vg::Paths::is_head_or_tail_node | ( | id_t | id | ) |
void vg::Paths::keep_paths | ( | const set< string > & | name | ) |
void vg::Paths::load | ( | istream & | in | ) |
void vg::Paths::make_circular | ( | const string & | name | ) |
void vg::Paths::make_linear | ( | const string & | name | ) |
int64_t vg::Paths::mapping_path_id | ( | mapping_t * | m | ) |
const string vg::Paths::mapping_path_name | ( | mapping_t * | m | ) |
map< string, int > vg::Paths::node_path_traversal_counts | ( | id_t | id, |
bool | rev = false |
||
) |
vector< string > vg::Paths::node_path_traversals | ( | id_t | id, |
bool | rev = false |
||
) |
set< string > vg::Paths::of_node | ( | id_t | id | ) |
vector< string > vg::Paths::over_directed_edge | ( | id_t | id1, |
bool | rev1, | ||
id_t | id2, | ||
bool | rev2, | ||
vector< string > | following | ||
) |
vector< string > vg::Paths::over_edge | ( | id_t | id1, |
bool | rev1, | ||
id_t | id2, | ||
bool | rev2, | ||
vector< string > | following | ||
) |
Path vg::Paths::path | ( | const string & | name | ) |
void vg::Paths::prepend_mapping | ( | const string & | name, |
const Mapping & | m, | ||
bool | warn_on_duplicates = false |
||
) |
void vg::Paths::prepend_mapping | ( | const string & | name, |
id_t | id, | ||
bool | is_reverse, | ||
size_t | length, | ||
size_t | rank = 0 , |
||
bool | warn_on_duplicates = false |
||
) |
void vg::Paths::rebuild_mapping_aux | ( | void | ) |
Reassign ranks and rebuild indexes, treating the mapping lists in _paths as the truth.
void vg::Paths::rebuild_node_mapping | ( | void | ) |
void vg::Paths::remove_node | ( | id_t | id | ) |
void vg::Paths::remove_path | ( | const string & | name | ) |
void vg::Paths::remove_paths | ( | const set< string > & | names | ) |
pair< mapping_t *, mapping_t * > vg::Paths::replace_mapping | ( | mapping_t * | m, |
pair< mapping_t, mapping_t > | n | ||
) |
size_t vg::Paths::size | ( | void | ) | const |
void vg::Paths::sort_by_mapping_rank | ( | void | ) |
|
static |
void vg::Paths::to_graph | ( | Graph & | g | ) |
Add all paths into the given Protobuf graph. Creates a new path for every path.
void vg::Paths::to_json | ( | ostream & | out | ) |
void vg::Paths::write | ( | ostream & | out | ) |
Write paths to the given stream, ending with an EOF marker.
map<string, list<mapping_t> > vg::Paths::_paths |
set<string> vg::Paths::circular |
set<id_t> vg::Paths::head_tail_nodes |
|
mutableprivate |
|
static |
|
mutableprivate |
|
mutableprivate |