From 877b760fbe4341f386fbab05fd5fa9f91ea53ad5 Mon Sep 17 00:00:00 2001
From: Magali Ruffier <mr6@ebi.ac.uk>
Date: Wed, 15 Aug 2012 15:47:28 +0000
Subject: [PATCH] store only if value if positive

---
 .../Bio/EnsEMBL/Pipeline/Production/DensityGenerator.pm   | 8 ++++++--
 modules/Bio/EnsEMBL/Pipeline/Production/StatsGenerator.pm | 4 +++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/modules/Bio/EnsEMBL/Pipeline/Production/DensityGenerator.pm b/modules/Bio/EnsEMBL/Pipeline/Production/DensityGenerator.pm
index 1e1dca42a2..da1592199f 100644
--- a/modules/Bio/EnsEMBL/Pipeline/Production/DensityGenerator.pm
+++ b/modules/Bio/EnsEMBL/Pipeline/Production/DensityGenerator.pm
@@ -50,7 +50,9 @@ sub run {
                                                     -end           => $block->end,
                                                     -density_type  => $density_type,
                                                     -density_value => $feature);
-        push(@features, $df);
+        if ($feature > 0) {
+          push(@features, $df);
+        }
       }
     } else {
       my $feature = $self->get_density($slice, $option);
@@ -60,7 +62,9 @@ sub run {
                                                   -end           => $slice->end,
                                                   -density_type  => $density_type,
                                                   -density_value => $feature);
-      push(@features, $df);
+      if ($feature > 0) {
+        push(@features, $df);
+      }
     }
     if ($count >= $total || $iteration == $max_run) {
       last;
diff --git a/modules/Bio/EnsEMBL/Pipeline/Production/StatsGenerator.pm b/modules/Bio/EnsEMBL/Pipeline/Production/StatsGenerator.pm
index ce53ed0267..12abcf6924 100644
--- a/modules/Bio/EnsEMBL/Pipeline/Production/StatsGenerator.pm
+++ b/modules/Bio/EnsEMBL/Pipeline/Production/StatsGenerator.pm
@@ -26,7 +26,9 @@ sub run {
   while (my $slice = shift @sorted_slices) {
     foreach my $code (keys %attrib_codes) {
       my $count = $self->get_feature_count($slice, $code, $attrib_codes{$code});
-      $self->store_attrib($slice, $count, $code);
+      if ($count > 0) {
+        $self->store_attrib($slice, $count, $code);
+      }
       $sum += $count;
     }
     if ($sum >= $total) {
-- 
GitLab