-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.cpp
95 lines (91 loc) · 3.03 KB
/
config.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
84
85
86
87
88
89
90
91
92
93
94
95
#include "config.hpp"
Configuration* Configuration::instance = nullptr ;
Configuration* Configuration::getInstance() {
if (instance == nullptr) {
instance = new Configuration() ;
}
return instance ;
}
Configuration::Configuration() :
parser("Stella, mapping-free variation discovery.") {
parser.add_options()
("bed", "", cxxopts::value<std::string>())
("bam", "", cxxopts::value<std::string>())
("vcf", "", cxxopts::value<std::string>())
("type", "", cxxopts::value<std::string>())
("index", "", cxxopts::value<std::string>())
("fasta", "", cxxopts::value<std::string>())
("fastq", "", cxxopts::value<std::string>())
("cutoff", "", cxxopts::value<int>())
("t,threads", "", cxxopts::value<int>())
("append", "", cxxopts::value<std::string>())
("workdir", "", cxxopts::value<std::string>())
("coverage", "", cxxopts::value<int>())
("reference", "", cxxopts::value<std::string>())
("b,binary", "", cxxopts::value<bool>()->default_value("false"))
("aggregate", "", cxxopts::value<bool>())
("batches", "", cxxopts::value<int>())
("overlap", "", cxxopts::value<int>())
("min-length", "", cxxopts::value<int>())
;
}
void Configuration::parse(int argc, char** argv) {
auto results = parser.parse(argc, argv) ;
if (results.count("vcf")) {
vcf = results["vcf"].as<std::string>() ;
}
bam = "" ;
if (results.count("bam")) {
bam = results["bam"].as<std::string>() ;
}
if (results.count("bed")) {
bed = results["bed"].as<std::string>() ;
}
if (results.count("type")) {
type = results["type"].as<std::string>() ;
}
if (results.count("index")) {
index = results["index"].as<std::string>() ;
}
fastq = "" ;
if (results.count("fastq")) {
fastq = results["fastq"].as<std::string>() ;
}
fasta = "" ;
if (results.count("fasta")) {
fasta = results["fasta"].as<std::string>() ;
}
if (results.count("cutoff")) {
cutoff = results["cutoff"].as<int>() ;
}
if (results.count("overlap")) {
overlap = results["overlap"].as<int>() ;
}
if (results.count("threads")) {
threads = results["threads"].as<int>() ;
}
if (results.count("workdir")) {
workdir = results["workdir"].as<std::string>() ;
} else {
workdir = "." ;
}
if (results.count("append")) {
append = results["append"].as<std::string>() ;
} else {
append = "" ;
}
if (results.count("coverage")) {
coverage = results["coverage"].as<int>() ;
}
if (results.count("reference")) {
reference = results["reference"].as<std::string>() ;
}
if (results.count("batches")) {
aggregate_batches = results["batches"].as<int>() ;
}
if (results.count("min-length")) {
min_string_length = results["min-length"].as<int>() ;
}
binary = results["binary"].as<bool>() ;
aggregate = results["aggregate"].as<bool>() ;
}