Created
June 25, 2010 03:33
-
-
Save bensonk/452353 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
#include <sstream> | |
#include <string> | |
#include <set> | |
#include <stdlib.h> | |
using namespace std; | |
int main(int argc, char** argv) { | |
if(argc != 2) { | |
cout << "Usage: ./parse <filename.txt>" << endl; | |
return 255; | |
} | |
string line; | |
ifstream f(argv[1]); | |
if(!f.is_open()) { | |
cout << "The file you specified could not be read." << endl; | |
return 1; | |
} | |
while(!f.eof()) { | |
getline(f, line); | |
if(line == "" || line[0] == '#') continue; | |
istringstream row(line); | |
// Peptide values | |
double mass; | |
char* sequence; | |
int numK; | |
int numPTS; | |
int numM; | |
set<int> parents; | |
row >> mass | |
>> sequence | |
>> numK | |
>> numPTS | |
>> numM; | |
int parent; | |
while(row >> parent) | |
parents.insert(parent); | |
//cout << "mass: " << mass << endl | |
// << "sequence: " << sequence << endl | |
// << "numK: " << numK << endl | |
// << "numPTS: " << numPTS << endl | |
// << "numM: " << numM << endl | |
// << "parents:" << endl; | |
//set<int>::iterator it; | |
//for(it = parents.begin(); it != parents.end(); it++) | |
// cout << "\t- " << *it << endl; | |
} | |
f.close(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment