-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
46 lines (45 loc) · 861 Bytes
/
main.cpp
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
#include <cassert>
#include <string>
#include <fstream>
#include <iostream>
#include <vector>
#include "PartSortBWT.h"
// usage: bin/main input_string_file > output_bwt_file
// computes BWT of the first line of input_string_file
int main(int argc, char** argv)
{
std::string seq;
{
std::ifstream file { argv[1] };
getline(file, seq);
}
for (size_t i = 0; i < seq.size(); i++)
{
switch(seq[i])
{
case 'A':
seq[i] = 2;
break;
case 'C':
seq[i] = 3;
break;
case 'G':
seq[i] = 4;
break;
case 'T':
seq[i] = 5;
break;
default:
seq[i] = 1;
break;
}
}
seq.push_back(0);
std::cerr << "size " << seq.size() << std::endl;
partSortBWT(seq, seq);
for (size_t i = 0; i < seq.size(); i++)
{
std::cout << "$NACGT"[seq[i]];
}
std::cout << std::endl;
}