-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsophiaMref.cpp
72 lines (68 loc) · 2.39 KB
/
sophiaMref.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
/*
* sophiaMref.cpp
*
* Created on: 27 Apr 2016
* Author: umuttoprak
*/
#include <string>
#include <fstream>
#include <iostream>
#include <boost/program_options.hpp>
#include <vector>
#include "MasterRefProcessor.h"
#include "MrefEntry.h"
#include "HelperFunctions.h"
int main(int argc, char** argv) {
using namespace std;
boost::program_options::options_description desc("Allowed options");
desc.add_options() //
("help", "produce help message") //
("gzins", boost::program_options::value<string>(), "list of all gzipped control beds") //
("version", boost::program_options::value<string>(), "version") //
("defaultreadlength", boost::program_options::value<int>(), "Default read length for the technology used in sequencing 101,151 etc.") //
("outputrootname", boost::program_options::value<string>(), "outputrootname");
boost::program_options::variables_map inputVariables { };
boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), inputVariables);
boost::program_options::notify(inputVariables);
if (inputVariables.count("help")) {
cout << desc << endl;
return 0;
}
string gzInFilesList;
if (inputVariables.count("gzins")) {
gzInFilesList = inputVariables["gzins"].as<string>();
} else {
cerr << "No gzipped control bed list file given, exiting" << endl;
return 1;
}
ifstream gzInFilesHandle { gzInFilesList };
vector<string> gzListIn;
for (string line; error_terminating_getline(gzInFilesHandle, line);) {
gzListIn.push_back(line);
}
string version { };
if (inputVariables.count("version")) {
version = inputVariables["version"].as<string>();
} else {
cerr << "No input version given, exiting" << endl;
return 1;
}
int defaultReadLength { 0 };
if (inputVariables.count("defaultreadlength")) {
defaultReadLength = inputVariables["defaultreadlength"].as<int>();
} else {
cerr << "Default read Length not given, exiting" << endl;
return 1;
}
string outputRoot { };
if (inputVariables.count("outputrootname")) {
outputRoot = inputVariables["outputrootname"].as<string>();
} else {
cerr << "No output file root name given, exiting" << endl;
return 1;
}
sophia::SuppAlignment::DEFAULTREADLENGTH = defaultReadLength;
sophia::SuppAlignmentAnno::DEFAULTREADLENGTH = defaultReadLength;
sophia::MrefEntry::NUMPIDS = gzListIn.size();
sophia::MasterRefProcessor mRefProcessor { gzListIn, outputRoot, version, defaultReadLength };
}