-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfasta.h
More file actions
47 lines (39 loc) · 963 Bytes
/
fasta.h
File metadata and controls
47 lines (39 loc) · 963 Bytes
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
#ifndef FASTA_H
#define FASTA_H
#include <string>
class fasta {
public:
int count = 0;
std::string** rosa;
fasta(const std::string& s) {
for (int i = 0; s[i] != '\0'; i++) {
if (s[i] == '>') count++;
}
rosa = new std::string*[count];
for (int i = 0; i < count; ++i) {
rosa[i] = new std::string[2];
rosa[i][0] = "";
rosa[i][1] = "";
}
int a = -1, b = 0;
for (int i = 0; s[i] != '\0'; i++) {
if (s[i] == '>') {
a++; b = 0;
continue;
}
else if (s[i] == '\n' && b == 0) {
b = 1;
continue;
}
else if (s[i] == '\n') continue;
rosa[a][b] += s[i];
}
}
~fasta() {
for (int i = 0; i < count; ++i) {
delete[] rosa[i];
}
delete[] rosa;
}
};
#endif // FASTA_H