Bifrost
|
Represent a color set for a unitig. More...
Data Structures | |
class | ColorSet_const_iterator |
Public Member Functions | |
ColorSet () | |
Color set constructor (set up an empty color set). More... | |
~ColorSet () | |
Color set destructor. | |
ColorSet (const ColorSet &o) | |
Color set copy constructor. More... | |
ColorSet (ColorSet &&o) | |
Color set move constructor. More... | |
ColorSet & | operator= (const ColorSet &o) |
Color set copy assignment operator. More... | |
ColorSet & | operator= (ColorSet &&o) |
Color set move assignment operator. More... | |
void | empty () |
Empty a color set. | |
void | setUnoccupied () |
Empty a color set and set it as "unoccupied": the color set is "free" to be used, it is not associated with any unitig. | |
void | setOccupied () |
Set the color set as "occupied": the color set is NOT "free" to be used, it is now associated with a unitig. | |
bool | isUnoccupied () const |
Get if the color set as "unoccupied" (NOT associated with a unitig). More... | |
bool | isOccupied () const |
Get if the color set as "occupied" (associated with a unitig). More... | |
void | add (const UnitigMap< HashID > &um, const size_t color_id) |
Add a color in the current color set for a unitig or a sub-unitig. More... | |
bool | contains (const UnitigMap< HashID > &um, const size_t color_id) const |
Check if a color is present on a unitig or a sub-unitig. More... | |
ColorSet | reverse (const size_t len_unitig) const |
Reverse the order of the colors. More... | |
size_t | size () const |
Get the number of colors (total number of colors associated with a unitig). More... | |
const_iterator | begin () const |
Create a constant iterator to the first color of the color set. More... | |
const_iterator | end () const |
Create a constant iterator to the the "past-the-last" color of the color set. More... | |
bool | write (ostream &stream_out) const |
Write a color set. More... | |
void | optimize () |
Optimize the memory of a color set. More... | |
Represent a color set for a unitig.
The number of colors in such a set , i.e number of k-mers in unitig * number of color per k-mer, can't exceed 2^32
ColorSet::ColorSet | ( | ) |
Color set constructor (set up an empty color set).
The color set is initialized as "unoccupied": the color set is "free" to be used, it is not associated with any unitig.
ColorSet::ColorSet | ( | const ColorSet & | o | ) |
Color set copy constructor.
After the call to this constructor, the same color set exists twice in memory.
o | is the color set to copy. |
ColorSet::ColorSet | ( | ColorSet && | o | ) |
Color set move constructor.
After the call to this constructor, the color set to move is empty, its content has been transfered (moved) to the new color set.
o | is the color set to move. |
void ColorSet::add | ( | const UnitigMap< HashID > & | um, |
const size_t | color_id | ||
) |
Add a color in the current color set for a unitig or a sub-unitig.
um | is a UnitigMap representing the mapping of a unitig for which the color must be added. The color will be added only for the sub-unitig mapped, i.e, unitig[um.dist..um.dist+um.len+k-1] |
color_id | is the ID of the color to add. |
|
inline |
Create a constant iterator to the first color of the color set.
bool ColorSet::contains | ( | const UnitigMap< HashID > & | um, |
const size_t | color_id | ||
) | const |
Check if a color is present on a unitig or a sub-unitig.
um | is a UnitigMap representing the mapping of a unitig for which the color presence must be checked. The color will be checked only for the sub-unitig mapped, i.e, unitig[um.dist..um.dist+um.len+k-1] |
color_id | is the ID of the color to check. |
|
inline |
Create a constant iterator to the the "past-the-last" color of the color set.
|
inline |
Get if the color set as "occupied" (associated with a unitig).
|
inline |
Get if the color set as "unoccupied" (NOT associated with a unitig).
Color set copy assignment operator.
After the call to this operator, the same color set exists twice in memory.
o | is the color set to copy. |
Color set move assignment operator.
After the call to this operator, the color set to move is empty, its content has been transfered (moved) to another color set.
o | is the color set to move. |
|
inline |
Optimize the memory of a color set.
Useful in case one or more sub-unitig share the same color.
ColorSet ColorSet::reverse | ( | const size_t | len_unitig | ) | const |
Reverse the order of the colors.
This function must be used if a unitig is reverse-complemented.
len_unitig | is the length of the unitig to which this color set is associated. |
size_t ColorSet::size | ( | ) | const |
Get the number of colors (total number of colors associated with a unitig).
bool ColorSet::write | ( | ostream & | stream_out | ) | const |
Write a color set.
stream_out | is an out stream to which the color set will be written. It must be opened prior to the call of this function and it won't be closed by this function. |