Skip to content

Commit a0f1929

Browse files
guessprotocol: merging
2 parents 11483a9 + d542ccb commit a0f1929

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/utils/guessprotocol.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ struct nucleotide_model {
8686
double operator()(const string &s) const {
8787
return accumulate(cbegin(s), cend(s), 0.0,
8888
[&](const double x, const char c) {
89-
const auto i = nuc_to_idx[c];
89+
const auto i = nuc_to_idx[static_cast<uint8_t>(c)];
9090
return i == 4 ? x : x + lpr[i];
9191
});
9292
};
@@ -103,21 +103,33 @@ struct nucleotide_model {
103103
};
104104

105105
struct guessprotocol_summary {
106+
106107
static constexpr auto wgbs_cutoff_confident = 0.99;
107108
static constexpr auto wgbs_cutoff_unconfident = 0.9;
108109
static constexpr auto rpbat_cutoff_confident_high = 0.8;
109110
static constexpr auto rpbat_cutoff_confident_low = 0.2;
110111
static constexpr auto pbat_cutoff_unconfident = 0.1;
111112
static constexpr auto pbat_cutoff_confident = 0.01;
112113

114+
// protocol is the guessed protocol (wgbs, pbat, rpbat, or inconclusive)
115+
// based on the content of the reads.
113116
string protocol;
117+
// confidence indicates the level of confidence in the guess for the
118+
// protocol.
114119
string confidence;
120+
// layout indicates whether the reads are paired or single-ended.
115121
string layout;
122+
// n_reads_wgbs is the average number of reads (for single-ended reads) or
123+
// read pairs (for paired reads) where read1 is T-rich.
116124
double n_reads_wgbs{};
125+
// n_reads is the number of evaluated reads or read pairs.
117126
uint64_t n_reads{};
127+
// wgbs_fraction is the probability that a read (for single-ended reads) or
128+
// the read1 of a read pair (for paired reads) is T-rich.
118129
double wgbs_fraction{};
119130

120131
void evaluate() {
132+
121133
const auto frac = n_reads_wgbs / n_reads;
122134
protocol = "inconclusive";
123135

0 commit comments

Comments
 (0)