-
Notifications
You must be signed in to change notification settings - Fork 3
/
deBruijnGraph.h
59 lines (50 loc) · 2.04 KB
/
deBruijnGraph.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef DBG_H
#define DBG_H
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <fstream>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <limits>
#include <functional>
#include <cstring>
#include <ctime> //debug
#include <boost/iostreams/device/file.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include "Vertex.h"
#include "Sequence.h"
class deBruijnGraph
{
public:
deBruijnGraph(unsigned int k, std::unordered_map<Sequence, Vertex>); // creates graph from subgraph
deBruijnGraph(std::string filename); // create from file
deBruijnGraph(std::string filename, unsigned int k); // builds the deBruijn graph from file
inline static char complement(const char& c){switch (c){case 'A' : return 'T'; case 'C' : return 'G'; case 'G' : return 'C'; case 'T' : return 'A'; default: return 'N';};}
friend std::ostream& operator<<(std::ostream& os, const deBruijnGraph& dbg);
friend class UnitigGraph;
void markCycles();
unsigned int split_ccs();
std::vector<std::map<unsigned int, unsigned int>> coverageDistribution(unsigned int ccs) const;
std::vector<std::string> getSources() const; // returns all sources
std::vector<std::string> getSinks() const; // returns all sinks in graph
std::pair<std::vector<Sequence>, std::vector<Sequence> > getJunctions() const;
const Sequence* getSequence(const std::string&);
Vertex* getVertex(const std::string&); // return the vertex corresponding to kmer, 0 if not found
unsigned int getK() const; // return the value of k
void printGraph() const; //debug
int getSize() const; // returns number of vertices in graph
void debug(); // debug
private:
unsigned int split_read(const std::string&); // given the read, inserts its kmers in the graph
std::vector<const Sequence*> dfs(Sequence&, unsigned int); // depth first search
std::unordered_map<Sequence, Vertex> graph_;
unsigned int k_; //kmer size
unsigned int read_length_; // length of longest read
};
#endif