|
52 | 52 | */ |
53 | 53 | public class RMDupper{ |
54 | 54 | 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"; |
56 | 56 | private static boolean piped = true; |
57 | 57 |
|
58 | 58 | private final Boolean allReadsAsMerged; |
@@ -273,8 +273,13 @@ public static void main(String[] args) throws IOException { |
273 | 273 | metric_map.put("forward_removed", rmdup.dupStats.removed_forward); |
274 | 274 | metric_map.put("merged_removed", rmdup.dupStats.removed_merged); |
275 | 275 | 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 | + } |
278 | 283 |
|
279 | 284 | json_map.put("metrics", metric_map); |
280 | 285 | Gson gson = new GsonBuilder().setPrettyPrinting().create(); |
|
0 commit comments