Skip to content

Commit 6cbcb6c

Browse files
authored
Merge pull request #11 from jfy133/master
Fix denominator in output stats to all mapped reads only, not all in BAM
2 parents e3d55df + 91c2e2b commit 6cbcb6c

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/main/java/RMDupper.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public static void main(String[] args) throws IOException {
197197
if (rmdup.dupStats.removed_merged + rmdup.dupStats.removed_forward + rmdup.dupStats.removed_reverse == 0) {
198198
System.err.println("Duplication Rate: " + df.format(0.00));
199199
} else {
200-
System.err.println("Duplication Rate: " + df.format((double) (rmdup.dupStats.removed_merged + rmdup.dupStats.removed_reverse + rmdup.dupStats.removed_forward) / (double) rmdup.dupStats.total));
200+
System.err.println("Duplication Rate: " + df.format((double) (rmdup.dupStats.removed_merged + rmdup.dupStats.removed_reverse + rmdup.dupStats.removed_forward) / (double) rmdup.dupStats.mapped_reads));
201201
}
202202

203203

@@ -247,7 +247,7 @@ public static void main(String[] args) throws IOException {
247247
bfw.write("Merged removed: " + rmdup.dupStats.removed_merged + "\n");
248248
bfw.write("Total removed: " + (rmdup.dupStats.removed_forward + rmdup.dupStats.removed_merged
249249
+ rmdup.dupStats.removed_reverse) + "\n");
250-
bfw.write("Duplication Rate: " + df.format((double) (rmdup.dupStats.removed_merged + rmdup.dupStats.removed_reverse + rmdup.dupStats.removed_forward) / (double) rmdup.dupStats.total));
250+
bfw.write("Duplication Rate: " + df.format((double) (rmdup.dupStats.removed_merged + rmdup.dupStats.removed_reverse + rmdup.dupStats.removed_forward) / (double) rmdup.dupStats.mapped_reads));
251251
bfw.flush();
252252
bfw.close();
253253

@@ -273,8 +273,8 @@ public static void main(String[] args) throws IOException {
273273
metric_map.put("forward_removed", rmdup.dupStats.removed_forward);
274274
metric_map.put("merged_removed", rmdup.dupStats.removed_merged);
275275
metric_map.put("total_removed", rmdup.dupStats.removed_forward + rmdup.dupStats.removed_reverse + rmdup.dupStats.removed_merged);
276-
metric_map.put("dup_rate", df.format((double) (rmdup.dupStats.removed_merged + rmdup.dupStats.removed_reverse + rmdup.dupStats.removed_forward) / (double) rmdup.dupStats.total));
277-
metric_map.put("clusterfactor", df.format( (1.0 + (rmdup.dupStats.removed_merged + rmdup.dupStats.removed_reverse + rmdup.dupStats.removed_forward) / (double) rmdup.dupStats.total)));
276+
metric_map.put("dup_rate", df.format((double) (rmdup.dupStats.removed_merged + rmdup.dupStats.removed_reverse + rmdup.dupStats.removed_forward) / (double) rmdup.dupStats.mapped_reads));
277+
metric_map.put("clusterfactor", df.format( (1.0 + (rmdup.dupStats.removed_merged + rmdup.dupStats.removed_reverse + rmdup.dupStats.removed_forward) / (double) rmdup.dupStats.mapped_reads)));
278278

279279
json_map.put("metrics", metric_map);
280280
Gson gson = new GsonBuilder().setPrettyPrinting().create();
@@ -298,7 +298,7 @@ public static void main(String[] args) throws IOException {
298298
if (rmdup.dupStats.removed_merged + rmdup.dupStats.removed_forward + rmdup.dupStats.removed_reverse == 0) {
299299
System.out.println("Duplication Rate: " + df.format(0.00));
300300
} else {
301-
System.out.println("Duplication Rate: " + df.format((double) (rmdup.dupStats.removed_merged + rmdup.dupStats.removed_reverse + rmdup.dupStats.removed_forward) / (double) rmdup.dupStats.total));
301+
System.out.println("Duplication Rate: " + df.format((double) (rmdup.dupStats.removed_merged + rmdup.dupStats.removed_reverse + rmdup.dupStats.removed_forward) / (double) rmdup.dupStats.mapped_reads));
302302
}
303303
} catch (IOException e) {
304304
e.printStackTrace();

0 commit comments

Comments
 (0)