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

#include <funnel.hpp>

Classes

struct  FilterPerformance
 
struct  Item
 Represents an Item whose provenance we track. More...
 
struct  Stage
 Represents a Stage which is a series of Items, which track their own provenance. More...
 

Public Member Functions

void start (const string &name)
 
void stop ()
 
void stage (const string &name)
 
void stage_stop ()
 Stop the current stage. More...
 
void substage (const string &name)
 
void substage_stop ()
 Stop the current substage. More...
 
void processing_input (size_t prev_stage_item)
 Start processing the given item coming from the previous stage. More...
 
void processed_input ()
 Stop processing an item from the previous stage. More...
 
void producing_output (size_t item)
 Start producing the given output item, whether it has been projected yet or not. More...
 
void produced_output ()
 Stop producing an output item. More...
 
void introduce (size_t count=1)
 Introduce the given number of new items, starting their own lines of provenance (default 1). More...
 
void expand (size_t prev_stage_item, size_t count)
 Expand the given item from the previous stage into the given number of new items at this stage. More...
 
template<typename Iterator >
void merge_group (Iterator prev_stage_items_begin, Iterator prev_stage_items_end)
 
void project (size_t prev_stage_item)
 Project a single item from the previous stage to a single non-group item at this stage. More...
 
void project_group (size_t prev_stage_item, size_t group_size)
 Project a single item from the previous stage to a new group item at the current stage, with the given size. More...
 
void fail (const char *filter, size_t prev_stage_item, double statistic=nan(""))
 
void pass (const char *filter, size_t prev_stage_item, double statistic=nan(""))
 
void score (size_t item, double score)
 Assign the given score to the given item at the current stage. More...
 
void tag_correct (size_t item)
 
bool is_correct (size_t item) const
 
bool was_correct (size_t prev_stage_item) const
 
string last_correct_stage () const
 
size_t latest () const
 Get the index of the most recent item created in the current stage. More...
 
void for_each_stage (const function< void(const string &, const vector< size_t > &)> &callback) const
 Call the given callback with stage name, and vector of result item sizes at that stage, for each stage. More...
 
void for_each_filter (const function< void(const string &, const string &, const FilterPerformance &, const FilterPerformance &, const vector< double > &, const vector< double > &)> &callback) const
 
void to_dot (ostream &out)
 
void annotate_mapped_alignment (Alignment &aln, bool annotate_correctness)
 

Protected Member Functions

Itemget_item (size_t index)
 
size_t create_item ()
 

Protected Attributes

string funnel_name
 What's the name of the funnel we start()-ed. Will be empty if nothing is running. More...
 
string stage_name
 What's the name of the current stage? Will be empty if no stage is running. More...
 
string substage_name
 What's the name of the current substage? Will be empty if no substage is running. More...
 
size_t input_in_progress = numeric_limits<size_t>::max()
 
size_t output_in_progress = numeric_limits<size_t>::max()
 
vector< Stagestages
 

Detailed Description

Represents a record of an invocation of a pipeline for an input.

Tracks the history of "lines" of data "item" provenance through a series of "stages", containing a series of "filters".

Lines are "introduced", and "project" from earlier stages to later stages, possibly "expanding" or "merging", until they "fail" a filter or reach the final stage. At each stage, items occur in a linear order and are identified by index.

An item may be a "group", with a certain size.

We also can assign scores to items at a stage.

Member Function Documentation

◆ annotate_mapped_alignment()

void vg::Funnel::annotate_mapped_alignment ( Alignment aln,
bool  annotate_correctness 
)

Set an alignments annotations with the number of results at each stage if annotate_correctness is true, also annotate the alignment with the number of correct results at each stage. This assumes that we've been tracking correctness all along

◆ create_item()

size_t vg::Funnel::create_item ( )
protected

Create a new item in the current stage and get its index. Advances the projected count counter.

◆ expand()

void vg::Funnel::expand ( size_t  prev_stage_item,
size_t  count 
)

Expand the given item from the previous stage into the given number of new items at this stage.

◆ fail()

void vg::Funnel::fail ( const char *  filter,
size_t  prev_stage_item,
double  statistic = nan("") 
)

Fail the given item from the previous stage on the given filter and do not project it through to this stage. Items which do not fail a filter must pass the filter and be projected to something. The filter name must survive the funnel, because a pointer to it will be stored. Allows a statistic for the filtered-on value for the failing item to be recorded.

◆ for_each_filter()

void vg::Funnel::for_each_filter ( const function< void(const string &, const string &, const FilterPerformance &, const FilterPerformance &, const vector< double > &, const vector< double > &)> &  callback) const

Call the given callback with stage name, filter name, performance report for items, performance report for total size of items, values for correct items for the filter statistic, and values for incorrect (or merely not known-correct) items for the filter statistic. Runs the callback for each stage and filter, in order. Only includes filters that were actually passed or failed by any items.

◆ for_each_stage()

