vg
tools for working with variation graphs
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
vg::Deconstructor Class Reference

#include <deconstructor.hpp>

Inheritance diagram for vg::Deconstructor:
vg::VCFOutputCaller

Classes

struct  NestingInfo
 

Public Member Functions

 Deconstructor ()
 
 ~Deconstructor ()
 
void deconstruct (vector< string > refpaths, const PathPositionHandleGraph *graph, SnarlManager *snarl_manager, bool include_nested, int context_jaccard_window, bool untangle_traversals, bool keep_conflicted, bool strict_conflicts, bool long_ref_contig, double cluster_threshold=1.0, gbwt::GBWT *gbwt=nullptr, bool nested_decomposition=false, bool star_allele=false)
 
- Public Member Functions inherited from vg::VCFOutputCaller
 VCFOutputCaller (const string &sample_name)
 
virtual ~VCFOutputCaller ()
 
virtual string vcf_header (const PathHandleGraph &graph, const vector< string > &contigs, const vector< size_t > &contig_length_overrides) const
 Write the vcf header (version and contigs and basic info) More...
 
bool add_variant (vcflib::Variant &var) const
 
void write_variants (ostream &out_stream, const SnarlManager *snarl_manager=nullptr)
 
void vcf_fixup (vcflib::Variant &var) const
 Run vcffixup from vcflib. More...
 
void set_translation (const unordered_map< nid_t, pair< string, size_t >> *translation)
 Add a translation map. More...
 
void set_nested (bool nested)
 Assume writing nested snarls is enabled. More...
 

Private Member Functions

string get_vcf_header ()
 
string add_contigs_to_vcf_header (const string &vcf_header) const
 
void deconstruct_graph (SnarlManager *snarl_manager)
 
void deconstruct_graph_top_down (SnarlManager *snarl_manager)
 
bool deconstruct_site (const handle_t &snarl_start, const handle_t &snarl_end, const NestingInfo *in_nesting_info=nullptr, vector< NestingInfo > *out_nesting_infos=nullptr) const
 
void get_traversals (const handle_t &snarl_start, const handle_t &snarl_end, vector< Traversal > &out_travs, vector< string > &out_trav_path_names, vector< pair< step_handle_t, step_handle_t >> &out_trav_steps) const
 
unordered_map< string, vector< int > > add_star_traversals (vector< Traversal > &travs, vector< string > &trav_names, vector< vector< int >> &trav_clusters, vector< pair< double, int64_t >> &trav_cluster_info, const unordered_map< string, vector< int >> &parent_haplotypes) const
 
vector< int > get_alleles (vcflib::Variant &v, const vector< Traversal > &travs, const vector< pair< step_handle_t, step_handle_t >> &trav_steps, int ref_path_idx, const vector< vector< int >> &trav_clusters, char prev_char, bool use_start) const
 
void get_genotypes (vcflib::Variant &v, const vector< string > &names, const vector< int > &trav_to_allele, const vector< pair< double, int64_t >> &trav_to_cluster_info) const
 
pair< vector< int >, bool > choose_traversals (const string &sample_name, const vector< int > &travs, const vector< int > &trav_to_allele, const vector< string > &trav_to_name, const vector< int > &gbwt_phases) const
 
vector< nid_tget_context (step_handle_t start_step, step_handle_t end_step) const
 

Private Attributes

const PathPositionHandleGraphgraph
 
gbwt::GBWT * gbwt
 
unique_ptr< PathTraversalFinderpath_trav_finder
 
unique_ptr< GBWTTraversalFindergbwt_trav_finder
 
unordered_set< string > gbwt_reference_samples
 
unordered_map< string, pair< int, int > > gbwt_sample_to_phase_range
 
set< string > ref_paths
 
vector< unordered_set< path_handle_t > > off_ref_paths
 
set< string > ref_samples
 
bool long_ref_contig = false
 
set< string > sample_names
 
const unordered_map< string, pair< string, int > > * path_to_sample_phase
 
unordered_map< string, int > sample_ploidys
 
int path_jaccard_window = 10000
 
bool untangle_allele_traversals = false
 
bool strict_conflict_checking = false
 
bool show_path_info = false
 
bool keep_conflicted_genotypes = false
 
double cluster_threshold = 1.0
 
