0
|
1 /*****************************************************************************
|
|
2 coverageBed.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 #ifndef COVERAGEBED_H
|
|
13 #define COVERAGEBED_H
|
|
14
|
|
15 #include "bedFile.h"
|
|
16
|
|
17 #include "api/BamReader.h"
|
|
18 #include "api/BamAux.h"
|
|
19 #include "BamAncillary.h"
|
|
20 using namespace BamTools;
|
|
21
|
|
22 #include <vector>
|
|
23 #include <algorithm>
|
|
24 #include <iostream>
|
|
25 #include <iomanip>
|
|
26 #include <fstream>
|
|
27 #include <stdlib.h>
|
|
28
|
|
29 using namespace std;
|
|
30
|
|
31 //************************************************
|
|
32 // Class methods and elements
|
|
33 //************************************************
|
|
34 class BedCoverage {
|
|
35
|
|
36 public:
|
|
37
|
|
38 // constructor
|
|
39 BedCoverage(string &bedAFile, string &bedBFile, bool sameStrand, bool diffStrand, bool writeHistogram,
|
|
40 bool bamInput, bool obeySplits, bool eachBase, bool countsOnly);
|
|
41
|
|
42 // destructor
|
|
43 ~BedCoverage(void);
|
|
44
|
|
45 private:
|
|
46
|
|
47 // input files.
|
|
48 string _bedAFile;
|
|
49 string _bedBFile;
|
|
50
|
|
51 // instance of a bed file class.
|
|
52 BedFile *_bedA, *_bedB;
|
|
53
|
|
54 // do we care about same or opposite strandedness when counting coverage?
|
|
55 bool _sameStrand;
|
|
56 bool _diffStrand;
|
|
57
|
|
58 // should we write a histogram for each feature in B?
|
|
59 bool _writeHistogram;
|
|
60
|
|
61 // are we dealing with BAM input for "A"?
|
|
62 bool _bamInput;
|
|
63
|
|
64 // should we split BED/BAM into discrete blocks?
|
|
65 bool _obeySplits;
|
|
66
|
|
67 // should discrete coverage be reported for each base in each feature?
|
|
68 bool _eachBase;
|
|
69
|
|
70 // should we just count overlaps and not try to describe the breadth?
|
|
71 bool _countsOnly;
|
|
72
|
|
73 // private function for reporting coverage information
|
|
74 void ReportCoverage();
|
|
75
|
|
76 // private function for reporting overlap counts
|
|
77 void ReportCounts();
|
|
78
|
|
79 void CollectCoverageBed();
|
|
80
|
|
81 void CollectCoverageBam(string bamFile);
|
|
82 };
|
|
83 #endif /* COVERAGEBED_H */
|