Skip to content

Commit 07d4786

Browse files
committed
Release 0.12.7 bugfix for division by zero bug
1 parent 5abdc65 commit 07d4786

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group 'com.uni-tuebingen.de.it.eager.dedup'
2-
version '0.12.7'
2+
version '0.12.8'
33

44
apply plugin: 'java'
55
apply plugin: 'idea'

src/main/java/RMDupper.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
*/
5353
public class RMDupper{
5454
private static final String CLASS_NAME = "dedup";
55-
private static final String VERSION = "0.12.7";
55+
private static final String VERSION = "0.12.8";
5656
private static boolean piped = true;
5757

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

279284
json_map.put("metrics", metric_map);
280285
Gson gson = new GsonBuilder().setPrettyPrinting().create();

0 commit comments

Comments
 (0)