-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.cpp
83 lines (71 loc) · 1.88 KB
/
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
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
77
78
79
80
81
82
83
#include <ctime>
#include <string>
#include <sys/stat.h>
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/spdlog.h>
#include "caller.hpp"
#include "config.hpp"
#include "ping_pong.hpp"
#include "smoother.hpp"
using namespace std;
const string version = "v2.0.0";
int main(int argc, char **argv) {
time_t t;
time(&t);
spdlog::set_default_logger(spdlog::stderr_color_st("stderr"));
auto c = Configuration::getInstance();
if (argc == 1) {
c->print_help("");
exit(EXIT_FAILURE);
}
c->parse(argc, argv);
if (c->verbose)
spdlog::set_level(spdlog::level::debug);
if (c->version) {
cout << "SVDSS, " << version << endl;
exit(EXIT_SUCCESS);
}
if (c->help) {
c->print_help(argv[1]);
exit(EXIT_SUCCESS);
}
if (strcmp(argv[1], "call") == 0) {
if (c->reference == "" || c->bam == "" || c->sfs == "") {
c->print_help(argv[1]);
exit(EXIT_FAILURE);
}
auto caller = new Caller();
caller->run();
} else if (strcmp(argv[1], "index") == 0) {
if (c->reference == "" || c->index == "") {
c->print_help(argv[1]);
exit(EXIT_FAILURE);
}
auto pingpong = new PingPong();
pingpong->index();
} else if (strcmp(argv[1], "search") == 0) {
if (c->index == "" || (c->fastq == "" && c->bam == "")) {
c->print_help(argv[1]);
exit(EXIT_FAILURE);
}
auto pingpong = new PingPong();
pingpong->search();
// } else if (strcmp(argv[1], "assemble") == 0) {
// auto assembler = new Assembler();
// assembler->run();
} else if (strcmp(argv[1], "smooth") == 0) {
if (c->reference == "" || c->bam == "") {
c->print_help(argv[1]);
exit(EXIT_FAILURE);
}
auto smoother = new Smoother();
smoother->run();
} else {
c->print_help("");
exit(EXIT_FAILURE);
}
time_t s;
time(&s);
spdlog::info("All done! Runtime: {} seconds", s - t);
return 0;
}