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

#include <feature_set.hpp>

Classes

struct  Feature
 

Public Member Functions

void load_bed (istream &in)
 
void save_bed (ostream &out) const
 
void on_path_edit (const string &path, size_t start, size_t old_length, size_t new_length)
 
const vector< Feature > & get_features (const string &path) const
 

Private Attributes

map< string, vector< Feature > > features
 Stores all the loaded features by path name. More...
 

Detailed Description

Stores a bunch of features defined on paths, as would be found in a BED file, and listens for messages describing edits to the paths that the features are on. Edit operations are of the form "On path X, range Y to Z has been replaced with a segment of length W". Updates the positions and boundaries of features appropriately.

Originally designed to allow BED files to be carried through "vg simplify", but could be used for other annotation liftover tasks.

Member Function Documentation

◆ get_features()

const vector< FeatureSet::Feature > & vg::FeatureSet::get_features ( const string &  path) const

Get the features on a path. Generally used for testing.

◆ load_bed()

void vg::FeatureSet::load_bed ( istream &  in)

Read features from the given BED stream. Adds them to the collection of loaded features.

◆ on_path_edit()

void vg::FeatureSet::on_path_edit ( const string &  path,
size_t  start,
size_t  old_length,
size_t  new_length 
)

Notify the FeatureSet that, at the given path, from the given start position, the given number of bases bave been replaced with the other given number of bases. Can handle pure inserts, pure deletions, length- preserving substitutions, and general length-changing substitutions.

Updates the contained features that need to change.

Note that this is currently O(n) in features on the path. TODO: come up with a truly efficient algorithm to back this using some kind of skip list or rope or something.

◆ save_bed()

void vg::FeatureSet::save_bed ( ostream &  out) const

Save features to the given BED stream.

Member Data Documentation

◆ features

map<string, vector<Feature> > vg::FeatureSet::features
private

Stores all the loaded features by path name.


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