From 45596a3a7091eb6403411d6b161665d9df627b8d Mon Sep 17 00:00:00 2001
From: Marina Gourtovaia <mg8@sanger.ac.uk>
Date: Mon, 28 Nov 2016 18:03:26 +0000
Subject: [PATCH] reduce uncertainty in ranking close results for teh old
 contamination check

---
 Changes                                 | 2 ++
 lib/npg_qc/autoqc/role/contamination.pm | 2 +-
 t/60-autoqc-results-contamination.t     | 8 ++++----
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/Changes b/Changes
index c26292f4f..f3c1681cc 100644
--- a/Changes
+++ b/Changes
@@ -5,6 +5,8 @@ LIST OF CHANGES FOR NPG-QC PACKAGE
  - back to testing with mysql 5.7.13 in travis
  - drop node 0.12 from node travis matrix
  - add perl 5.22-shrplib to travis matrix
+ - to reduce uncertainty in ranking close results, increase precision
+   used for ranking contamination results
 
 release 62.5
  - a very concise replacement for NPG_QC pages
diff --git a/lib/npg_qc/autoqc/role/contamination.pm b/lib/npg_qc/autoqc/role/contamination.pm
index 2a7306471..5f86e1a27 100644
--- a/lib/npg_qc/autoqc/role/contamination.pm
+++ b/lib/npg_qc/autoqc/role/contamination.pm
@@ -26,7 +26,7 @@ sub normalised_contamination {
         my $value =  ( $raw_count / $fastq_size )
                              * $genome_correction{$organism}
                              * $PERCENT;
-        $normalized_value{$organism} = sprintf '%.1f', $value;
+        $normalized_value{$organism} = sprintf '%.2f', $value;
     }
 
     return \%normalized_value;
diff --git a/t/60-autoqc-results-contamination.t b/t/60-autoqc-results-contamination.t
index cae2f8ed5..e342d0f74 100644
--- a/t/60-autoqc-results-contamination.t
+++ b/t/60-autoqc-results-contamination.t
@@ -37,10 +37,10 @@ ok(!$r->normalised_contamination(), 'normalized measure not defined if read_coun
 $r->read_count(100_000);
 
 is_deeply( $r->normalised_contamination(),
-           { Homo_sapiens          => '62.0',
-             Danio_rerio           =>  '0.0',
-             Mus_musculus          =>  '1.3',
-             Clostridium_difficile =>  '0.3', },
+           { Homo_sapiens          => '62.00',
+             Danio_rerio           =>  '0.00',
+             Mus_musculus          =>  '1.34',
+             Clostridium_difficile =>  '0.30', },
            'Calculate normalized measures' );
 
 my $comment1 = 'ABC';