diff SMART/Java/Python/Cpp/inputFileParser.hpp @ 18:94ab73e8a190

Uploaded
author m-zytnicki
date Mon, 29 Apr 2013 03:20:15 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SMART/Java/Python/Cpp/inputFileParser.hpp	Mon Apr 29 03:20:15 2013 -0400
@@ -0,0 +1,45 @@
+#ifndef INPUT_FILE_PARSER_HPP
+#define INPUT_FILE_PARSER_HPP
+
+#include <string>
+#include <vector>
+#include <map>
+#include "genomicInterval.hpp"
+
+typedef vector<Interval *> IntervalsType;
+typedef map<string, IntervalsType *> SortedIntervalsTypes;
+typedef map<string, unsigned int> CounterType;
+typedef pair<Interval *, unsigned int> NumberIntervalType;
+
+static bool operator<(const NumberIntervalType &i1, const NumberIntervalType &i2) {
+    if (i1.first < i2.first) return true;
+    return ((i1.first == i2.first) && (i1.second < i2.second));
+}
+
+class InputFileParser {
+
+    private:
+        SortedIntervalsTypes sortedIntervals;
+        CounterType counter;
+
+        void addToList(GenomicInterval &genomicInterval);
+        void writeTmpFile(string &chromosome);
+        void syncFiles();
+        string getTmpName(const string &chromosome, unsigned int i);
+        string getTmpName(const string &chromosome);
+        void merge();
+        void merge(const string &chromosome, ofstream &outputFile);
+
+    public:
+        string inputFileName;
+        string outputFileName;
+        string outputFilePrefix;
+
+        InputFileParser(string inputFileName, string outputFileName);
+
+        void parse(); 
+
+};
+
+#endif
+