Skip to content

Commit 11483a9

Browse files
guessprotocol: updating the decision critiera and adding confidence output
1 parent ec041ae commit 11483a9

1 file changed

Lines changed: 39 additions & 3 deletions

File tree

src/utils/guessprotocol.cpp

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,15 @@ struct nucleotide_model {
103103
};
104104

105105
struct guessprotocol_summary {
106+
static constexpr auto wgbs_cutoff_confident = 0.99;
107+
static constexpr auto wgbs_cutoff_unconfident = 0.9;
108+
static constexpr auto rpbat_cutoff_confident_high = 0.8;
109+
static constexpr auto rpbat_cutoff_confident_low = 0.2;
110+
static constexpr auto pbat_cutoff_unconfident = 0.1;
111+
static constexpr auto pbat_cutoff_confident = 0.01;
112+
106113
string protocol;
114+
string confidence;
107115
string layout;
108116
double n_reads_wgbs{};
109117
uint64_t n_reads{};
@@ -112,15 +120,43 @@ struct guessprotocol_summary {
112120
void evaluate() {
113121
const auto frac = n_reads_wgbs / n_reads;
114122
protocol = "inconclusive";
115-
if (frac > 0.8) protocol = "wgbs";
116-
if (frac < 0.2) protocol = "pbat";
117-
if (frac > 0.4 && frac < 0.6) protocol = "rpbat";
123+
124+
// assigning wgbs (near one)
125+
if (frac > wgbs_cutoff_confident) {
126+
protocol = "wgbs";
127+
confidence = "high";
128+
}
129+
else if (frac > wgbs_cutoff_unconfident) {
130+
protocol = "wgbs";
131+
confidence = "low";
132+
}
133+
// assigning pbat (near zero)
134+
else if (frac < pbat_cutoff_confident) {
135+
protocol = "pbat";
136+
confidence = "high";
137+
}
138+
else if (frac < pbat_cutoff_unconfident) {
139+
protocol = "pbat";
140+
confidence = "low";
141+
}
142+
// assigning rpbat (towards middle)
143+
else if (frac > rpbat_cutoff_confident_low &&
144+
frac < rpbat_cutoff_confident_high) {
145+
protocol = "rpbat";
146+
confidence = "high";
147+
}
148+
else {
149+
protocol = "rpbat";
150+
confidence = "low";
151+
}
152+
118153
wgbs_fraction = frac;
119154
}
120155

121156
string tostring() const {
122157
std::ostringstream oss;
123158
oss << "protocol: " << protocol << '\n'
159+
<< "confidence: " << confidence << '\n'
124160
<< "wgbs_fraction: " << wgbs_fraction << '\n'
125161
<< "n_reads_wgbs: " << n_reads_wgbs << '\n'
126162
<< "n_reads: " << n_reads;

0 commit comments

Comments
 (0)