Bifrost: src/DataAccessor.hpp Source File

Bifrost

DataAccessor.hpp
Go to the documentation of this file.
1 #ifndef BFG_DATAACCESSOR_HPP
2 #define BFG_DATAACCESSOR_HPP
3
4 #include "CompactedDBG.hpp"
5 #include "ColorSet.hpp"
6
13 template<typename U> using UnitigColorMap = UnitigMap<DataAccessor<U>, DataStorage<U>>;
14 template<typename U> using const_UnitigColorMap = const_UnitigMap<DataAccessor<U>, DataStorage<U>>;
15
20 template<typename Unitig_data_t = void>
21 class DataAccessor : public CDBG_Data_t<DataAccessor<Unitig_data_t>, DataStorage<Unitig_data_t>> {
22
23 typedef Unitig_data_t U;
24
25 template<typename U> friend class DataStorage;
26
27 public:
28
31 DataAccessor(const uint8_t id = 0);
32
38 void clear(const UnitigColorMap<U>& um);
39
45 const U* getData(const const_UnitigColorMap<U>& um) const;
46
52 U* getData(const UnitigColorMap<U>& um) const;
53
60 const UnitigColors* getUnitigColors(const const_UnitigColorMap<U>& um) const;
61
67 UnitigColors* getUnitigColors(const UnitigColorMap<U>& um) const;
68
76 UnitigColors getSubUnitigColors(const const_UnitigColorMap<U>& um) const;
77
82 vector<string> getSubUnitigColorNames(const const_UnitigColorMap<U>& um) const;
83
95 void concat(const UnitigColorMap<U>& um_dest, const UnitigColorMap<U>& um_src);
96
107 void merge(const UnitigColorMap<U>& um_dest, const const_UnitigColorMap<U>& um_src);
108
122 void extract(const UnitigColorMap<U>& um_src, const bool last_extraction);
123
131 string serialize(const const_UnitigColorMap<U>& um_src) const;
132
133 private:
134
135 inline uint8_t get() const { return da_id; }
136
137 inline void set(const uint8_t id) { da_id = id; }
138
139 uint8_t da_id;
140 };
141
142 #endif
DataAccessor::serialize
string serialize(const const_UnitigColorMap< U > &um_src) const
Serialize the data to a GFA-formatted string.
DataAccessor::extract
void extract(const UnitigColorMap< U > &um_src, const bool last_extraction)
Extract data and colors corresponding to a sub-unitig of a unitig A.
UnitigColors
Represent the k-mer color sets of a unitig.
Definition: ColorSet.hpp:21
DataAccessor::clear
void clear(const UnitigColorMap< U > &um)
Clear the colors and data associated with a colored unitig.
DataAccessor::DataAccessor
DataAccessor(const uint8_t id=0)
Constructor (set up an empty DataAccessor).
DataAccessor::getUnitigColors
const UnitigColors * getUnitigColors(const const_UnitigColorMap< U > &um) const
Get the colors of the reference unitig.
DataStorage
Definition: ColorSet.hpp:16
ColorSet.hpp
Interface for UnitigColors, the unitig container of k-mer color sets used in ColoredCDBG.
UnitigMap
Contain all the information for the mapping of a k-mer or a sequence to a unitig of a Compacted de Br...
Definition: NeighborIterator.hpp:12
CDBG_Data_t
If data are to be associated with the unitigs of the compacted de Bruijn graph, those data must be wr...
Definition: CompactedDBG.hpp:204
DataAccessor
Interface to access the colors and the data associated with a unitig of a ColoredCDBG.
Definition: ColorSet.hpp:15
DataAccessor::concat
void concat(const UnitigColorMap< U > &um_dest, const UnitigColorMap< U > &um_src)
Join data and colors of two colored unitigs which are going to be concatenated.
DataAccessor::merge
void merge(const UnitigColorMap< U > &um_dest, const const_UnitigColorMap< U > &um_src)
Merge the data and colors of a sub-unitig B to the data and colors of a sub-unitig A...
CompactedDBG.hpp
Interface for the Compacted de Bruijn graph API.
DataAccessor::getSubUnitigColors
UnitigColors getSubUnitigColors(const const_UnitigColorMap< U > &um) const
Create a new UnitigColors object for a unitig B corresponding to a unitig mapping to a reference unit...
DataAccessor::getSubUnitigColorNames
vector< string > getSubUnitigColorNames(const const_UnitigColorMap< U > &um) const
Obtain the name of the colors present on AT LEAST one k-mer of a unitig mapping.
DataAccessor::getData
const U * getData(const const_UnitigColorMap< U > &um) const
Get the unitig data.