vg
tools for working with variation graphs
Loading...
Searching...
No Matches
vg::VCFGenotyper Class Reference

#include <vcf_genotyper.hpp>

Inheritance diagram for vg::VCFGenotyper:
vg::GraphCaller vg::VCFOutputCaller vg::GAFOutputCaller

Public Member Functions

 VCFGenotyper (const PathHandleGraph &graph, SnarlCaller &snarl_caller, SnarlManager &snarl_manager, vcflib::VariantCallFile &variant_file, const string &sample_name, const vector< string > &ref_paths, const vector< int > &ref_path_ploidies, FastaReference *ref_fasta, FastaReference *ins_fasta, AlignmentEmitter *aln_emitter, bool traversals_only, bool gaf_output, size_t trav_padding)
virtual ~VCFGenotyper ()
virtual bool call_snarl (const Snarl &snarl)
 Call a given snarl, and print the output to out_stream.
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).
Public Member Functions inherited from vg::GraphCaller
 GraphCaller (SnarlCaller &snarl_caller, SnarlManager &snarl_manager)
virtual ~GraphCaller ()
virtual void call_top_level_snarls (const HandleGraph &graph, RecurseType recurse_type=RecurseOnFail)
virtual void call_top_level_chains (const HandleGraph &graph, size_t max_edges, size_t max_trivial, RecurseType recurise_type=RecurseOnFail)
void set_show_progress (bool show_progress)
 toggle progress messages
Public Member Functions inherited from vg::VCFOutputCaller
 VCFOutputCaller (const string &sample_name)
virtual ~VCFOutputCaller ()
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.
void set_translation (const unordered_map< nid_t, pair< string, size_t > > *translation)
 Add a translation map.
void set_nested (bool nested)
 Assume writing nested snarls is enabled.
void set_allele_merge (double threshold, int64_t min_len)
unordered_set< string > get_output_contigs () const
string prune_header_contigs (const string &header, const unordered_set< string > &keep) const
Public Member Functions inherited from vg::GAFOutputCaller
 GAFOutputCaller (AlignmentEmitter *emitter, const string &sample_name, const vector< string > &ref_paths, size_t trav_padding)
 The emitter object is created and owned by external forces.
virtual ~GAFOutputCaller ()
void emit_gaf_traversals (const PathHandleGraph &graph, const string &snarl_name, const vector< SnarlTraversal > &travs, int64_t ref_trav_idx, const string &ref_path_name, int64_t ref_path_position, const TraversalSupportFinder *support_finder=nullptr)
 print the GAF traversals
void emit_gaf_variant (const PathHandleGraph &graph, const string &snarl_name, const vector< SnarlTraversal > &travs, const vector< int > &genotype, int64_t ref_trav_idx, const string &ref_path_name, int64_t ref_path_position, const TraversalSupportFinder *support_finder=nullptr)
 print the GAF genotype
SnarlTraversal pad_traversal (const PathHandleGraph &graph, const SnarlTraversal &trav) const
 pad a traversal with (first found) reference path, adding up to trav_padding to each side

Protected Member Functions

tuple< string, size_t, size_t > get_ref_positions (const vector< vcflib::Variant * > &variants) const
 get path positions bounding a set of variants
virtual unordered_map< string, size_t > scan_contig_lengths () const
 munge out the contig lengths from the VCF header
Protected Member Functions inherited from vg::GraphCaller
vector< Chain > break_chain (const HandleGraph &graph, const Chain &chain, size_t max_edges, size_t max_trivial)
 Break up a chain into bits that we want to call using size heuristics.
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
void add_allele_path_to_info (vcflib::Variant &v, int allele, const SnarlTraversal &trav, bool reversed, bool one_based) const
 legacy version of above
string trav_string (const HandleGraph &graph, const SnarlTraversal &trav) const
 convert a traversal into an allele string
bool merge_similar_alleles (const PathPositionHandleGraph &graph, const vector< SnarlTraversal > &site_traversals, vector< int > &site_genotype, const string &sample_name, vcflib::Variant &out_variant) const
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_t > get_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
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
string print_flipped_snarl (const Snarl &snarl, bool in_brackets=false) const
 The same as above, but print the snarl as if its orientation has been flipped.
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

const PathHandleGraph & graph
 the graph
vcflib::VariantCallFile & input_vcf
 input VCF to genotype, must have been loaded etc elsewhere
