Debian Codegraph @

src/non_api/STCoverage.h

raw symbols SCIP
1 #ifndef SNOWMAN_SEQLIB_COVERAGE_H__
2 #define SNOWMAN_SEQLIB_COVERAGE_H__
3
4 #include <memory>
5 #include <unordered_map>
6 #include <vector>
7 #include <cstdint>
8 #include <vector>
9 #include <cassert>
10 #include <iostream>
11 #include <memory>
12
13 #include "htslib/hts.h"
14 #include "htslib/sam.h"
15 #include "htslib/bgzf.h"
16 #include "htslib/kstring.h"
17
18 #include "SeqLib/BamRecord.h"
19 #include "SeqLib/GenomicRegion.h"
20 #include "SeqLib/GenomicRegionCollection.h"
21
22 typedef std::shared_ptr<std::vector<uint16_t>> uint16_sp;
23 typedef std::unordered_map<int,int> CovMap;
24 //typedef std::unordered_map<int,CovMap> CovMapMap;
25
26 namespace SeqLib {
27
28
29
30 /** Hold base-pair or binned coverage across an interval or genome
31 *
32 * Currently stores coverage as an unordered_map.
33 */
34 class STCoverage {
35
36 private:
37
38 GRC m_grc;
39 GenomicRegion m_gr;
40
41 //CovMapMap m_map;
42 std::vector<CovMap> m_map;
43
44 uint16_sp v;
45
46
47 public:
48
49 /** Clear the coverage map */
50 void clear();
51
52
53 /** */
54 void settleCoverage();
55
56 /** Add a read to this coverage track
57 * @param reserve_size Upper bound estimate for size of map. Not a hard
58 * cutoff but improves performance if total number of positions is less than this,
59 * as it will not rehash. */
60 void addRead(const BamRecord &r, int buff, bool full_length);
61
62 /** Make a new coverage object at interval gr */
63 STCoverage(const GenomicRegion& gr);
64
65 uint16_t maxCov() const;
66
67 /** Make an empty coverage */
68 STCoverage() {}
69
70 /*! Add to coverage objects together to get total coverge
71 *
72 * @param cov Coverage object to add to current object
73 */
74 //void combineCoverage(Coverage &cov);
75
76 /** Return a short summary string of this coverage object */
77 void ToBedgraph(std::ofstream * o, const bam_hdr_t * h) const;
78
79 /** Print the entire data */
80 friend std::ostream& operator<<(std::ostream &out, const STCoverage &c);
81
82 /** Return the coverage count at a position */
83 int getCoverageAtPosition(int chr, int pos) const;
84
85 };
86
87 }
88 #endif