void vg::Funnel::for_each_stage ( const function< void(const string &, const vector< size_t > &)> &  callback) const

Call the given callback with stage name, and vector of result item sizes at that stage, for each stage.

◆ get_item()

Funnel::Item & vg::Funnel::get_item ( size_t  index)
protected

Ensure an item with the given index exists in the current stage and return a reference to it. We need to do it this way because we might save a production duration before an item is really projected. The items of the current stage should only be modified through this. Note that you do not need to create an item in order to get it.

◆ introduce()

void vg::Funnel::introduce ( size_t  count = 1)

Introduce the given number of new items, starting their own lines of provenance (default 1).

◆ is_correct()

bool vg::Funnel::is_correct ( size_t  item) const

Return true if the given item at this stage is tagged correct, or descends from an item that was tagged correct.

◆ last_correct_stage()

string vg::Funnel::last_correct_stage ( ) const

Get the name of the most recent stage that had a correct-tagged item survive into it, or "none" if no items were ever tagged correct.

◆ latest()

size_t vg::Funnel::latest ( ) const

Get the index of the most recent item created in the current stage.

◆ merge_group()

template<typename Iterator >
void vg::Funnel::merge_group ( Iterator  prev_stage_items_begin,
Iterator  prev_stage_items_end 
)

Merge all the given item indexes from the previous stage into a new item at this stage. The new item will be a group, sized according to the number of previous items merged.

◆ pass()

void vg::Funnel::pass ( const char *  filter,
size_t  prev_stage_item,
double  statistic = nan("") 
)

Pass the given item from the previous stage through the given filter at this stage. Items which do not pass a filter must fail it. All items which pass filters must do so in the same order. The filter name must survive the funnel, because a pointer to it will be stored. Allows a statistic for the filtered-on value for the passing item to be recorded.

◆ processed_input()

void vg::Funnel::processed_input ( )

Stop processing an item from the previous stage.

◆ processing_input()

void vg::Funnel::processing_input ( size_t  prev_stage_item)

Start processing the given item coming from the previous stage.

◆ produced_output()

void vg::Funnel::produced_output ( )

Stop producing an output item.

◆ producing_output()

void vg::Funnel::producing_output ( size_t  item)

Start producing the given output item, whether it has been projected yet or not.

◆ project()

void vg::Funnel::project ( size_t  prev_stage_item)

Project a single item from the previous stage to a single non-group item at this stage.

◆ project_group()

void vg::Funnel::project_group ( size_t  prev_stage_item,
size_t  group_size 
)

Project a single item from the previous stage to a new group item at the current stage, with the given size.

◆ score()

void vg::Funnel::score ( size_t  item,
double  score 
)

Assign the given score to the given item at the current stage.

◆ stage()

void vg::Funnel::stage ( const string &  name)

Start the given stage, and end all previous stages and substages. Name must not be empty. Multiple stages with the same name will be coalesced.

◆ stage_stop()

void vg::Funnel::stage_stop ( )

Stop the current stage.

◆ start()

void vg::Funnel::start ( const string &  name)

Start processing the given named input. Name must not be empty. No stage or substage will be active.

◆ stop()

void vg::Funnel::stop ( )

Stop processing the given named input. All stages and substages are stopped.

◆ substage()

void vg::Funnel::substage ( const string &  name)

Start the given substage, nested insude the current stage. End all previous substages. Substages within a stage may repeat and are coalesced. Name must not be empty.

◆ substage_stop()

void vg::Funnel::substage_stop ( )

Stop the current substage.

◆ tag_correct()

void vg::Funnel::tag_correct ( size_t  item)

Tag the given item as "correct" at the current stage. Future items that derive from it will also be tagged as correct.

◆ to_dot()

void vg::Funnel::to_dot ( ostream &  out)

Dump information from the Funnel as a dot-format Graphviz graph to the given stream. Illustrates stages and provenance.

◆ was_correct()

bool vg::Funnel::was_correct ( size_t  prev_stage_item) const

Return true if the given item at the previous stage is tagged correct, or descends from an item that was tagged correct.

Member Data Documentation

◆ funnel_name

string vg::Funnel::funnel_name
protected

What's the name of the funnel we start()-ed. Will be empty if nothing is running.

◆ input_in_progress

size_t vg::Funnel::input_in_progress = numeric_limits<size_t>::max()
protected

What's the current prev-stage input we are processing? Will be numeric_limits<size_t>::max() if none.

◆ output_in_progress

size_t vg::Funnel::output_in_progress = numeric_limits<size_t>::max()
protected

what's the current current-stage output we are generating? Will be numeric_limits<size_t>::max() if none.

◆ stage_name

string vg::Funnel::stage_name
protected

What's the name of the current stage? Will be empty if no stage is running.

◆ stages

vector<Stage> vg::Funnel::stages
protected

Rercord all the stages, including their names and item provenance. Handles repeated stages.

◆ substage_name

string vg::Funnel::substage_name
protected

What's the name of the current substage? Will be empty if no substage is running.


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