Skip to content

Commit

Permalink
Merge pull request #11 from jfy133/master
Browse files Browse the repository at this point in the history
Fix denominator in output stats to all mapped reads only, not all in BAM
  • Loading branch information
apeltzer authored Sep 27, 2020
2 parents e3d55df + 91c2e2b commit 6cbcb6c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/java/RMDupper.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public static void main(String[] args) throws IOException {
if (rmdup.dupStats.removed_merged + rmdup.dupStats.removed_forward + rmdup.dupStats.removed_reverse == 0) {
System.err.println("Duplication Rate: " + df.format(0.00));
} else {
System.err.println("Duplication Rate: " + df.format((double) (rmdup.dupStats.removed_merged + rmdup.dupStats.removed_reverse + rmdup.dupStats.removed_forward) / (double) rmdup.dupStats.total));
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));
}


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

Expand All @@ -273,8 +273,8 @@ public static void main(String[] args) throws IOException {
metric_map.put("forward_removed", rmdup.dupStats.removed_forward);
metric_map.put("merged_removed", rmdup.dupStats.removed_merged);
metric_map.put("total_removed", rmdup.dupStats.removed_forward + rmdup.dupStats.removed_reverse + rmdup.dupStats.removed_merged);
metric_map.put("dup_rate", df.format((double) (rmdup.dupStats.removed_merged + rmdup.dupStats.removed_reverse + rmdup.dupStats.removed_forward) / (double) rmdup.dupStats.total));
metric_map.put("clusterfactor", df.format( (1.0 + (rmdup.dupStats.removed_merged + rmdup.dupStats.removed_reverse + rmdup.dupStats.removed_forward) / (double) rmdup.dupStats.total)));
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));
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)));

json_map.put("metrics", metric_map);
Gson gson = new GsonBuilder().setPrettyPrinting().create();
Expand All @@ -298,7 +298,7 @@ public static void main(String[] args) throws IOException {
if (rmdup.dupStats.removed_merged + rmdup.dupStats.removed_forward + rmdup.dupStats.removed_reverse == 0) {
System.out.println("Duplication Rate: " + df.format(0.00));
} else {
System.out.println("Duplication Rate: " + df.format((double) (rmdup.dupStats.removed_merged + rmdup.dupStats.removed_reverse + rmdup.dupStats.removed_forward) / (double) rmdup.dupStats.total));
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));
}
} catch (IOException e) {
e.printStackTrace();
Expand Down

0 comments on commit 6cbcb6c

Please sign in to comment.