Go to the documentation of this file. 1 #ifndef BIFROST_UNITIGMAP_HPP
2 #define BIFROST_UNITIGMAP_HPP
13 template<
typename U>
class Unitig;
15 template<
typename U,
typename G,
bool is_const>
class BackwardCDBG;
16 template<
typename U,
typename G,
bool is_const>
class ForwardCDBG;
91 template<
typename Unitig_data_t =
void,
typename Graph_data_t =
void,
bool is_const = false>
94 typedef Unitig_data_t U;
95 typedef Graph_data_t G;
97 template<
typename U,
typename G>
friend class CompactedDBG;
98 template<
typename U,
typename G,
bool C>
friend class BackwardCDBG;
99 template<
typename U,
typename G,
bool C>
friend class ForwardCDBG;
100 template<
typename U,
typename G,
bool C>
friend class unitigIterator;
101 template<
typename U,
typename G,
bool C>
friend class UnitigMap;
103 typedef typename std::conditional<is_const, const CompactedDBG<U, G>*,
CompactedDBG<U, G>*>::type CompactedDBG_ptr_t;
104 typedef typename std::conditional<is_const, const U*, U*>::type Unitig_data_ptr_t;
116 UnitigMap(
size_t length = 1, CompactedDBG_ptr_t cdbg_ =
nullptr);
126 UnitigMap(
const size_t start,
const size_t length,
const size_t unitig_sz,
const bool strand);
167 size_t lcp(
const char* s,
const size_t pos_s = 0,
const size_t pos_um_seq = 0,
const bool um_reversed =
false)
const;
243 inline CompactedDBG_ptr_t
getGraph()
const {
return cdbg; }
249 um.isEmpty = isEmpty;
254 void setFullCoverage()
const;
255 void increaseCoverage()
const;
256 void decreaseCoverage()
const;
258 bool isCoverageFull()
const;
259 size_t getCoverage(
const size_t pos)
const;
263 UnitigMap(
size_t p_unitig,
size_t i,
size_t l,
size_t sz,
bool short_,
bool abundance,
bool strd, CompactedDBG_ptr_t cdbg_);
271 template<
bool is_
void>
typename std::enable_if<!is_void, Unitig<U>>::type splitData_(
const bool last_split)
const;
272 template<
bool is_
void>
typename std::enable_if<is_void, Unitig<U>>::type splitData_(
const bool last_split)
const;
274 Unitig<U> splitData(
const bool last_split)
const;
276 template<
bool is_
void>
typename std::enable_if<!is_void, Unitig_data_ptr_t>::type getData_()
const;
277 template<
bool is_
void>
typename std::enable_if<is_void, Unitig_data_ptr_t>::type getData_()
const;
286 CompactedDBG_ptr_t cdbg;
289 template<
typename Unitig_data_t =
void,
typename Graph_data_t =
void,
bool is_const = false>
292 typedef Unitig_data_t U;
293 typedef Graph_data_t G;
297 struct UnitigMapTMP {
312 UnitigMapTMP(
const UnitigMap<U, G, is_const>& um) : pos_unitig(um.pos_unitig), dist(um.dist), len(um.len), size(um.size),
313 strand(um.strand), isEmpty(um.isEmpty), isShort(um.isShort),
314 isAbundant(um.isAbundant), cdbg(
static_cast<const void*
>(um.cdbg)) {};
317 UnitigMapTMP tmp(um);
320 return static_cast<size_t>(wyhash(&tmp,
sizeof(UnitigMapTMP), 0, _wyp));
324 #include "UnitigMap.tcc"
Kmer getUnitigKmer(const size_t pos) const
Get the k-mer starting at position pos in the reference unitig used for the mapping.
UnitigMap_FW getSuccessors() const
Create a UnitigMap_FW object that can create iterators (through UnitigMap_FW::begin() and UnitigMap_F...
string referenceUnitigToString() const
Create a string containing the sequence of the reference unitig used the mapping.
bool isEmpty
True if there is no mapping.
Definition: UnitigMap.hpp:65
string mappedSequenceToString() const
Create a string containing the sequence corresponding to the mapping.
Interface to store and manipulate k-mers.
Definition: Kmer.hpp:42
size_t size
Length of the reference unitig.
Definition: UnitigMap.hpp:62
Definition: UnitigMap.hpp:290
bool strand
True if the mapped k-mer or sequence matches the forward strand, false if it matches its reverse-comp...
Definition: UnitigMap.hpp:64
size_t len
Length of the mapping on the reference unitig, in k-mers.
Definition: UnitigMap.hpp:61
size_t dist
Start position of the mapping (0-based distance) from the start of the reference unitig.
Definition: UnitigMap.hpp:60
bool isSameReferenceUnitig(const UnitigMap &o) const
check if two UnitigMap have the same unitig as reference.
Contain all the information for the mapping of a k-mer or a sequence to a unitig of a Compacted de Br...
Definition: UnitigMap.hpp:92
UnitigMap_BW getPredecessors() const
Create a UnitigMap_BW object that can create iterators (through UnitigMap_BW::begin() and UnitigMap_B...
Kmer getMappedTail() const
Get the tail k-mer of the mapped sequence.
Kmer getUnitigTail() const
Get the tail k-mer of the reference unitig used for the mapping.
Wrapper for class neighborIterator to iterate over the predecessors of a reference unitig used in a U...
Definition: NeighborIterator.hpp:116
Wrapper for class neighborIterator to iterate over the predecessors of a reference unitig used in a U...
Definition: NeighborIterator.hpp:162
bool operator!=(const UnitigMapBase &o) const
Inequality operator: check if two UnitigMapBase are different.
bool operator==(const UnitigMapBase &o) const
Equality operator: check if two UnitigMapBase are the same.
bool operator!=(const UnitigMap &o) const
Inequality operator: check if two UnitigMap are different.
Kmer getUnitigHead() const
Get the head k-mer of the reference unitig used for the mapping.
UnitigMapBase(const size_t start, const size_t length, const size_t unitig_sz, const bool strand)
UnitigMapBase constructor (isEmpty = false).
Iterator for the neighbors (predecessors or successors) of a reference unitig used in a UnitigMap obj...
Definition: NeighborIterator.hpp:34
Iterator for the unitigs of a Compacted de Bruijn graph.
Definition: UnitigIterator.hpp:36
Kmer getMappedKmer(const size_t pos) const
Get the k-mer starting at position pos in the mapped sequence.
size_t lcp(const char *s, const size_t pos_s=0, const size_t pos_um_seq=0, const bool um_reversed=false) const
Compute the length of the longest common prefix between a given sequence and the reference unitig use...
CompactedDBG_ptr_t getGraph() const
Get a pointer to the CompactedDBG containing the reference unitig used in the mapping.
Definition: UnitigMap.hpp:243
Represent a unitig which is a vertex of the Compacted de Bruijn graph.
Definition: Unitig.hpp:22
UnitigMap(size_t length=1, CompactedDBG_ptr_t cdbg_=nullptr)
UnitigMap constructor.
Interface for the class Kmer:
UnitigMapBase(const size_t length=1)
UnitigMapBase constructor (isEmpty = true).
Structure containing the basic information of a unitig mapping.
Definition: UnitigMap.hpp:33
Unitig_data_ptr_t getData() const
Get a pointer to the data associated with the reference unitig used in the mapping.
Kmer getMappedHead() const
Get the head k-mer of the mapped sequence.
Represent a Compacted de Bruijn graph.
Definition: CompactedDBG.hpp:313
UnitigMap< U, G, is_const > getKmerMapping(const size_t pos) const
Create a new UnitigMap object which is the mapping of a k-mer on a reference unitig.
UnitigMap(const size_t start, const size_t length, const size_t unitig_sz, const bool strand)
UnitigMap constructor.
bool operator==(const UnitigMap &o) const
Equality operator: check if two UnitigMap are the same.