Bifrost: CCDBG_Data_t< Unitig_data_t > Class Template Reference

Bifrost

Public Member Functions
CCDBG_Data_t< Unitig_data_t > Class Template Reference

If data are to be associated with the unitigs of the colored and compacted de Bruijn graph, those data must be wrapped into a class that inherits from the abstract class CCDBG_Data_t. More...

## Public Member Functions
void | clear (const UnitigColorMap< U > &um_dest)
| Clear the data associated with a unitig. More...
void | concat (const UnitigColorMap< U > &um_dest, const UnitigColorMap< U > &um_src)
| Join data of two unitigs which are going to be concatenated. More...
void | merge (const UnitigColorMap< U > &um_dest, const const_UnitigColorMap< U > &um_src)
| Merge the data of a sub-unitig B to the data of a sub-unitig A. More...
void | extract (const UnitigColors *uc_dest, const UnitigColorMap< U > &um_src, const bool last_extraction)
| Extract data corresponding to a sub-unitig of a unitig A. More...
string | serialize (const const_UnitigColorMap< U > &um_src) const
| Serialize the data to a GFA-formatted string. More...

## Detailed Description

### template<typename Unitig_data_t>
class CCDBG_Data_t< Unitig_data_t >

If data are to be associated with the unitigs of the colored and compacted de Bruijn graph, those data must be wrapped into a class that inherits from the abstract class CCDBG_Data_t.

To associate data of type "MyUnitigData" to unitigs, class MyUnitigData must be declared as follows:

class MyUnitigData : public CCDBG_Data_t<MyUnitigData> { ... };
...
ColoredCDBG<MyUnitigData> ccdbg;

An object of type MyUnitigData represents an instanciation of user data associated to one unitig of the graph. CCDBG_Data_t has one template parameter: the type of unitig data ("MyUnitigData"). Because CCDBG_Data_t is an abstract class, all the methods of the base class (CCDBG_Data_t) must be implemented in your wrapper (the derived class, aka MyUnitigData in this example). IMPORTANT: If you do not implement those methods, default ones that have no effects will be applied. Do not forget to implement copy and move constructors/destructors as well as copy and move assignment operators. An example of using such a structure is shown in snippets/test.cpp.

## Member Function Documentation

## ◆ clear()

template<typename Unitig_data_t >

void CCDBG_Data_t< Unitig_data_t >::clear | ( | const UnitigColorMap< U > & | um_dest | ) |
| inline

Clear the data associated with a unitig.

Parameters

  um_dest | is a UnitigColorMap object representing a unitig (the reference sequence of um_dest) for which the data must be cleared. The object calling this function represents the data associated with the reference unitig of um_dest.

## ◆ concat()

template<typename Unitig_data_t >

void CCDBG_Data_t< Unitig_data_t >::concat | ( | const UnitigColorMap< U > & | um_dest,
|  | const UnitigColorMap< U > & | um_src
| ) |  |
| inline

Join data of two unitigs which are going to be concatenated.

Specifically, if A is the reference unitig of the UnitigColorMap um_dest and B is the reference unitig of the UnitigColorMap um_src, then after the call to this function, unitigs A and B will be removed and a unitig C = AB will be added to the graph. The object calling this function represents the data to associate with the new unitig C = AB. If um_dest.strand = false, then the reverse-complement of A is going to be used in the concatenation. Reciprocally, if um_src.strand = false, then the reverse-complement of B is going to be used in the concatenation. The data of each unitig can be accessed through the method UnitigColorMap::getData(). The two unitigs A and B are guaranteed to be from the same graph.

Parameters

  um_dest | is a UnitigColorMap object representing a unitig (the reference sequence of the mapping) to which another unitig is going to be appended. The object calling this function represents the data associated with the reference unitig of um_dest.
  um_src | is a UnitigColorMap object representing a unitig (and its data) that will be appended at the end of the unitig represented by parameter um_dest.

## ◆ extract()

template<typename Unitig_data_t >

void CCDBG_Data_t< Unitig_data_t >::extract | ( | const UnitigColors * | uc_dest,
|  | const UnitigColorMap< U > & | um_src,
|  | const bool | last_extraction
| ) |  |
| inline

Extract data corresponding to a sub-unitig of a unitig A.

The extracted sub-unitig, called B in the following, is defined as a mapping to A given by the input UnitigColorMap object um_src. Hence, B = A[um_src.dist, um_src.dist + um_src.len + k - 1] or B = rev(A[um_src.dist, um_src.dist + um_src.len + k - 1]) if um_src.strand == false (B is reverse-complemented). After this function returns, unitig A is deleted from the graph and B is inserted in the graph (along with their data and colors) IF the input parameter last_extraction == true. The object calling this function represents the data associated with sub-unitig B.

Parameters

  uc_dest | is a constant pointer to a UnitigColors object representing the k-mer color sets of colored unitig B. If uc_dest == nullptr, no UnitigColors object will be associated with unitig B.
  um_src | is a UnitigColorMap object representing the mapping to a colored unitig A from which a new colored unitig B will be extracted, i.e, B = A[um_src.dist, um_src.dist + um_src.len + k - 1] or B = rev(A[um_src.dist, um_src.dist + um_src.len + k - 1]) if um_src.strand == false.
  last_extraction | is a boolean indicating if this is the last call to this function on the reference unitig A used for the mapping given by um_src. If last_extraction is true, the reference unitig A of um_src will be removed from the graph right after this function returns. Also, all unitigs B extracted from the reference unitig A, along with their data and colors, will be inserted in the graph.

## ◆ merge()

template<typename Unitig_data_t >

void CCDBG_Data_t< Unitig_data_t >::merge | ( | const UnitigColorMap< U > & | um_dest,
|  | const const_UnitigColorMap< U > & | um_src
| ) |  |
| inline

Merge the data of a sub-unitig B to the data of a sub-unitig A.

The object calling this function represents the data associated with the reference unitig of um_dest. The two unitigs A and B are NOT guaranteed to be from the same graph. The data of each unitig can be accessed through the UnitigMap::getData.

Parameters

  um_dest | is a UnitigColorMap object representing a sub-unitig (the mapped sequence of the mapping) A. The object calling this function represents the data associated with the reference unitig of um_dest.
  um_src | is a UnitigColorMap object representing a sub-unitig (the mapped sequence of the mapping) for which the data must be merged with the data of sub-unitig B (given by parameter um_dest).

## ◆ serialize()

template<typename Unitig_data_t >

string CCDBG_Data_t< Unitig_data_t >::serialize | ( | const const_UnitigColorMap< U > & | um_src | ) | const
| inline

Serialize the data to a GFA-formatted string.

This function is used when the graph is written to disk in GFA format. If the returned string is not empty, the string is appended as an optional field to the Segment line matching the unitig to which this data is associated. Note that it is your responsability to add GFA-compatible tags matching your data in the string.

Parameters

  um_src | is a const_UnitigColorMap object representing the (reference) unitig to which the data to serialize is associated.

Returns
  a string which is the serialization of the data.

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

- src/ColoredCDBG.hpp