-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgems.cpp
More file actions
135 lines (113 loc) · 4.06 KB
/
gems.cpp
File metadata and controls
135 lines (113 loc) · 4.06 KB
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
#include <iostream>
#include <string>
#include <vector>
#include "core_functions.h"
using namespace std;
int main(int argc, char * argv[])
{
string listname = "list.txt";
string outfilename = "test.vcf";
vector<string> infilename;
//Parameters params;
params.sample_count = 0;
params.type = 3; //polidy
params.max_count = 255;//Max allele count
params.thread = 1;
params.ratio_nchar = 0.2;
params.ratio_del = 0.05;
params.step = 0.01;//Steps
params.eps = 0.001;
params.p_snp = 0.1;
//lFDR output filter with a default of 0.1. In this way, only sites with an estimated lFDR less than 0.1 should be provided in the final output. If a user decides to output all analyzed sites, he can change this parameter setting to 1
params.result_filter = 0.1;
params.one_circle_limit = 200;
params.end_condition = 0.5;
params.bp = 17;
params.mp = 20;
params.min = 1;
params.max = 200;
params.start_position = 16691745;
int arg_pos = 1;
if (argc == 1)
{
params.eps = 0.001;
//test();
printhelp();
}
params.debug = false;
while(arg_pos < argc)
{
if (argv[arg_pos][0] != '-')
{
cerr << "Argument " << arg_pos << " error : Arguments must start with -" << endl;
exit(0);
}
if (argv[arg_pos][1] == '\0')
{
cerr << "Argument " << arg_pos << " error : No option found" << endl;
exit(0);
}
int option_pos = arg_pos + 1;
switch(argv[arg_pos][1])
{
case 'i':
listname = argv[option_pos];
break;
case 'o':
outfilename = argv[option_pos];
break;
case 'n' :
params.ratio_nchar = stof(argv[option_pos]);
break;
case 'l' :
params.ratio_del = stof(argv[option_pos]);
break;
case 'b' :
params.bp = stoi(argv[option_pos]);
break;
case 'm' :
params.mp = stoi(argv[option_pos]);
break;
case 's':
params.step = stof(argv[option_pos]);
break;
case 'M':
params.max_count = stoi(argv[option_pos]);
break;
case 'e':
params.eps = stof(argv[option_pos]);
break;
case 'h':
printhelp();
break;
case 'f':
params.result_filter = stof(argv[option_pos]);
break;
case 't':
params.thread = stoi(argv[option_pos]);
break;
case 'C':
params.one_circle_limit = stoi(argv[option_pos]);
break;
default :
cerr<<"Unrec argument: " << argv[arg_pos] << endl;
printhelp();
break;
}
arg_pos += 2;
}
params.result_filter = (params.result_filter < 0.0) ? 0.0 : ((params.result_filter > 1.0) ? 1.0 : params.result_filter);
params.sample_count = Get_Name_List(listname.c_str(), infilename);
if (params.sample_count == 0)
{
cerr << "Sample number must be at least 1" << endl;
exit(0);
}
if (params.max_count < 0)
{
cerr << "Error : Max allele count must larger than 0!" << endl;
exit(0);
}
calculate_preprocess(infilename, outfilename);
return 0;
}