Skip to content

Commit 496e349

Browse files
Merge pull request #136 from smithlabcode/levels-counter-commets
Comments to define values output for variables
2 parents e500e1e + 240518f commit 496e349

File tree

1 file changed

+62
-7
lines changed

1 file changed

+62
-7
lines changed

src/common/LevelsCounter.hpp

Lines changed: 62 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,35 +22,90 @@
2222
#include <string>
2323

2424
struct LevelsCounter {
25+
26+
// context is the dinucleotide or trinucleotide in which this
27+
// cytosine resides. The documentation for the counts and levels
28+
// tools provide more information about this context string.
2529
std::string context;
30+
31+
// total_sites is the total number of sites summarized, all of which
32+
// are consistent with the context string. If the context string is
33+
// empty or not used, then any constraints on which sites are
34+
// counted among this total is defined separately.
2635
uint64_t total_sites{};
36+
37+
// sites_covered is the number of reference genome sites analyzed
38+
// that have at least one mapped read covering them.
2739
uint64_t sites_covered{};
40+
41+
// max_depth is the number of reads covering the reference genome
42+
// site having the most mapped reads covering it.
2843
uint64_t max_depth{};
44+
45+
// mutations is the number of sites tagged as having been mutated in
46+
// the sample based on the mapped reads in comparisin with the
47+
// underlying reference genome site. This may be indicated in
48+
// various ways and defined in various ways.
2949
uint64_t mutations{};
30-
uint64_t total_c{}, total_t{};
31-
uint64_t called_meth{}, called_unmeth{};
32-
double total_meth{};
33-
LevelsCounter(const std::string &c) : context{c} {}
3450

35-
LevelsCounter() = default;
51+
// total_c is the number of cytosines in mapped reads covering
52+
// relevant cytosines in the reference genome.
53+
uint64_t total_c{};
3654

37-
LevelsCounter &operator+=(const LevelsCounter &rhs);
55+
// total_t is the number of thymines in mapped reads covering
56+
// relevant cytosines in the reference genome.
57+
uint64_t total_t{};
3858

39-
void update(const MSite &s);
59+
// called_meth is the number of cytosines in the reference genome
60+
// "called" as being methylated using some statistical criteria.
61+
uint64_t called_meth{};
62+
63+
// called_unmeth is the number of cytosines in the reference genome
64+
// "called" as being unmethylated using some statistical criteria.
65+
uint64_t called_unmeth{};
66+
67+
// total_meth is the sum over all relevant cytosines of the
68+
// methylation level estimated at that cytosine using the mapped
69+
// reads. This value contributes to the unweighted mean methylation.
70+
double total_meth{};
4071

72+
// coverage is equal to total_c plus total_t. These are the counts
73+
// that contribute towards estimates of the various methylation
74+
// levels.
4175
uint64_t coverage() const {return total_c + total_t;}
76+
77+
// total_called is equal to called_meth plus called_unmeth
4278
uint64_t total_called() const {return called_meth + called_unmeth;}
4379

80+
// mean_meth_weighted is the unweighted mean methylation level. This
81+
// is the ratio of total_c divided by coverage. This value is always
82+
// between 0 and 1.
4483
double mean_meth_weighted() const {
4584
return static_cast<double>(total_c)/std::max(coverage(), 1ul);
4685
}
86+
87+
// fractional_meth is the fraction of "called" sites that are called
88+
// methylated. It is the ratio of called_meth divided by
89+
// total_called. This value is always between 0 and 1.
4790
double fractional_meth() const {
4891
return static_cast<double>(called_meth)/std::max(total_called(), 1ul);
4992
}
93+
94+
// mean_meth is the unweighted mean methylation level. This is the
95+
// ratio of total_meth divided by sites_covered. This value is
96+
// always between 0 and 1.
5097
double mean_meth() const {
5198
return static_cast<double>(total_meth)/std::max(sites_covered, 1ul);
5299
}
53100

101+
LevelsCounter(const std::string &c) : context{c} {}
102+
103+
LevelsCounter() = default;
104+
105+
LevelsCounter &operator+=(const LevelsCounter &rhs);
106+
107+
void update(const MSite &s);
108+
54109
std::string tostring() const;
55110
std::string format_row() const;
56111
static std::string format_header();

0 commit comments

Comments
 (0)