1 /*****************************************************************************
2   multiBamCov.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 MULTICOVBAM_H
13 #define MULTICOVBAM_H
14 
15 #include "bedFile.h"
16 #include "api/BamMultiReader.h"
17 #include "BlockedIntervals.h"
18 using namespace BamTools;
19 
20 
21 #include <vector>
22 #include <iostream>
23 #include <fstream>
24 #include <stdlib.h>
25 using namespace std;
26 
27 
28 
29 class MultiCovBam {
30 
31 public:
32 
33     // constructor
34     MultiCovBam(const vector<string> &bam_files, const string bed_file,
35                 int minQual, bool properOnly,
36                 bool keepDuplicates, bool keepFailedQC,
37                 bool obeySplits, bool sameStrand,
38                 bool diffStrand, float overlapFraction,
39                 bool reciprocal);
40 
41     // destructor
42     ~MultiCovBam(void);
43 
44     void CollectCoverage();
45 
46 private:
47 
48     //------------------------------------------------
49     // private attributes
50     //------------------------------------------------
51     vector<string> _bam_files;
52     string _bed_file;
53 	BedFile *_bed;
54 
55 	// attributes to control what is counted
56     int _minQual;
57     bool _properOnly;
58     bool _keepDuplicates;
59     bool _keepFailedQC;
60     bool _obeySplits;
61     bool _sameStrand;
62     bool _diffStrand;
63     float _overlapFraction;
64     bool _reciprocal;
65 
66 
67     map<string, int> bamFileMap;
68     bool FindBlockedOverlaps(const BED &a, const vector<BED> &a_blocks,
69         const BED &hit);
70     void LoadBamFileMap(void);
71     void ReportCounts(const vector<int> &counts);
72 };
73 
74 #endif /* MULTIBAMCOV_H */
75