-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
55 lines (41 loc) · 1.26 KB
/
main.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
#include "getXIC.h"
#include <vector>
#include <string>
#include <fstream>
#include <iostream>
int main(int argc, char* argv[]) {
if(argc<7){
std::cout << "Not enough arguments\n";
return 0;
} else{
bool boxCar = std::atoi(argv[1]);
std::string fullFileName = argv[2];
double mz = std::stod(argv[3]);
float rt = std::stof(argv[4]);
int charge = std::stoi(argv[5]);
float mzTolerance = std::stoi(argv[6]);
std::string outputCsvName;
if(argc==8){
outputCsvName = argv[7];
}
std::vector< std::vector< std::pair<double, double> > > timeIntIstopoes = getXIC(fullFileName, mz, rt, charge, boxCar, mzTolerance);
if(argc<8){
for(int i=0; i<3; ++i){
std::string fileName = "istope" + std::to_string(i) + ".csv";
std::ofstream file(fileName);
for(int j=0, size=timeIntIstopoes[i].size(); j<size; ++j){
file << timeIntIstopoes[i][j].first << "," << timeIntIstopoes[i][j].second << "\n";
}
}
} else{
for(int i=0; i<3; i++){
std::string fileName = outputCsvName + "Iso" + std::to_string(i+1) + ".csv";
std::ofstream file(fileName);
for(int j=0, size=timeIntIstopoes[i].size(); j<size; ++j){
file << timeIntIstopoes[i][j].first << "," << timeIntIstopoes[i][j].second << "\n";
}
}
}
}
return 0;
}