vg
tools for working with variation graphs
|
#include <index_manager.hpp>
Public Member Functions | |
IndexManager (const string &fasta_filename="", const string &vcf_filename="") | |
void | set_fasta_filename (const string &filename) |
Set the FASTA filename (and thus the basename for looking for other indexes, if not already set). More... | |
void | set_vcf_filename (const string &filename) |
Set the VCF filename. More... | |
void | set_minimizer_override (const string &filename) |
Override the file to load the minimizer index from. More... | |
shared_ptr< gbwtgraph::DefaultMinimizerIndex > | get_minimizer () |
Get the minimizer index. More... | |
bool | can_get_minimizer () const |
Returns true if the minimizer index is available or can be generated/loaded, and false otherwise. More... | |
void | set_gbwtgraph_override (const string &filename) |
Override the file to load the gbwtgraph index from. More... | |
shared_ptr< gbwtgraph::GBWTGraph > | get_gbwtgraph () |
Get the gbwtgraph index. More... | |
bool | can_get_gbwtgraph () const |
Returns true if the GBWTGraph is available or can be generated/loaded, and false otherwise. More... | |
void | set_gbwt_override (const string &filename) |
Override the file to load the gbwt index from. More... | |
shared_ptr< gbwt::GBWT > | get_gbwt () |
Get the gbwt index. More... | |
bool | can_get_gbwt () const |
Returns true if the GBWT is available or can be generated/loaded, and false otherwise. More... | |
void | set_distance_override (const string &filename) |
Override the file to load the distance index from. More... | |
shared_ptr< vg::MinimumDistanceIndex > | get_distance () |
Get the gbwt index. More... | |
bool | can_get_distance () const |
Returns true if the distance index is available or can be generated/loaded, and false otherwise. More... | |
void | set_snarls_override (const string &filename) |
Override the file to load the snarls from. More... | |
shared_ptr< vg::SnarlManager > | get_snarls () |
Get the snarls. More... | |
bool | can_get_snarls () const |
Returns true if the snarls are available or can be generated/loaded, and false otherwise. More... | |
void | set_graph_override (const string &filename) |
shared_ptr< PathHandleGraph > | get_graph () |
Get the graph. More... | |
bool | can_get_graph () const |
Returns true if the graph is available or can be generated/loaded, and false otherwise. More... | |
![]() | |
void | preload_progress (const string &message) |
void | create_progress (const string &message, long count) |
void | create_progress (long count) |
void | update_progress (long i) |
void | increment_progress () |
void | destroy_progress (void) |
Static Public Attributes | |
constexpr static size_t | minimizer_k = 29 |
Minimizer kmer length to use when minimizer indexing. More... | |
constexpr static size_t | minimizer_w = 11 |
Minimizer window size to use when minimizer indexing. More... | |
Protected Member Functions | |
void | ensure_graph () |
Load the graph, or make it from the FASTA and VCF file names, and save it to disk. More... | |
void | ensure_snarls () |
Load the snarls (including trivial snarls), or make them from the graph and save them to disk. More... | |
void | ensure_distance () |
Load the distance index, or make it from the graph and the snarls and save it to disk. More... | |
void | ensure_gbwt () |
Load the GBWT, or make it from the graph and the VCF filename and save it to disk. More... | |
void | ensure_gbwtgraph () |
Load the GBWTGraph, or make it from the GBWT and the base graph, and save it to disk. More... | |
void | ensure_minimizer () |
Load the minimizer index, or make it from the GBWTGraph and the GBWT and save it to disk. More... | |
template<typename IndexHolderType > | |
void | ensure (IndexHolderType &member, const string &filename_override, const string &extension, const function< void(ifstream &)> &load, const function< void(ofstream &)> &make_and_save) |
template<typename IndexHolderType > | |
bool | can_get (IndexHolderType &member, const string &filename_override, const string &extension, const function< bool(void)> &poll_dependencies) const |
string | get_filename (const string &extension) const |
Protected Attributes | |
string | fasta_filename |
string | vcf_filename |
string | basename |
string | minimizer_override |
string | gbwtgraph_override |
string | gbwt_override |
string | distance_override |
string | snarls_override |
string | graph_override |
shared_ptr< gbwtgraph::DefaultMinimizerIndex > | minimizer |
pair< shared_ptr< gbwtgraph::GBWTGraph >, shared_ptr< gbwt::GBWT > > | gbwtgraph |
shared_ptr< gbwt::GBWT > | gbwt |
shared_ptr< vg::MinimumDistanceIndex > | distance |
shared_ptr< SnarlManager > | snarls |
shared_ptr< PathHandleGraph > | graph |
Additional Inherited Members | |
![]() | |
bool | show_progress = false |
Represents a set of indexes (including the actual graph) organized around a base name. The base name is the name of the indexed FASTA file.
We have an internal collection of shared_ptrs, one for each final or intermediate index.
We also have a bunch of internal ensure_whatever() methods that make sure that the corresponding index is populated, either from disk if available, or from the indexes it depends on, first calling the ensure method for each.
For each index type (foo), we need:
Note that the IndexManager may exit the process, instead of throwing an exception, if something goes wrong during a "get_foo()" method, so you should check "can_get_foo()" first.
vg::IndexManager::IndexManager | ( | const string & | fasta_filename = "" , |
const string & | vcf_filename = "" |
||
) |
|
protected |
We have a template for helping write the can_get functions. Defined in the CPP since only we use it.
bool vg::IndexManager::can_get_distance | ( | ) | const |
Returns true if the distance index is available or can be generated/loaded, and false otherwise.
bool vg::IndexManager::can_get_gbwt | ( | ) | const |
Returns true if the GBWT is available or can be generated/loaded, and false otherwise.
bool vg::IndexManager::can_get_gbwtgraph | ( | ) | const |
Returns true if the GBWTGraph is available or can be generated/loaded, and false otherwise.
bool vg::IndexManager::can_get_graph | ( | ) | const |
Returns true if the graph is available or can be generated/loaded, and false otherwise.
bool vg::IndexManager::can_get_minimizer | ( | ) | const |
Returns true if the minimizer index is available or can be generated/loaded, and false otherwise.
bool vg::IndexManager::can_get_snarls | ( | ) | const |
Returns true if the snarls are available or can be generated/loaded, and false otherwise.
|
protected |
We have a template to help us stamp out these ensure functions. We define it in the CPP since only we ever use it. Note that the ostream to make_and_save is only open if there is a basename and a file to write to.
|
protected |
Load the distance index, or make it from the graph and the snarls and save it to disk.
|
protected |
Load the GBWT, or make it from the graph and the VCF filename and save it to disk.
|
protected |
Load the GBWTGraph, or make it from the GBWT and the base graph, and save it to disk.
|
protected |
Load the graph, or make it from the FASTA and VCF file names, and save it to disk.
|
protected |
Load the minimizer index, or make it from the GBWTGraph and the GBWT and save it to disk.
|
protected |
Load the snarls (including trivial snarls), or make them from the graph and save them to disk.
shared_ptr< vg::MinimumDistanceIndex > vg::IndexManager::get_distance | ( | ) |
Get the gbwt index.
|
protected |
Get the filename for the index file having the given extension. Extension should not include the dot. May or may not exist yet. Returns "" if there is no basename.
shared_ptr< gbwt::GBWT > vg::IndexManager::get_gbwt | ( | ) |
Get the gbwt index.
shared_ptr< gbwtgraph::GBWTGraph > vg::IndexManager::get_gbwtgraph | ( | ) |
Get the gbwtgraph index.
shared_ptr< PathHandleGraph > vg::IndexManager::get_graph | ( | ) |
Get the graph.
shared_ptr< gbwtgraph::DefaultMinimizerIndex > vg::IndexManager::get_minimizer | ( | ) |
Get the minimizer index.
shared_ptr< vg::SnarlManager > vg::IndexManager::get_snarls | ( | ) |
Get the snarls.
void vg::IndexManager::set_distance_override | ( | const string & | filename | ) |
Override the file to load the distance index from.
void vg::IndexManager::set_fasta_filename | ( | const string & | filename | ) |
Set the FASTA filename (and thus the basename for looking for other indexes, if not already set).
void vg::IndexManager::set_gbwt_override | ( | const string & | filename | ) |
Override the file to load the gbwt index from.
void vg::IndexManager::set_gbwtgraph_override | ( | const string & | filename | ) |
Override the file to load the gbwtgraph index from.
void vg::IndexManager::set_graph_override | ( | const string & | filename | ) |
Override the file to load the graph from. Also sets index basename to be based on this graph file.
void vg::IndexManager::set_minimizer_override | ( | const string & | filename | ) |
Override the file to load the minimizer index from.
void vg::IndexManager::set_snarls_override | ( | const string & | filename | ) |
Override the file to load the snarls from.
void vg::IndexManager::set_vcf_filename | ( | const string & | filename | ) |
Set the VCF filename.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticconstexpr |
Minimizer kmer length to use when minimizer indexing.
|
protected |
|
staticconstexpr |
Minimizer window size to use when minimizer indexing.
|
protected |
|
protected |
|
protected |