Mercurial > repos > aaronquinlan > multi_intersect
comparison BEDTools-Version-2.14.3/src/genomeCoverageBed/genomeCoverageBed.h @ 0:dfcd8b6c1bda
Uploaded
| author | aaronquinlan |
|---|---|
| date | Thu, 03 Nov 2011 10:25:04 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:dfcd8b6c1bda |
|---|---|
| 1 /***************************************************************************** | |
| 2 genomeCoverage.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 "genomeFile.h" | |
| 14 | |
| 15 #include "BamAncillary.h" | |
| 16 #include "api/BamReader.h" | |
| 17 #include "api/BamAux.h" | |
| 18 using namespace BamTools; | |
| 19 | |
| 20 #include <vector> | |
| 21 #include <set> | |
| 22 #include <iostream> | |
| 23 #include <fstream> | |
| 24 using namespace std; | |
| 25 | |
| 26 | |
| 27 //*********************************************** | |
| 28 // Typedefs | |
| 29 //*********************************************** | |
| 30 typedef map<int, DEPTH, less<int> > depthMap; | |
| 31 typedef map<string, depthMap, less<string> > chromDepthMap; | |
| 32 | |
| 33 typedef map<int, unsigned int, less<int> > histMap; | |
| 34 typedef map<string, histMap, less<string> > chromHistMap; | |
| 35 | |
| 36 //************************************************ | |
| 37 // Class methods and elements | |
| 38 //************************************************ | |
| 39 class BedGenomeCoverage { | |
| 40 | |
| 41 public: | |
| 42 | |
| 43 // constructor | |
| 44 BedGenomeCoverage(string bedFile, string genomeFile, | |
| 45 bool eachBase, bool startSites, | |
| 46 bool bedGraph, bool bedGraphAll, | |
| 47 int max, float scale, | |
| 48 bool bamInput, bool obeySplits, | |
| 49 bool filterByStrand, string requestedStrand, | |
| 50 bool only_5p_end, bool only_3p_end, | |
| 51 bool eachBaseZeroBased, | |
| 52 bool add_gb_track_line, string gb_track_line_opts); | |
| 53 | |
| 54 // destructor | |
| 55 ~BedGenomeCoverage(void); | |
| 56 | |
| 57 private: | |
| 58 | |
| 59 // data (parms) | |
| 60 string _bedFile; | |
| 61 string _genomeFile; | |
| 62 bool _bamInput; | |
| 63 bool _eachBase; | |
| 64 bool _eachBaseZeroBased; | |
| 65 bool _startSites; | |
| 66 bool _bedGraph; | |
| 67 bool _bedGraphAll; | |
| 68 int _max; | |
| 69 float _scale; | |
| 70 bool _obeySplits; | |
| 71 bool _filterByStrand; | |
| 72 bool _only_5p_end; | |
| 73 bool _only_3p_end; | |
| 74 bool _add_gb_track_line; | |
| 75 string _gb_track_line_opts; | |
| 76 string _requestedStrand; | |
| 77 | |
| 78 BedFile *_bed; | |
| 79 GenomeFile *_genome; | |
| 80 | |
| 81 // data for internal processing | |
| 82 chromDepthMap _chromCov; | |
| 83 string _currChromName ; | |
| 84 vector<DEPTH> _currChromCoverage; | |
| 85 chromHistMap _currChromDepthHist; | |
| 86 int _currChromSize ; | |
| 87 set<string> _visitedChromosomes; | |
| 88 | |
| 89 | |
| 90 // methods | |
| 91 void CoverageBed(); | |
| 92 void CoverageBam(string bamFile); | |
| 93 void LoadBamHeaderIntoGenomeFile(const string &bamFile); | |
| 94 void ReportChromCoverage(const vector<DEPTH> &, const int &chromSize, const string &chrom, chromHistMap&); | |
| 95 void ReportGenomeCoverage(chromHistMap &chromDepthHist); | |
| 96 void ReportChromCoverageBedGraph(const vector<DEPTH> &chromCov, const int &chromSize, const string &chrom); | |
| 97 void ResetChromCoverage(); | |
| 98 void StartNewChrom (const string& chrom); | |
| 99 void AddCoverage (int start, int end); | |
| 100 void AddBlockedCoverage(const vector<BED> &bedBlocks); | |
| 101 void PrintFinalCoverage(); | |
| 102 void PrintTrackDefinitionLine(); | |
| 103 }; | |
| 104 |
