If data are to be associated with the unitigs of the compacted de Bruijn graph, those data must be wrapped into a class that inherits from the abstract class CDBG_Data_t.
More...
|
void | clear (const UnitigMap< Unitig_data_t, Graph_data_t > &um_dest) |
| Clear the data associated with a unitig. More...
|
|
void | concat (const UnitigMap< Unitig_data_t, Graph_data_t > &um_dest, const UnitigMap< Unitig_data_t, Graph_data_t > &um_src) |
| Join data of two unitigs which are going to be concatenated. More...
|
|
void | merge (const UnitigMap< Unitig_data_t, Graph_data_t > &um_dest, const const_UnitigMap< Unitig_data_t, Graph_data_t > &um_src) |
| Merge the data of a sub-unitig B to the data of a sub-unitig A. More...
|
|
void | extract (const UnitigMap< Unitig_data_t, Graph_data_t > &um_src, bool last_extraction) |
| Extract data corresponding to a sub-unitig of a unitig A. More...
|
|
string | serialize (const const_UnitigMap< Unitig_data_t, Graph_data_t > &um_src) const |
| Serialize the data to a GFA-formatted string. More...
|
|
template<typename Unitig_data_t, typename Graph_data_t = void>
class CDBG_Data_t< Unitig_data_t, Graph_data_t >
If data are to be associated with the unitigs of the compacted de Bruijn graph, those data must be wrapped into a class that inherits from the abstract class CDBG_Data_t.
Otherwise it will not compile. To associate data of type "MyUnitigData" to unitigs, class MyUnitigData must be declared as follows:
class MyUnitigData :
public CDBG_Data_t<MyUnitigData, MyGraphData> { ... };
...
CompactedCDBG<MyUnitigData, MyGraphData> cdbg;
An object of type MyUnitigData represents an instanciation of user data associated to one unitig of the graph. CDBG_Data_t has two template parameters: the type of unitig data ("MyUnitigData") and the type of graph data ("MyGraphData"). Indeed, if class MyUnitigData is going to be used in combination with class MyGraphData for a CompactedDBG, MyUnitigData must "know" the type MyGraphData for the parameters of its (mandatory) functions. If no graph data is used, you do not have to specify the template parameter MyGraphData or you can void it:
class MyUnitigData :
public CDBG_Data_t<MyUnitigData> { ... };
class MyUnitigData :
public CDBG_Data_t<MyUnitigData, void> { ... };
...
CompactedCDBG<MyUnitigData> cdbg;
Because CDBG_Data_t is an abstract class, all the methods from the base class (CDBG_Data_t) must be implemented in your wrapper (the derived class, aka MyUnitigData in this example). IMPORTANT: If you do not implement those methods in your class, default ones that have no effect 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.
template<typename Unitig_data_t , typename Graph_data_t = void>
void CDBG_Data_t< Unitig_data_t, Graph_data_t >::concat |
( |
const UnitigMap< Unitig_data_t, Graph_data_t > & |
um_dest, |
|
|
const UnitigMap< Unitig_data_t, Graph_data_t > & |
um_src |
|
) |
| |
|
inline |
Join data of two unitigs which are going to be concatenated.
Specifically, if A is the reference unitig of the UnitigMap um_dest and B is the reference unitig of the UnitigMap um_src, then after this function returns, unitigs A amd B will be removed and a unitig C = AB will be added to the graph. The object calling this function represents the data associated 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 two unitigs A and B are guaranteed to be from the same graph. The data of each unitig can be accessed through the UnitigMap::getData.
- Parameters
-
um_dest | is a UnitigMap 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 UnitigMap object representing a unitig (the reference sequence of the mapping) that will be appended at the end of the unitig represented by parameter um_dest. |
template<typename Unitig_data_t , typename Graph_data_t = void>
void CDBG_Data_t< Unitig_data_t, Graph_data_t >::extract |
( |
const UnitigMap< Unitig_data_t, Graph_data_t > & |
um_src, |
|
|
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 UnitigMap 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 the function returns, unitig A is deleted from the graph and B is inserted in the graph (along with their data) IF the input parameter last_extraction == true. The object calling this function represents the data to associate with sub-unitig B.
- Parameters
-
um_src | is a UnitigMap object representing the mapping to a unitig A from which a new 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 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, will be inserted in the graph. |