Bifrost: UnitigMap< T > Struct Template Reference

Bifrost

Public Member Functions | Data Fields
UnitigMap< T > Struct Template Reference

Contain all the information for the mapping of a k-mer or a sequence to a unitig of a Compacted de Bruijn graph. More...

## Public Member Functions
| UnitigMap (size_t l=1)
| UnitigMap constructor. More...
bool | operator== (const UnitigMap &o)
| Check if two UnitigMaps are the same. More...
bool | operator!= (const UnitigMap &o)
| Check if two UnitigMaps are different. More...
string | toString () const
| Return a string containing the sequence of the mapped unitig. More...
string | reverseToString () const
| Return a string containing the reverse-complement sequence of the mapped unitig. More...
Kmer | getHead () const
| Return the head k-mer of the mapped unitig. More...
Kmer | getTail () const
| Return the tail k-mer of the mapped unitig. More...
Kmer | getKmer (const size_t pos) const
| Return the k-mer starting at position pos in the mapped unitig. More...
const T * | getData () const
| Return a pointer to the data associated with the mapped unitig. More...
void | setData (const T *const data) const
| Set the data associated with a mapped unitig. More...
void | mergeData (const UnitigMap< T > &um)
| Merge the data of the mapped unitig with the data of another mapped unitig. More...
Unitig< T > | splitData (const bool last_split)
| Create new data to associate with a new unitig which is a sub-unitig of the current mapped unitig. More...
BackwardCDBG< T, true > | getPredecessors () const
| Return a constant BackwardCDBG object that can create iterators (through BackwardCDBG::begin() and BackwardCDBG::end()) over the predecessors of the current mapped unitig. More...
ForwardCDBG< T, true > | getSuccessors () const
| Return a constant BackwardCDBG object that can create iterators (through BackwardCDBG::begin() and BackwardCDBG::end()) over the successors of the current mapped unitig. More...
BackwardCDBG< T, false > | getPredecessors ()
| Return a BackwardCDBG object that can create iterators (through BackwardCDBG::begin() and BackwardCDBG::end()) over the predecessors of the current mapped unitig. More...
ForwardCDBG< T, false > | getSuccessors ()
| Return a BackwardCDBG object that can create iterators (through BackwardCDBG::begin() and BackwardCDBG::end()) over the successors of the current mapped unitig. More...

## Data Fields
size_t | dist
| 0-based distance of the match from start of the unitig
size_t | len
| Length of the match on the unitig (in k-mers)
size_t | size
| Length of the unitig.
bool | strand
| True if the k-mer or sequence matches the forward strand, false if it matches its reverse-complement.
bool | isEmpty
| True if the k-mer or sequence does not match a unitig of the graph, false otherwise.
CompactedDBG< T > * | cdbg
| Compacted de Bruijn graph containing the unitig associated with the mapping.

## Detailed Description

### template<typename T = void>
struct UnitigMap< T >

Contain all the information for the mapping of a k-mer or a sequence to a unitig of a Compacted de Bruijn graph.

Its template parameter indicates the type of data associated with the unitig and should be the same as the one specified for CompactedDBG. An example of using such a structure is shown in src/snippets.hpp.

## Constructor & Destructor Documentation

## ◆ UnitigMap()

template<typename T>

UnitigMap< T >::UnitigMap | ( | size_t | l = `1` | ) |

UnitigMap constructor.

Returns
  an empty UnitigMap.

## Member Function Documentation

## ◆ getData()

template<typename T >

const T * UnitigMap< T >::getData | ( |  | ) | const

Return a pointer to the data associated with the mapped unitig.

Returns
  a constant pointer to the data associated with the mapped unitig or a constant null pointer if there is no mapping (UnitigMap<T>::isEmpty = true) or no data associated with the unitigs (T = void).

## ◆ getHead()

template<typename T >

Kmer UnitigMap< T >::getHead | ( |  | ) | const

Return the head k-mer of the mapped unitig.

Returns
  a Kmer object which is either the head k-mer of the mapped unitig or an empty k-mer if there is no mapping (UnitigMap<T>::isEmpty = true).

## ◆ getKmer()

template<typename T >

Kmer UnitigMap< T >::getKmer | ( | const size_t | pos | ) | const

Return the k-mer starting at position pos in the mapped unitig.

Parameters

  pos | is the start position of the k-mer to extract.

Returns
  a Kmer object which is either the k-mer starting at position pos in the mapped unitig or an empty k-mer if there is either no mapping (UnitigMap<T>::isEmpty = true) or the position is greater than length(unitig)-k.

## ◆ getPredecessors() [1/2]

template<typename T >

BackwardCDBG< T, true > UnitigMap< T >::getPredecessors | ( |  | ) | const

