0
|
1 /*****************************************************************************
|
|
2 mergeBed.h
|
|
3
|
|
4 (c) 2009 - Aaron Quinlan
|
|
5 Hall Laboratory
|
|
6 Department of Biochemistry and Molecular Genetics
|
|
7 University of Virginia
|
|
8 aaronquinlan@gmail.com
|
|
9
|
|
10 Licenced under the GNU General Public License 2.0 license.
|
|
11 ******************************************************************************/
|
|
12 #include "bedFile.h"
|
|
13 #include <vector>
|
|
14 #include <algorithm>
|
|
15 #include <numeric>
|
|
16 #include <iostream>
|
|
17 #include <fstream>
|
|
18 #include <limits.h>
|
|
19 #include <stdlib.h>
|
|
20
|
|
21 using namespace std;
|
|
22
|
|
23
|
|
24 //************************************************
|
|
25 // Class methods and elements
|
|
26 //************************************************
|
|
27 class BedMerge {
|
|
28
|
|
29 public:
|
|
30
|
|
31 // constructor
|
|
32 BedMerge(string &bedFile, bool numEntries,
|
|
33 int maxDistance, bool forceStrand,
|
|
34 bool reportNames, bool reportScores, const string &scoreOp);
|
|
35
|
|
36 // destructor
|
|
37 ~BedMerge(void);
|
|
38
|
|
39 void MergeBed();
|
|
40 void MergeBedStranded();
|
|
41
|
|
42 private:
|
|
43
|
|
44 string _bedFile;
|
|
45 bool _numEntries;
|
|
46 bool _forceStrand;
|
|
47 bool _reportNames;
|
|
48 bool _reportScores;
|
|
49 string _scoreOp;
|
|
50 int _maxDistance;
|
|
51 // instance of a bed file class.
|
|
52 BedFile *_bed;
|
|
53
|
|
54 void Report(string chrom, int start, int end, const vector<string> &names, const vector<string> &scores, int mergeCount);
|
|
55 void ReportStranded(string chrom, int start, int end, const vector<string> &names, const vector<string> &scores, int mergeCount, string strand);
|
|
56 void ReportMergedNames(const vector<string> &names);
|
|
57 void ReportMergedScores(const vector<string> &scores);
|
|
58
|
|
59 };
|