|
vg
tools for working with variation graphs
|
#include <index_registry.hpp>
Public Member Functions | |
| IndexRegistry ()=default | |
| Constructor. More... | |
| ~IndexRegistry () | |
| Destructor to clean up temp files. More... | |
| IndexRegistry (const IndexRegistry &other)=delete | |
| IndexRegistry & | operator= (const IndexRegistry &other)=delete |
| IndexRegistry (IndexRegistry &&other) | |
| IndexRegistry & | operator= (IndexRegistry &&other) |
| void | set_prefix (const string &prefix) |
| Prefix for all saved outputs. More... | |
| string | get_prefix () const |
| Get the current prefix for saving output files. More... | |
| void | set_intermediate_file_keeping (bool keep_intermediates) |
| void | register_index (const IndexName &identifier, const string &suffix) |
| Register an index containing the given identifier. More... | |
| void | register_index (const IndexName &identifier, const vector< string > &suffixes) |
| RecipeName | register_recipe (const vector< IndexName > &identifiers, const vector< IndexName > &input_identifiers, const RecipeFunc &exec) |
| void | register_generalization (const RecipeName &generalizer, const RecipeName &generalizee) |
| void | provide (const IndexName &identifier, const string &filename, const map< string, string > &scopes={}) |
| void | provide (const IndexName &identifier, const vector< string > &filenames, const map< string, string > &scopes={}) |
| void | reset (const IndexName &identifier) |
| Remove a provided index. More... | |
| bool | available (const IndexName &identifier) const |
| vector< string > | get_possible_filenames (const IndexName &identifier) const |
| vector< string > | require (const IndexName &identifier) const |
| void | set_target_memory_usage (int64_t bytes) |
| int64_t | get_target_memory_usage () const |
| Get the maximum memory we will try to consume. More... | |
| vector< IndexName > | completed_indexes () const |
| Get a list of all indexes that have already been completed or provided. More... | |
| void | make_indexes (const vector< IndexName > &identifiers) |
| string | to_dot () const |
| Returns the recipe graph in dot format. More... | |
| string | to_dot (const vector< IndexName > &targets) const |
| Returns the recipe graph in dot format with a plan highlighted. More... | |
| void | reset () |
| Discard any provided or constructed indexes. More... | |
Static Public Member Functions | |
| static set< string > | get_wildcards (const string &pattern) |
| Get the names of all brace-enclosed {wildcards} in the given pattern. More... | |
| static string | substitute_wildcards (const string &pattern, const map< string, string > values) |
| static int64_t | get_system_memory () |
| Get the amount of free memory. More... | |
| static bool | vcf_is_phased (const string &filepath) |
| Determine if a VCF file is phased or not. More... | |
| static bool | gfa_has_haplotypes (const string &filepath) |
| Determine if a GFA has haplotypes as W-lines. More... | |
Public Attributes | |
| bool | check_files = true |
Protected Member Functions | |
| vector< IndexGroup > | dependency_order () const |
| get a topological ordering of all registered indexes in the dependency DAG More... | |
| IndexingPlan | make_plan (const IndexGroup &end_products) const |
| generate a plan to create the indexes More... | |
| bool | has_recipe (const RecipeName &recipe_name) const |
| const IndexRecipe & | get_recipe (const RecipeName &recipe_name) const |
| use a recipe identifier to get the recipe More... | |
| vector< vector< string > > | execute_recipe (const RecipeName &recipe_name, const IndexingPlan *plan, AliasGraph &alias_graph) |
| IndexFile * | get_index (const IndexName &identifier) |
| access index file More... | |
| const IndexFile * | get_index (const IndexName &identifier) const |
| access const index file More... | |
| bool | all_finished (const vector< const IndexFile * > &inputs) const |
| bool | all_finished (const IndexGroup &inputs) const |
| string | get_work_dir () |
| Function to get and/or initialize the temporary directory in which indexes will live. More... | |
Protected Attributes | |
| map< IndexName, unique_ptr< IndexFile > > | index_registry |
| The storage struct for named indexes. Ordered so it is easier to key on index names. More... | |
| unordered_set< string > | registered_suffixes |
| All of the suffixes that have been registered by indexes. More... | |
| map< IndexGroup, vector< IndexRecipe > > | recipe_registry |
| The storage struct for recipes, which may make index. More... | |
| map< RecipeName, RecipeName > | generalizations |
| Map from generalizees to generalizers. More... | |
| string | work_dir |
| Temporary directory in which indexes will live. More... | |
| string | output_prefix = "index" |
| filepath that will prefix all saved output More... | |
| bool | keep_intermediates = false |
| should intermediate files end up in the scratch or the output directory? More... | |
| int64_t | target_memory_usage = numeric_limits<int64_t>::max() |
| the max memory we will attempt to use More... | |
Friends | |
| class | IndexingPlan |
An object that can record methods to produce indexes and design workflows to create a set of desired indexes.
|
default |
| vg::IndexRegistry::~IndexRegistry | ( | ) |
Destructor to clean up temp files.
|
delete |
| vg::IndexRegistry::IndexRegistry | ( | IndexRegistry && | other | ) |
|
protected |
|
protected |
| bool vg::IndexRegistry::available | ( | const IndexName & | identifier | ) | const |
Return true if the given index is available and can be require()'d, and false otherwise.
| vector< IndexName > vg::IndexRegistry::completed_indexes | ( | ) | const |
Get a list of all indexes that have already been completed or provided.
|
protected |
get a topological ordering of all registered indexes in the dependency DAG
|
protected |
Build the index using the recipe with the provided priority. Expose the plan so that the recipe knows where it is supposed to go.
access index file
access const index file
| vector< string > vg::IndexRegistry::get_possible_filenames | ( | const IndexName & | identifier | ) | const |
Get the possible filename(s) associated with the given index with the given prefix. TODO: Get this to account for sample-scoped indexes.
| string vg::IndexRegistry::get_prefix | ( | ) | const |
Get the current prefix for saving output files.
|
protected |
use a recipe identifier to get the recipe
|
static |
Get the amount of free memory.
| int64_t vg::IndexRegistry::get_target_memory_usage | ( | ) | const |
Get the maximum memory we will try to consume.
|
static |
Get the names of all brace-enclosed {wildcards} in the given pattern.
|
protected |
Function to get and/or initialize the temporary directory in which indexes will live.
|
static |
Determine if a GFA has haplotypes as W-lines.
|
protected |
Check if a recipe identifier correesponds to a recipe.
Recipe identifiers not corresponding to actual recipes are used during planning to represent provided inputs.
TODO: Refactor that with some kind of tagged union or optional.
| void vg::IndexRegistry::make_indexes | ( | const vector< IndexName > & | identifiers | ) |
Create and execute a plan to make the indicated indexes using provided inputs If provided inputs cannot create the desired indexes, throws a InsufficientInputException. When completed, all requested index files will be available via require().
|
protected |
generate a plan to create the indexes
|
delete |
| IndexRegistry & vg::IndexRegistry::operator= | ( | IndexRegistry && | other | ) |
| void vg::IndexRegistry::provide | ( | const IndexName & | identifier, |
| const string & | filename, | ||
| const map< string, string > & | scopes = {} |
||
| ) |
Indicate a serialized file that contains some identified index, optionally with scopes that propagates to descendant files.
TODO: If scopes contain ".", we can run into problems with combinations of different scopes producing the same final string. Right now we only use one kind of scope, which avoids this.
| void vg::IndexRegistry::provide | ( | const IndexName & | identifier, |
| const vector< string > & | filenames, | ||
| const map< string, string > & | scopes = {} |
||
| ) |
Indicate a list of serialized files that contains some identified index, optionally with scopes that propagates to descendant files.
TODO: If scopes contain ".", we can run into problems with combinations of different scopes producing the same final string. Right now we only use one kind of scope, which avoids this.
| void vg::IndexRegistry::register_generalization | ( | const RecipeName & | generalizer, |
| const RecipeName & | generalizee | ||
| ) |
Indicate one recipe is a broadened version of another. The indexes consumed and produced by the generalization must be semantically identical to those of the generalizee
| void vg::IndexRegistry::register_index | ( | const IndexName & | identifier, |
| const string & | suffix | ||
| ) |
Register an index containing the given identifier.
| void vg::IndexRegistry::register_index | ( | const IndexName & | identifier, |
| const vector< string > & | suffixes | ||
| ) |
Register an index containing the given identifier, with multiple possible suffixes. The first suffix where all {wildcards} can be substituted with scopes will be used.
| RecipeName vg::IndexRegistry::register_recipe | ( | const vector< IndexName > & | identifiers, |
| const vector< IndexName > & | input_identifiers, | ||
| const RecipeFunc & | exec | ||
| ) |
Register a recipe to produce an index using other indexes or input files. Recipes registered earlier will have higher priority.
| vector< string > vg::IndexRegistry::require | ( | const IndexName & | identifier | ) | const |
Get the filename(s) associated with the given index. Aborts if the index is not a known type, or if it is not provided or made.
| void vg::IndexRegistry::reset | ( | ) |
Discard any provided or constructed indexes.
| void vg::IndexRegistry::reset | ( | const IndexName & | identifier | ) |
Remove a provided index.
| void vg::IndexRegistry::set_intermediate_file_keeping | ( | bool | keep_intermediates | ) |
Should intermediate files be saved to the output directory or the temp directory?
| void vg::IndexRegistry::set_prefix | ( | const string & | prefix | ) |
Prefix for all saved outputs.
| void vg::IndexRegistry::set_target_memory_usage | ( | int64_t | bytes | ) |
Set the maximum memory that indexing should try to consume (note: this is not strictly adhered to due to difficulties in estimating memory use)
|
static |
Substitute wildcards into the given pattern. All wildcards must have values assigned. Extra values not used are allowed.
| string vg::IndexRegistry::to_dot | ( | ) | const |
Returns the recipe graph in dot format.
| string vg::IndexRegistry::to_dot | ( | const vector< IndexName > & | targets | ) | const |
Returns the recipe graph in dot format with a plan highlighted.
|
static |
Determine if a VCF file is phased or not.
|
friend |
| bool vg::IndexRegistry::check_files = true |
|
protected |
Map from generalizees to generalizers.
The storage struct for named indexes. Ordered so it is easier to key on index names.
|
protected |
should intermediate files end up in the scratch or the output directory?
|
protected |
filepath that will prefix all saved output
|
protected |
The storage struct for recipes, which may make index.
|
protected |
All of the suffixes that have been registered by indexes.
|
protected |
the max memory we will attempt to use
|
protected |
Temporary directory in which indexes will live.
1.9.1