bool nested_decomposition = false
 
bool star_allele = false
 

Additional Inherited Members

- Protected Member Functions inherited from vg::VCFOutputCaller
void add_allele_path_to_info (const HandleGraph *graph, vcflib::Variant &v, int allele, const Traversal &trav, bool reversed, bool one_based) const
 add a traversal to the VCF info field in the format of a GFA W-line or GAF path More...
 
void add_allele_path_to_info (vcflib::Variant &v, int allele, const SnarlTraversal &trav, bool reversed, bool one_based) const
 legacy version of above More...
 
string trav_string (const HandleGraph &graph, const SnarlTraversal &trav) const
 convert a traversal into an allele string More...
 
bool emit_variant (const PathPositionHandleGraph &graph, SnarlCaller &snarl_caller, const Snarl &snarl, const vector< SnarlTraversal > &called_traversals, const vector< int > &genotype, int ref_trav_idx, const unique_ptr< SnarlCaller::CallInfo > &call_info, const string &ref_path_name, int ref_offset, bool genotype_snarls, int ploidy, function< string(const vector< SnarlTraversal > &, const vector< int > &, int, int, int)> trav_to_string=nullptr)
 
tuple< int64_t, int64_t, bool, step_handle_t, step_handle_tget_ref_interval (const PathPositionHandleGraph &graph, const Snarl &snarl, const string &ref_path_name) const
 
pair< string, int64_t > get_ref_position (const PathPositionHandleGraph &graph, const Snarl &snarl, const string &ref_path_name, int64_t ref_path_offset) const
 used for making gaf traversal names More...
 
void flatten_common_allele_ends (vcflib::Variant &variant, bool backward, size_t len_override) const
 
string print_snarl (const HandleGraph *grpah, const handle_t &snarl_start, const handle_t &snarl_end, bool in_brackets=false) const
 
string print_snarl (const Snarl &snarl, bool in_brackets=false) const
 legacy version of above More...
 
void scan_snarl (const string &allele_string, function< void(const string &, Snarl &)> callback) const
 
void update_nesting_info_tags (const SnarlManager *snarl_manager)
 
- Protected Attributes inherited from vg::VCFOutputCaller
vcflib::VariantCallFile output_vcf
 output vcf More...
 
string sample_name
 Sample name. More...
 
vector< vector< pair< pair< string, size_t >, string > > > output_variants
 
size_t max_uncalled_alleles = 5
 print up to this many uncalled alleles when doing ref-genotpes in -a mode More...
 
const unordered_map< nid_t, pair< string, size_t > > * translation
 
bool include_nested
 
- Static Protected Attributes inherited from vg::VCFOutputCaller
static const int64_t max_vcf_line_length = 2000000000
 

Constructor & Destructor Documentation

◆ Deconstructor()

vg::Deconstructor::Deconstructor ( )

◆ ~Deconstructor()

vg::Deconstructor::~Deconstructor ( )

Member Function Documentation

◆ add_contigs_to_vcf_header()

string vg::Deconstructor::add_contigs_to_vcf_header ( const string &  vcf_header) const
private

◆ add_star_traversals()

unordered_map< string, vector< int > > vg::Deconstructor::add_star_traversals ( vector< Traversal > &  travs,
vector< string > &  trav_names,
vector< vector< int >> &  trav_clusters,
vector< pair< double, int64_t >> &  trav_cluster_info,
const unordered_map< string, vector< int >> &  parent_haplotypes 
) const
private

◆ choose_traversals()

pair< vector< int >, bool > vg::Deconstructor::choose_traversals ( const string &  sample_name,
const vector< int > &  travs,
const vector< int > &  trav_to_allele,
const vector< string > &  trav_to_name,
const vector< int > &  gbwt_phases 
) const
private

◆ deconstruct()

void vg::Deconstructor::deconstruct ( vector< string >  ref_paths,
const PathPositionHandleGraph graph,
SnarlManager snarl_manager,
bool  include_nested,
int  context_jaccard_window,
bool  untangle_traversals,
bool  keep_conflicted,
bool  strict_conflicts,
bool  long_ref_contig,
double  cluster_threshold = 1.0,
gbwt::GBWT *  gbwt = nullptr,
bool  nested_decomposition = false,
bool  star_allele = false 
)

