-
Notifications
You must be signed in to change notification settings - Fork 2
/
read.hpp
77 lines (57 loc) · 1.71 KB
/
read.hpp
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef READ_HPP_
#define READ_HPP_
#include <vector>
#include <experimental/string_view>
#include <stdlib.h>
#include <pthread.h>
#include "error.hpp"
class Read{
public:
/* Parent and children */
Read *parent = NULL;
std::vector<int> children;
/* Bases */
std::experimental::string_view _bases;
int suffix;
/* Basic information */
int ID = -1; // ID
std::vector<int> rc;
int count = 1; // Number of times this read appeared in the input
int trieID = -1; // ID of the trie containing this read
int seq = -1; // ID of the sequence containing this read, or -1 if none
int seqId = -1; // ID in sequence, or -1 if none
bool merged = false; // For post-process
pthread_spinlock_t access;
/* Errors */
std::vector<Error> errors;
/* Constructors */
Read(std::experimental::string_view);
Read(std::experimental::string_view, int);
Read(std::experimental::string_view, int, int);
~Read(){
//if (parent != NULL) delete parent;
}
int getSuffixlength();
/* Sets my parent to PARENT (with overlap LENGTH) and return myself. */
Read* connect(Read*, int);
/* Disconnect a child read and return myself. */
Read* disconnect(Read*);
/* Test whether I am the ancestor of another read. */
bool isAncestor(Read*);
/* Test whether a read has children or not. */
bool hasChildren() {
return (!children.empty());
}
/* Get all bases. */
std::experimental::string_view bases();
/* Get last L bases. */
std::experimental::string_view bases(size_t l);
/* Get bases of length L from BEGIN_INDEX (inclusive) */
std::experimental::string_view bases(size_t begin_index, size_t l) {
return _bases.substr(begin_index, l);
}
std::experimental::string_view toString() {
return bases();
}
};
#endif