-
Notifications
You must be signed in to change notification settings - Fork 1
/
PhenotypeProcessor.cpp
39 lines (36 loc) · 1.08 KB
/
PhenotypeProcessor.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
// GAGS
// Developed by Andrew R Wood
#include "PhenotypeProcessor.h"
#include "StringOperations.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <stdlib.h>
using namespace std;
void ReadPhenotypeFileMinusExclusions(string f, vector<string>& i, vector<double>& v, map<string,double>& m, map<string,int>& e) {
string line, id, pheno;
ifstream inFile(f.c_str());
if (inFile.is_open()) {
getline (inFile, line); // skip header
while (inFile.good()) {
getline (inFile, line);
if (!line.empty()) {
istringstream iss;
iss.str(line);
iss >> id;
iss >> pheno;
if (pheno != "NA" && e.find(id) == e.end()) {
i.push_back(id);
v.push_back(stringToDouble(pheno));
m[id] = stringToDouble(pheno);
}
}
}
inFile.close();
}
else {
cout << "Unable to open " << f << " for reading" << endl;
exit(EXIT_FAILURE);
}
}