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

#include <flat_file_back_translation.hpp>

Inheritance diagram for vg::FlatFileBackTranslation:
handlegraph::NamedNodeBackTranslation

Public Member Functions

 FlatFileBackTranslation (std::istream &stream)
 
virtual ~FlatFileBackTranslation ()=default
 
virtual std::vector< oriented_node_range_ttranslate_back (const oriented_node_range_t &range) const
 
virtual std::string get_back_graph_node_name (const nid_t &back_node_id) const
 
- Public Member Functions inherited from handlegraph::NamedNodeBackTranslation
virtual ~NamedNodeBackTranslation ()=default
 

Protected Attributes

std::unordered_map< nid_t, std::tuple< nid_t, size_t, size_t > > node_to_segment_and_offsets
 
std::unordered_map< nid_t, std::string > segment_to_name
 

Detailed Description

A NamedNodeBackTranslation loadable from a text file.

The file is a GFA-like tab-separated file with types of lines identified by a letter in the first field. It consists of 0 or more T lines, each giving a segment name and an assigned number for it. This is followed by 0 or more K lines, each giving a segment number, offsets along that segment in forward and then reverse orientations, and then the graph node ID that begins at that offset.

Note that an empty file is allowed, and that this format can only represent translations where nodes are broken up (and not merged) and where orientation does not change.

Many applications (such as loading the translation into a GBWTGraph) will expect the graph node IDs alogn a segment to be dense, contiguous, and increasing.

Constructor & Destructor Documentation

◆ FlatFileBackTranslation()

vg::FlatFileBackTranslation::FlatFileBackTranslation ( std::istream &  stream)

Create a FlatFileBackTranslation by reading it from an open file.

◆ ~FlatFileBackTranslation()

virtual vg::FlatFileBackTranslation::~FlatFileBackTranslation ( )
virtualdefault

Member Function Documentation

◆ get_back_graph_node_name()

std::string vg::FlatFileBackTranslation::get_back_graph_node_name ( const nid_t back_node_id) const
virtual

Get the name of a node in the graph that translate_back() translates into, given its number.

Implements handlegraph::NamedNodeBackTranslation.

◆ translate_back()

std::vector< oriented_node_range_t > vg::FlatFileBackTranslation::translate_back ( const oriented_node_range_t range) const
virtual

Translate the given range of bases on the given orientation of the given node in the current graph, to zero or more ranges on orientations of nodes in some prior graph.

Implements handlegraph::NamedNodeBackTranslation.

Member Data Documentation

◆ node_to_segment_and_offsets

std::unordered_map<nid_t, std::tuple<nid_t, size_t, size_t> > vg::FlatFileBackTranslation::node_to_segment_and_offsets
protected

This holds, for each node ID, the segment number and starting offset, if it is not offset 0, on each orientation of the segment with the same number as the node ID.

◆ segment_to_name

std::unordered_map<nid_t, std::string> vg::FlatFileBackTranslation::segment_to_name
protected

This holds, for each segment ID, the segment name, if it is not the string version of the segment number.


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