annotate SMART/Java/Python/Cpp/inputFileParser.hpp @ 20:c265f13066d8

Deleted selected files
author m-zytnicki
date Mon, 29 Apr 2013 03:24:43 -0400
parents 94ab73e8a190
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
1 #ifndef INPUT_FILE_PARSER_HPP
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
2 #define INPUT_FILE_PARSER_HPP
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
3
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
4 #include <string>
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
5 #include <vector>
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
6 #include <map>
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
7 #include "genomicInterval.hpp"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
8
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
9 typedef vector<Interval *> IntervalsType;
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
10 typedef map<string, IntervalsType *> SortedIntervalsTypes;
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
11 typedef map<string, unsigned int> CounterType;
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
12 typedef pair<Interval *, unsigned int> NumberIntervalType;
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
13
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
14 static bool operator<(const NumberIntervalType &i1, const NumberIntervalType &i2) {
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
15 if (i1.first < i2.first) return true;
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
16 return ((i1.first == i2.first) && (i1.second < i2.second));
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
17 }
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
18
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
19 class InputFileParser {
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
20
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
21 private:
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
22 SortedIntervalsTypes sortedIntervals;
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
23 CounterType counter;
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
24
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
25 void addToList(GenomicInterval &genomicInterval);
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
26 void writeTmpFile(string &chromosome);
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
27 void syncFiles();
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
28 string getTmpName(const string &chromosome, unsigned int i);
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
29 string getTmpName(const string &chromosome);
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
30 void merge();
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
31 void merge(const string &chromosome, ofstream &outputFile);
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
32
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
33 public:
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
34 string inputFileName;
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
35 string outputFileName;
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
36 string outputFilePrefix;
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
37
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
38 InputFileParser(string inputFileName, string outputFileName);
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
39
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
40 void parse();
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
41
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
42 };
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
43
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
44 #endif
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
45