Convenience wrapper function for deconstruction of multiple paths.

◆ deconstruct_graph()

void vg::Deconstructor::deconstruct_graph ( SnarlManager snarl_manager)
private

◆ deconstruct_graph_top_down()

void vg::Deconstructor::deconstruct_graph_top_down ( SnarlManager snarl_manager)
private

◆ deconstruct_site()

bool vg::Deconstructor::deconstruct_site ( const handle_t snarl_start,
const handle_t snarl_end,
const NestingInfo in_nesting_info = nullptr,
vector< NestingInfo > *  out_nesting_infos = nullptr 
) const
private

◆ get_alleles()

vector< int > vg::Deconstructor::get_alleles ( vcflib::Variant &  v,
const vector< Traversal > &  travs,
const vector< pair< step_handle_t, step_handle_t >> &  trav_steps,
int  ref_path_idx,
const vector< vector< int >> &  trav_clusters,
char  prev_char,
bool  use_start 
) const
private

Takes in a vector of snarltraversals, an index of the ref path among them, a vector of flags for traversals to actually use, the character before all the traversals, and a flag for whether the start should be used (???).

Returns a vector where entires are which allele number a traversal in travs ought to become in the VCF. If a traversal is flagged off, it gets a -1.

◆ get_context()

vector< nid_t > vg::Deconstructor::get_context ( step_handle_t  start_step,
step_handle_t  end_step 
) const
private

◆ get_genotypes()

void vg::Deconstructor::get_genotypes ( vcflib::Variant &  v,
const vector< string > &  names,
const vector< int > &  trav_to_allele,
const vector< pair< double, int64_t >> &  trav_to_cluster_info 
) const
private

◆ get_traversals()

void vg::Deconstructor::get_traversals ( const handle_t snarl_start,
const handle_t snarl_end,
vector< Traversal > &  out_travs,
vector< string > &  out_trav_path_names,
vector< pair< step_handle_t, step_handle_t >> &  out_trav_steps 
) const
private

◆ get_vcf_header()

string vg::Deconstructor::get_vcf_header ( )
private

Member Data Documentation

◆ cluster_threshold

double vg::Deconstructor::cluster_threshold = 1.0
private

◆ gbwt

gbwt::GBWT* vg::Deconstructor::gbwt
private

◆ gbwt_reference_samples

unordered_set<string> vg::Deconstructor::gbwt_reference_samples
private

◆ gbwt_sample_to_phase_range

unordered_map<string, pair<int, int> > vg::Deconstructor::gbwt_sample_to_phase_range
private

◆ gbwt_trav_finder

unique_ptr<GBWTTraversalFinder> vg::Deconstructor::gbwt_trav_finder
private

◆ graph

const PathPositionHandleGraph* vg::Deconstructor::graph
private

◆ keep_conflicted_genotypes

bool vg::Deconstructor::keep_conflicted_genotypes = false
private

◆ long_ref_contig

bool vg::Deconstructor::long_ref_contig = false
private

◆ nested_decomposition

bool vg::Deconstructor::nested_decomposition = false
private

◆ off_ref_paths

vector<unordered_set<path_handle_t> > vg::Deconstructor::off_ref_paths
mutableprivate

◆ path_jaccard_window

int vg::Deconstructor::path_jaccard_window = 10000
private

◆ path_to_sample_phase

const unordered_map<string, pair<string, int> >* vg::Deconstructor::path_to_sample_phase
private

◆ path_trav_finder

unique_ptr<PathTraversalFinder> vg::Deconstructor::path_trav_finder
private

◆ ref_paths

set<string> vg::Deconstructor::ref_paths
private

◆ ref_samples

set<string> vg::Deconstructor::ref_samples
private

◆ sample_names

set<string> vg::Deconstructor::sample_names
private

◆ sample_ploidys

unordered_map<string, int> vg::Deconstructor::sample_ploidys
private

◆ show_path_info

bool vg::Deconstructor::show_path_info = false
private

◆ star_allele

bool vg::Deconstructor::star_allele = false
private

◆ strict_conflict_checking

bool vg::Deconstructor::strict_conflict_checking = false
private

◆ untangle_allele_traversals

bool vg::Deconstructor::untangle_allele_traversals = false
private

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