Return a constant BackwardCDBG object that can create iterators (through BackwardCDBG::begin() and BackwardCDBG::end()) over the predecessors of the current mapped unitig.

Returns
  a constant BackwardCDBG object that can create iterators (through BackwardCDBG::begin() and BackwardCDBG::end()) over the predecessors of the current mapped unitig.

## ◆ getPredecessors() [2/2]

template<typename T >

BackwardCDBG< T, false > UnitigMap< T >::getPredecessors | ( |  | ) |

Return a BackwardCDBG object that can create iterators (through BackwardCDBG::begin() and BackwardCDBG::end()) over the predecessors of the current mapped unitig.

Returns
  a BackwardCDBG object that can create iterators (through BackwardCDBG::begin() and BackwardCDBG::end()) over the predecessors of the current mapped unitig.

## ◆ getSuccessors() [1/2]

template<typename T >

ForwardCDBG< T, true > UnitigMap< T >::getSuccessors | ( |  | ) | const

Return a constant BackwardCDBG object that can create iterators (through BackwardCDBG::begin() and BackwardCDBG::end()) over the successors of the current mapped unitig.

Returns
  a constant BackwardCDBG object that can create iterators (through BackwardCDBG::begin() and BackwardCDBG::end()) over the successors of the current mapped unitig.

## ◆ getSuccessors() [2/2]

template<typename T >

ForwardCDBG< T, false > UnitigMap< T >::getSuccessors | ( |  | ) |

Return a BackwardCDBG object that can create iterators (through BackwardCDBG::begin() and BackwardCDBG::end()) over the successors of the current mapped unitig.

Returns
  a BackwardCDBG object that can create iterators (through BackwardCDBG::begin() and BackwardCDBG::end()) over the successors of the current mapped unitig.

## ◆ getTail()

template<typename T >

Kmer UnitigMap< T >::getTail | ( |  | ) | const

Return the tail k-mer of the mapped unitig.

Returns
  a Kmer object which is either the tail k-mer of the mapped unitig or an empty k-mer if there is no mapping (UnitigMap<T>::isEmpty = true).

## ◆ mergeData()

template<typename T>

void UnitigMap< T >::mergeData | ( | const UnitigMap< T > & | um | ) |

Merge the data of the mapped unitig with the data of another mapped unitig.

This function calls the function CDBG_Data_t<T>::join but it does not set anything if there is no mapping (UnitigMap<T>::isEmpty = true) or no data associated with the unitigs (T = void).

Parameters

  um | is a reference to a mapped unitig that will be merged with the current mapped unitig.

## ◆ operator!=()

template<typename T >

bool UnitigMap< T >::operator!= | ( | const UnitigMap< T > & | o | ) |

Check if two UnitigMaps are different.

Returns
  a boolean indicating if the two UnitigMaps are different.

## ◆ operator==()

template<typename T >

bool UnitigMap< T >::operator== | ( | const UnitigMap< T > & | o | ) |

Check if two UnitigMaps are the same.

Returns
  a boolean indicating if the two UnitigMaps are the same.

## ◆ reverseToString()

template<typename T >

string UnitigMap< T >::reverseToString | ( |  | ) | const

Return a string containing the reverse-complement sequence of the mapped unitig.

Returns
  a string containing the reverse-complement sequence of the mapped unitig or an empty string if there is no mapping (UnitigMap<T>::isEmpty = true).

## ◆ setData()

template<typename T>

void UnitigMap< T >::setData | ( | const T *const | data | ) | const

Set the data associated with a mapped unitig.

The function does not set anything if there is no mapping (UnitigMap<T>::isEmpty = true) or no data associated with the unitigs (T = void).

Parameters

  data | is a pointer to the data that will be copied to the data associated with the mapped unitig.

## ◆ splitData()

template<typename T >

Unitig< T > UnitigMap< T >::splitData | ( | const bool | last_split | ) |

Create new data to associate with a new unitig which is a sub-unitig of the current mapped unitig.

Does not do anything if no data are associated with the unitigs (T = void).

Parameters

  last_split | is a boolean indicating this is the last call to UnitigMap<T>::splitData (true) on the current unitig mapped (this) or not (false).

Returns
  a Unitig object containing the new data. The unitig sequence and coverage are not set, only the data (if there are some).

## ◆ toString()

template<typename T >

string UnitigMap< T >::toString | ( |  | ) | const

Return a string containing the sequence of the mapped unitig.

Returns
  a string containing the sequence of the mapped unitig or an empty string if there is no mapping (UnitigMap<T>::isEmpty = true).

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

- src/UnitigMap.hpp
- src/UnitigMap.tpp