forked from vcflib/vcflib
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvcfecho.cpp
54 lines (38 loc) · 967 Bytes
/
vcfecho.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
/*
vcflib C++ library for parsing and manipulating VCF files
Copyright © 2010-2020 Erik Garrison
Copyright © 2020 Pjotr Prins
This software is published under the MIT License. See the LICENSE file.
*/
#include "Variant.h"
using namespace std;
using namespace vcflib;
int main(int argc, char** argv) {
if (argc == 2) {
string h_flag = argv[1];
if (h_flag == "-h" || h_flag == "--help") {
cerr << R"(
usage: vcfecho <vcf file>
Echo VCF to stdout (simple demo)
Type: transformation
)";
exit(1);
}
}
VariantCallFile variantFile;
if (argc > 1) {
string filename = argv[1];
variantFile.open(filename);
} else {
variantFile.open(std::cin);
}
if (!variantFile.is_open()) {
return 1;
}
cout << variantFile.header << endl;
Variant var(variantFile);
while (variantFile.getNextVariant(var)) {
cout << var << endl;
}
return 0;
}