vg
tools for working with variation graphs
Classes | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
vg::NestedFlowCaller Class Reference

#include <nested_flow_caller.hpp>

Inheritance diagram for vg::NestedFlowCaller:
vg::GraphCaller vg::GAFOutputCaller

Classes

struct  CallRecord
 stuff we remember for each snarl call, to be used when genotyping its parent More...
 

Public Member Functions

 NestedFlowCaller (const PathPositionHandleGraph &graph, SupportBasedSnarlCaller &snarl_caller, SnarlManager &snarl_manager, const string &sample_name, TraversalFinder &traversal_finder, const vector< string > &ref_paths, const vector< size_t > &ref_path_offsets, const vector< int > &ref_path_ploidies, AlignmentEmitter *aln_emitter, bool traversals_only, bool gaf_output, size_t trav_padding, bool genotype_snarls)
 
virtual ~NestedFlowCaller ()
 
virtual bool call_snarl (const Snarl &snarl)
 Call a given snarl, and print the output to out_stream. More...
 
- 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 More...
 
void set_snarl_batching (size_t window_size)
 
void set_ploidy_regions (PloidyRegions regions)
 
- 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. More...
 
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 More...
 
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 More...
 
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 More...
 

Public Attributes

SortedVCFWriter vcf_writer
 The sorted VCF the records go to. More...
 
SiteEmitter site_emitter
 Writes the record of each called site into vcf_writer. More...
 

Protected Types

typedef map< Snarl, CallRecord, NestedCachedPackedTraversalSupportFinder::snarl_less > CallTable
 

Protected Member Functions

bool call_snarl_recursive (const Snarl &managed_snarl, int ploidy, const string &parent_ref_path_name, pair< size_t, size_t > parent_ref_path_interval, CallTable &call_table)
 update the table of calls for each child snarl (and the input snarl) More...
 
bool emit_snarl_recursive (const Snarl &managed_snarl, int ploidy, CallTable &call_table)
 
bool emit_record (const Snarl &snarl, const CallRecord &record, const vector< int > &genotype, const unique_ptr< SnarlCaller::CallInfo > &call_info, int ploidy, const CallTable &call_table)
 
string flatten_reference_allele (const string &nested_allele, const CallTable &call_table) const
 
string flatten_alt_allele (const string &nested_allele, int allele, int ploidy, const CallTable &call_table) const
 
- 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) const
 Break up a chain into bits that we want to call using size heuristics. More...
 

Static Protected Member Functions

static void scan_snarl (const string &allele_string, const function< void(const string &, Snarl &)> &callback)
 

Protected Attributes

const PathPositionHandleGraph & graph
 the graph More...
 
TraversalFinder & traversal_finder
 the traversal finder More...
 
vector< string > ref_paths
 keep track of the reference paths More...
 
unordered_set< string > ref_path_set
 
map< string, size_t > ref_offsets
 keep track of offsets in the reference paths More...
 
map< string, int > ref_ploidies
 keep traco of the ploidies (todo: just one map for all path stuff!!) More...
 
size_t max_snarl_shallow_size = 50000
 until we support nested snarls, cap snarl size we attempt to process More...
 
AlignmentEmitter * alignment_emitter
 
bool traversals_only
 toggle whether to genotype or just output the traversals More...
 
bool gaf_output
 toggle whether to output vcf or gaf More...
 
bool genotype_snarls
 
NestedCachedPackedTraversalSupportFinder & nested_support_finder
 a hook into the snarl_caller's nested support finder More...
 
- Protected Attributes inherited from vg::GraphCaller
SnarlCaller & snarl_caller
 Our Genotyper. More...
 
SnarlManager & snarl_manager
 Our snarls. More...
 
size_t snarl_batch_window = 0
 
bool show_progress
 Toggle progress messages. More...
 
PloidyRegions ploidy_regions
 The ploidy of regions of the reference, which overrides the ploidy of their paths. More...
 
- Protected Attributes inherited from vg::GAFOutputCaller
AlignmentEmitter * emitter
 
string gaf_sample_name
 Sample name. More...
 
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. More...
 

Additional Inherited Members

- Public Types inherited from vg::GraphCaller
using RecurseType = vg::RecurseType
 
- Static Public Attributes inherited from vg::GraphCaller
static constexpr RecurseType RecurseOnFail = RecurseType::OnFail
 
static constexpr RecurseType RecurseAlways = RecurseType::Always
 
static constexpr RecurseType RecurseNever = RecurseType::Never
 

Detailed Description

NestedFlowCaller : DEPRECATED - Use FlowCaller with nested=true instead.

Uses any traversals finder (ex, FlowTraversalFinder) to find traversals, and calls those based on how much support they have. Should work on any graph but will not report cyclic traversals. This class is being replaced by FlowCaller's nested mode.

Member Typedef Documentation

◆ CallTable

Constructor & Destructor Documentation

◆ NestedFlowCaller()

