Bifrost
|
Represent the k-mer color sets of a unitig. More...
Data Structures | |
class | UnitigColors_const_iterator |
See UnitigColors::const_iterator. More... | |
Public Types | |
typedef UnitigColors_const_iterator | const_iterator |
Iterator for the colors of a unitig. More... | |
Public Member Functions | |
UnitigColors () | |
Constructor (set up an empty container of k-mer color sets). | |
UnitigColors (const UnitigColors &o) | |
Copy constructor. More... | |
UnitigColors (UnitigColors &&o) | |
Move constructor. More... | |
~UnitigColors () | |
Destructor. | |
UnitigColors & | operator= (const UnitigColors &o) |
Copy assignment operator. More... | |
UnitigColors & | operator= (UnitigColors &&o) |
Move assignment operator. More... | |
void | clear () |
Empty a UnitigColors of its content. | |
bool | isEqual (const UnitigMapBase &um, const UnitigColors &o, const UnitigMapBase &um_o) const |
Check if two UnitigColors are equal. More... | |
bool | isEmpty () const |
Check if a UnitigColors is empty (no colors). More... | |
void | add (const UnitigMapBase &um, const size_t color_id) |
Add a color in the current UnitigColors to all k-mers of a unitig mapping. More... | |
void | remove (const UnitigMapBase &um, const size_t color_id) |
Remove a color in the current UnitigColors for all k-mers of a unitig mapping. More... | |
bool | contains (const UnitigMapBase &um, const size_t color_id) const |
Check if a color is present on all k-mers of a unitig mapping. More... | |
size_t | size (const UnitigMapBase &um) const |
Get the number of pairs (k-mer position, color) of a reference unitig. More... | |
size_t | size (const UnitigMapBase &um, const size_t color_id) const |
Get the number of k-mers of a reference unitig having a given color. More... | |
size_t | colorMax (const UnitigMapBase &um) const |
Get the largest color index of all k-mers of a reference unitig. More... | |
bool | write (ostream &stream_out, const bool copy_UnitigColors=true) const |
Write a UnitigColors to a stream. More... | |
bool | read (istream &stream_in) |
Read a UnitigColors from a stream. More... | |
size_t | getSizeInBytes () const |
Size of the UnitigColors in bytes. More... | |
const_iterator | begin (const UnitigMapBase &um) const |
Create a constant iterator on all pairs (k-mer position, color) of the UnitigColors. More... | |
const_iterator | end () const |
Create a constant iterator to the "past-the-last" pair (k-mer position, color) of the UnitigColors. More... | |
bool | optimizeFullColors (const UnitigMapBase &um) |
If possible, decrease the memory usage of the UnitigColors by optimizing the memory for "full
colors" (a color is "full" when it is present on all k-mers of the reference unitig). More... | |
Represent the k-mer color sets of a unitig.
Iterator for the colors of a unitig.
The iterator iterates over the colors of a unitig in ascending order. For each color, it iterates over the positions of the mapped k-mers (UnitigMap parameter of UnitigColors::begin()) having this color, in ascending order.
UnitigColors::UnitigColors | ( | const UnitigColors & | o | ) |
Copy constructor.
After the call to this constructor, the same UnitigColors object exists twice in memory.
o | is the color set to copy. |
UnitigColors::UnitigColors | ( | UnitigColors && | o | ) |
Move constructor.
After the call to this constructor, the UnitigColors to move is empty: its content has been transfered (moved) to a new UnitigColors.
o | is the color set to move. |
void UnitigColors::add | ( | const UnitigMapBase & | um, |
const size_t | color_id | ||
) |
Add a color in the current UnitigColors to all k-mers of a unitig mapping.
um | is a UnitigMapBase object representing a mapping to a reference unitig for which the color must be added. The color will be added only for the given mapping, i.e, unitig[um.dist..um.dist+um.len+k-1] |
color_id | is the ID of the color to add. |
const_iterator UnitigColors::begin | ( | const UnitigMapBase & | um | ) | const |
Create a constant iterator on all pairs (k-mer position, color) of the UnitigColors.
The iterator goes from the smallest to the largest color index. For each such color index, the iterator goes from the smallest to the largest k-mer position.
size_t UnitigColors::colorMax | ( | const UnitigMapBase & | um | ) | const |
Get the largest color index of all k-mers of a reference unitig.
um | is a UnitigMapBase object representing a mapping to a reference unitig. |
bool UnitigColors::contains | ( | const UnitigMapBase & | um, |
const size_t | color_id | ||
) | const |
Check if a color is present on all k-mers of a unitig mapping.
um | is a UnitigMapBase object representing a mapping to a reference unitig. All k-mers of this mapping will be checked for the presence of the color. If true is returned, all k-mers of the mapping have the color. If false is returned, at least one k-mer of the mapping does not have the color. |
color_id | is the ID of the color to check the presence. |
const_iterator UnitigColors::end | ( | ) | const |
Create a constant iterator to the "past-the-last" pair (k-mer position, color) of the UnitigColors.
size_t UnitigColors::getSizeInBytes | ( | ) | const |
Size of the UnitigColors in bytes.
|
inline |
Check if a UnitigColors is empty (no colors).
bool UnitigColors::isEqual | ( | const UnitigMapBase & | um, |
const UnitigColors & | o, | ||
const UnitigMapBase & | um_o | ||
) | const |
Check if two UnitigColors are equal.
um | is a UnitigMapBase object representing the reference unitig to which the current UnitigColors calling this function (this) is associated. |
o | is the UnitigColors to compare to the current UnitigColors calling this function (this). |
um_o | is a UnitigMapBase object representing the reference unitig to which the input UnitigColors o (parameter) is associated. |
UnitigColors& UnitigColors::operator= | ( | const UnitigColors & | o | ) |
Copy assignment operator.
After the call to this operator, the same UnitigColors object exists twice in memory.
o | is the UnitigColors to copy. |
UnitigColors& UnitigColors::operator= | ( | UnitigColors && | o | ) |
Move assignment operator.
After the call to this operator, the UnitigColors to move is empty: its content has been transfered (moved) to another UnitigColors.
o | is the UnitigColors to move. |
bool UnitigColors::optimizeFullColors | ( | const UnitigMapBase & | um | ) |
If possible, decrease the memory usage of the UnitigColors by optimizing the memory for "full colors" (a color is "full" when it is present on all k-mers of the reference unitig).
um | is a UnitigMapBase object representing a mapping to a reference unitig. |
bool UnitigColors::read | ( | istream & | stream_in | ) |
Read a UnitigColors from a stream.
stream_in | is an in stream from which the UnitigColors must be read. It must be opened prior to the call of this function and it won't be closed by this function. |
void UnitigColors::remove | ( | const UnitigMapBase & | um, |
const size_t | color_id | ||
) |
Remove a color in the current UnitigColors for all k-mers of a unitig mapping.
um | is a UnitigMapBase object representing a mapping to a reference unitig for which the color must be removed. The color will be removed only for the given mapping, i.e, unitig[um.dist..um.dist+um.len+k-1] |
color_id | is the ID of the color to remove. |
size_t UnitigColors::size | ( | const UnitigMapBase & | um | ) | const |
Get the number of pairs (k-mer position, color) of a reference unitig.
size_t UnitigColors::size | ( | const UnitigMapBase & | um, |
const size_t | color_id | ||
) | const |
Get the number of k-mers of a reference unitig having a given color.
um | is a UnitigMapBase object representing a mapping to a reference unitig. |
color_id | is the color index. |
bool UnitigColors::write | ( | ostream & | stream_out, |
const bool | copy_UnitigColors = true |
||
) | const |
Write a UnitigColors to a stream.
stream_out | is an out stream to which the UnitigColors must be written. It must be opened prior to the call of this function and it won't be closed by this function. |