Skip to content

Commit

Permalink
Release 0.12.7 bugfix for division by zero bug
Browse files Browse the repository at this point in the history
  • Loading branch information
apeltzer committed Dec 23, 2020
1 parent 5abdc65 commit 07d4786
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
@@ -1,5 +1,5 @@
group 'com.uni-tuebingen.de.it.eager.dedup'
version '0.12.7'
version '0.12.8'

apply plugin: 'java'
apply plugin: 'idea'
Expand Down
11 changes: 8 additions & 3 deletions src/main/java/RMDupper.java
Expand Up @@ -52,7 +52,7 @@
*/
public class RMDupper{
private static final String CLASS_NAME = "dedup";
private static final String VERSION = "0.12.7";
private static final String VERSION = "0.12.8";
private static boolean piped = true;

private final Boolean allReadsAsMerged;
Expand Down Expand Up @@ -273,8 +273,13 @@ 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.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)));
if(rmdup.dupStats.mapped_reads == 0 ) { //Division by zero bugfix for low coverage / no mapped reads case
metric_map.put("dup_rate", df.format((double) 0));
metric_map.put("clusterfactor", df.format((double) 0));
} else {
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 Down

0 comments on commit 07d4786

Please sign in to comment.