VCFTraversalFinder traversal_finder
bool traversals_only
 toggle whether to genotype or just output the traversals
bool gaf_output
 toggle whether to output vcf or gaf
unordered_map< string, int > path_to_ploidy
 the ploidies
Protected Attributes inherited from vg::GraphCaller
SnarlCaller & snarl_caller
 Our Genotyper.
SnarlManager & snarl_manager
 Our snarls.
bool show_progress
 Toggle progress messages.
Protected Attributes inherited from vg::VCFOutputCaller
vcflib::VariantCallFile output_vcf
 output vcf
string sample_name
 Sample name.
vector< vector< pair< pair< string, size_t >, string > > > output_variants
vector< unordered_map< string, SuppressedRef > > suppressed_ref_info
size_t max_uncalled_alleles = 5
 print up to this many uncalled alleles when doing ref-genotpes in -a mode
const unordered_map< nid_t, pair< string, size_t > > * translation
bool include_nested
double allele_merge_threshold = 1.0
int64_t allele_merge_min_len = 0
Protected Attributes inherited from vg::GAFOutputCaller
AlignmentEmitter * emitter
string gaf_sample_name
 Sample name.
size_t trav_padding = 0
unordered_set< string > ref_paths
 Reference paths are used to pad out traversals. If there are none, then first path found is used.

Additional Inherited Members

Public Types inherited from vg::GraphCaller
enum  RecurseType { RecurseOnFail , RecurseAlways , RecurseNever }
Static Protected Member Functions inherited from vg::VCFOutputCaller
static bool snarl_traversal_to_handles (const HandleGraph &graph, const SnarlTraversal &trav, Traversal &out_trav)
static int64_t allele_core_length (const vector< string > &alleles)
static string nesting_info_headers ()
Static Protected Attributes inherited from vg::VCFOutputCaller
static const int64_t max_vcf_line_length = 2000000000

Detailed Description

VCFGenotyper : Genotype variants in a given VCF file

Constructor & Destructor Documentation

◆ VCFGenotyper()

vg::VCFGenotyper::VCFGenotyper ( const PathHandleGraph & graph,
SnarlCaller & snarl_caller,
SnarlManager & snarl_manager,
vcflib::VariantCallFile & variant_file,
const string & sample_name,
const vector< string > & ref_paths,
const vector< int > & ref_path_ploidies,
FastaReference * ref_fasta,
FastaReference * ins_fasta,
AlignmentEmitter * aln_emitter,
bool traversals_only,
bool gaf_output,
size_t trav_padding )

◆ ~VCFGenotyper()

vg::VCFGenotyper::~VCFGenotyper ( )
virtual

Member Function Documentation

◆ call_snarl()

bool vg::VCFGenotyper::call_snarl ( const Snarl & snarl)
virtual

Call a given snarl, and print the output to out_stream.

Implements vg::GraphCaller.

◆ get_ref_positions()

tuple< string, size_t, size_t > vg::VCFGenotyper::get_ref_positions ( const vector< vcflib::Variant * > & variants) const
protected

get path positions bounding a set of variants

◆ scan_contig_lengths()

unordered_map< string, size_t > vg::VCFGenotyper::scan_contig_lengths ( ) const
protectedvirtual

munge out the contig lengths from the VCF header

◆ vcf_header()

string vg::VCFGenotyper::vcf_header ( const PathHandleGraph & graph,
const vector< string > & contigs,
const vector< size_t > & contig_length_overrides = {} ) const
virtual

Write the vcf header (version and contigs and basic info).

Reimplemented from vg::VCFOutputCaller.

Member Data Documentation

◆ gaf_output

bool vg::VCFGenotyper::gaf_output
protected

toggle whether to output vcf or gaf

◆ graph

const PathHandleGraph& vg::VCFGenotyper::graph
protected

the graph

◆ input_vcf

vcflib::VariantCallFile& vg::VCFGenotyper::input_vcf
protected

input VCF to genotype, must have been loaded etc elsewhere

◆ path_to_ploidy

unordered_map<string, int> vg::VCFGenotyper::path_to_ploidy
protected

the ploidies

◆ traversal_finder

VCFTraversalFinder vg::VCFGenotyper::traversal_finder
protected

traversal finder uses alt paths to map VCF alleles from input_vcf back to traversals in the snarl

◆ traversals_only

bool vg::VCFGenotyper::traversals_only
protected

toggle whether to genotype or just output the traversals


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