-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkMerificator.cpp
executable file
·148 lines (122 loc) · 3.08 KB
/
kMerificator.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
//============================================================================
// Name : kMerificator.cpp
// Author :
// Version :
// Copyright :
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
#include <vector>
#include <assert.h>
#include "Utilities.h"
#include "Validator.h"
using namespace std;
void errEx(std::string message);
int main(int argc, char *argv[]) {
vector<string> arguments (argv + 1, argv + argc + !argc);
int cortex_height = 26;
int cortex_width = 140;
int kMer_size = 31;
int threads = 40;
int maximumHaplotypePairs = 200;
bool onlyPASS = false;
string vcfFile;
string referenceGenome;
string deBruijnGraph;
string outputDirectory;
string regions;
for(unsigned int i = 0; i < arguments.size(); i++)
{
if(arguments.at(i) == "--vcf")
{
vcfFile = arguments.at(i+1);
}
if(arguments.at(i) == "--referenceGenome")
{
referenceGenome = arguments.at(i+1);
}
if(arguments.at(i) == "--deBruijnGraph")
{
deBruijnGraph = arguments.at(i+1);
}
if(arguments.at(i) == "--outputDirectory")
{
outputDirectory = arguments.at(i+1);
}
if(arguments.at(i) == "--cortex_height")
{
cortex_height = Utilities::StrtoI(arguments.at(i+1));
}
if(arguments.at(i) == "--cortex_width")
{
cortex_width = Utilities::StrtoI(arguments.at(i+1));
}
if(arguments.at(i) == "--k")
{
kMer_size = Utilities::StrtoI(arguments.at(i+1));
}
if(arguments.at(i) == "--threads")
{
threads = Utilities::StrtoI(arguments.at(i+1));
}
if(arguments.at(i) == "--onlyPASS")
{
onlyPASS = Utilities::StrtoI(arguments.at(i+1));
}
if(arguments.at(i) == "--maximumHaplotypePairs")
{
maximumHaplotypePairs = Utilities::StrtoI(arguments.at(i+1));
}
if(arguments.at(i) == "--regions")
{
regions = arguments.at(i+1);
}
}
if(vcfFile.length() == 0)
{
errEx("Please provide parameter --vcf");
}
if(referenceGenome.length() == 0)
{
errEx("Please provide parameter --referenceGenome");
}
if(deBruijnGraph.length() == 0)
{
errEx("Please provide parameter --deBruijnGraph (Cortex 1-colour binary)");
}
if(outputDirectory.length() == 0)
{
errEx("Please provide parameter --outputDirectory");
}
if(! Utilities::fileExists(vcfFile))
{
errEx("--vcf specifies a non-existing file.");
}
if(! Utilities::fileExists(referenceGenome))
{
errEx("--referenceGenome specifies a non-existing file.");
}
if(! Utilities::fileExists(deBruijnGraph))
{
errEx("--deBruijnGraph specifies a non-existing file.");
}
if(! Utilities::directoryExists(outputDirectory))
{
Utilities::makeDir(outputDirectory);
}
assert(Utilities::directoryExists(outputDirectory));
if(kMer_size == 31)
{
validateCompleteVCF<1, 31>(vcfFile, referenceGenome, deBruijnGraph, cortex_height, cortex_width, maximumHaplotypePairs, outputDirectory, threads, onlyPASS, regions);
}
else
{
errEx("Unsupported kMer size - use a different value for --k.");
}
return 0;
}
void errEx(std::string message)
{
cerr << message << "\n" << flush;
exit(1);
}