Mercurial > repos > yufei-luo > s_mart
comparison SMART/Java/Python/Cpp/inputFileParser.hpp @ 18:94ab73e8a190
Uploaded
| author | m-zytnicki |
|---|---|
| date | Mon, 29 Apr 2013 03:20:15 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 17:b0e8584489e6 | 18:94ab73e8a190 |
|---|---|
| 1 #ifndef INPUT_FILE_PARSER_HPP | |
| 2 #define INPUT_FILE_PARSER_HPP | |
| 3 | |
| 4 #include <string> | |
| 5 #include <vector> | |
| 6 #include <map> | |
| 7 #include "genomicInterval.hpp" | |
| 8 | |
| 9 typedef vector<Interval *> IntervalsType; | |
| 10 typedef map<string, IntervalsType *> SortedIntervalsTypes; | |
| 11 typedef map<string, unsigned int> CounterType; | |
| 12 typedef pair<Interval *, unsigned int> NumberIntervalType; | |
| 13 | |
| 14 static bool operator<(const NumberIntervalType &i1, const NumberIntervalType &i2) { | |
| 15 if (i1.first < i2.first) return true; | |
| 16 return ((i1.first == i2.first) && (i1.second < i2.second)); | |
| 17 } | |
| 18 | |
| 19 class InputFileParser { | |
| 20 | |
| 21 private: | |
| 22 SortedIntervalsTypes sortedIntervals; | |
| 23 CounterType counter; | |
| 24 | |
| 25 void addToList(GenomicInterval &genomicInterval); | |
| 26 void writeTmpFile(string &chromosome); | |
| 27 void syncFiles(); | |
| 28 string getTmpName(const string &chromosome, unsigned int i); | |
| 29 string getTmpName(const string &chromosome); | |
| 30 void merge(); | |
| 31 void merge(const string &chromosome, ofstream &outputFile); | |
| 32 | |
| 33 public: | |
| 34 string inputFileName; | |
| 35 string outputFileName; | |
| 36 string outputFilePrefix; | |
| 37 | |
| 38 InputFileParser(string inputFileName, string outputFileName); | |
| 39 | |
| 40 void parse(); | |
| 41 | |
| 42 }; | |
| 43 | |
| 44 #endif | |
| 45 |