vg::NestedFlowCaller::NestedFlowCaller ( const PathPositionHandleGraph &  graph,
SupportBasedSnarlCaller &  snarl_caller,
SnarlManager &  snarl_manager,
const string &  sample_name,
TraversalFinder &  traversal_finder,
const vector< string > &  ref_paths,
const vector< size_t > &  ref_path_offsets,
const vector< int > &  ref_path_ploidies,
AlignmentEmitter *  aln_emitter,
bool  traversals_only,
bool  gaf_output,
size_t  trav_padding,
bool  genotype_snarls 
)

◆ ~NestedFlowCaller()

vg::NestedFlowCaller::~NestedFlowCaller ( )
virtual

Member Function Documentation

◆ call_snarl()

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

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

Implements vg::GraphCaller.

◆ call_snarl_recursive()

bool vg::NestedFlowCaller::call_snarl_recursive ( const Snarl &  managed_snarl,
int  ploidy,
const string &  parent_ref_path_name,
pair< size_t, size_t >  parent_ref_path_interval,
CallTable &  call_table 
)
protected

update the table of calls for each child snarl (and the input snarl)

◆ emit_record()

bool vg::NestedFlowCaller::emit_record ( const Snarl &  snarl,
const CallRecord &  record,
const vector< int > &  genotype,
const unique_ptr< SnarlCaller::CallInfo > &  call_info,
int  ploidy,
const CallTable &  call_table 
)
protected

Write the record of a snarl called at genotype genotype, with its alleles flattened, and return false only if the writer refused a line the snarl wanted.

◆ emit_snarl_recursive()

bool vg::NestedFlowCaller::emit_snarl_recursive ( const Snarl &  managed_snarl,
int  ploidy,
CallTable &  call_table 
)
protected

emit the vcf of all reference-spanning snarls The call_table needs to be completely resolved

◆ flatten_alt_allele()

string vg::NestedFlowCaller::flatten_alt_allele ( const string &  nested_allele,
int  allele,
int  ploidy,
const CallTable &  call_table 
) const
protected

◆ flatten_reference_allele()

string vg::NestedFlowCaller::flatten_reference_allele ( const string &  nested_allele,
const CallTable &  call_table 
) const
protected

transform the nested allele string from something like AAC<6_10>TTT to a proper string by recursively resolving the nested snarls into alleles

◆ scan_snarl()

void vg::NestedFlowCaller::scan_snarl ( const string &  allele_string,
const function< void(const string &, Snarl &)> &  callback 
)
staticprotected

Split an allele string as trav_string writes it, with child snarls named in brackets, into its pieces, and call callback on each in order.

AACT(>12<17)TTT gives three calls: ("AACT", Snarl), ("", Snarl(12,-17)) and ("TTT", Snarl(12,-17)). The callback should read a call as a sequence fragment if the fragment is not empty, and otherwise as a snarl.

Member Data Documentation

◆ alignment_emitter

AlignmentEmitter* vg::NestedFlowCaller::alignment_emitter
protected

alignment emitter. if not null, traversals will be output here and no genotyping will be done

◆ gaf_output

bool vg::NestedFlowCaller::gaf_output
protected

toggle whether to output vcf or gaf

◆ genotype_snarls

bool vg::NestedFlowCaller::genotype_snarls
protected

toggle whether to genotype every snarl (by default, uncalled snarls are skipped, and coordinates are flattened out to minimize variant size – this turns all that off)

◆ graph

const PathPositionHandleGraph& vg::NestedFlowCaller::graph
protected

the graph

◆ max_snarl_shallow_size

size_t vg::NestedFlowCaller::max_snarl_shallow_size = 50000
protected

until we support nested snarls, cap snarl size we attempt to process

◆ nested_support_finder

NestedCachedPackedTraversalSupportFinder& vg::NestedFlowCaller::nested_support_finder
protected

a hook into the snarl_caller's nested support finder

◆ ref_offsets

map<string, size_t> vg::NestedFlowCaller::ref_offsets
protected

keep track of offsets in the reference paths

◆ ref_path_set

unordered_set<string> vg::NestedFlowCaller::ref_path_set
protected

◆ ref_paths

vector<string> vg::NestedFlowCaller::ref_paths
protected

keep track of the reference paths

◆ ref_ploidies

map<string, int> vg::NestedFlowCaller::ref_ploidies
protected

keep traco of the ploidies (todo: just one map for all path stuff!!)

◆ site_emitter

SiteEmitter vg::NestedFlowCaller::site_emitter

Writes the record of each called site into vcf_writer.

◆ traversal_finder

TraversalFinder& vg::NestedFlowCaller::traversal_finder
protected

the traversal finder

◆ traversals_only

bool vg::NestedFlowCaller::traversals_only
protected

toggle whether to genotype or just output the traversals

◆ vcf_writer

SortedVCFWriter vg::NestedFlowCaller::vcf_writer

The sorted VCF the records go to.


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