From 25548a24a3efe62551a5f44e37b4ade461f16628 Mon Sep 17 00:00:00 2001
From: Magali Ruffier <mr6@ebi.ac.uk>
Date: Thu, 1 Nov 2012 14:03:56 +0000
Subject: [PATCH] moved get_total and get_density modules to parent module

---
 .../Pipeline/Production/CodingDensity.pm       | 18 ------------------
 .../Pipeline/Production/DensityGenerator.pm    | 17 +++++++++++++++++
 .../Pipeline/Production/NonCodingDensity.pm    | 16 ----------------
 .../Pipeline/Production/PseudogeneDensity.pm   | 16 ----------------
 4 files changed, 17 insertions(+), 50 deletions(-)

diff --git a/modules/Bio/EnsEMBL/Pipeline/Production/CodingDensity.pm b/modules/Bio/EnsEMBL/Pipeline/Production/CodingDensity.pm
index 2204842159..2b2ca0e6e0 100644
--- a/modules/Bio/EnsEMBL/Pipeline/Production/CodingDensity.pm
+++ b/modules/Bio/EnsEMBL/Pipeline/Production/CodingDensity.pm
@@ -13,24 +13,6 @@ sub get_option {
   return \@biotypes;
 }
 
-
-sub get_density {
-  my ($self, $block, $biotypes) = @_;
-  my $count = 0;
-  foreach my $biotype (@$biotypes) {
-    $count += scalar(@{ $block->get_all_Genes_by_type($biotype) });
-  }
-  return $count;
-}
-
-sub get_total {
-  my ($self, $option) = @_;
-  my $species = $self->param('species');
-  my $ga = Bio::EnsEMBL::Registry->get_adaptor($species, 'core', 'gene');
-  return scalar(@{ $ga->fetch_all_by_biotype($option) });
-}
-
-
 1;
 
 
diff --git a/modules/Bio/EnsEMBL/Pipeline/Production/DensityGenerator.pm b/modules/Bio/EnsEMBL/Pipeline/Production/DensityGenerator.pm
index ff53eba884..4e87c614ba 100644
--- a/modules/Bio/EnsEMBL/Pipeline/Production/DensityGenerator.pm
+++ b/modules/Bio/EnsEMBL/Pipeline/Production/DensityGenerator.pm
@@ -206,5 +206,22 @@ sub get_option {
   my $self = @_;
 }
 
+sub get_density {
+  my ($self, $block, $biotypes) = @_;
+  my $count = 0;
+  foreach my $biotype (@$biotypes) {
+    $count += scalar(@{ $block->get_all_Genes_by_type($biotype) });
+  }
+  return $count;
+}
+
+sub get_total {
+  my ($self, $option) = @_;
+  my $species = $self->param('species');
+  my $ga = Bio::EnsEMBL::Registry->get_adaptor($species, 'core', 'gene');
+  return scalar(@{ $ga->fetch_all_by_biotype($option) });
+}
+
+
 
 1;
diff --git a/modules/Bio/EnsEMBL/Pipeline/Production/NonCodingDensity.pm b/modules/Bio/EnsEMBL/Pipeline/Production/NonCodingDensity.pm
index af3ccc75f0..db461167aa 100644
--- a/modules/Bio/EnsEMBL/Pipeline/Production/NonCodingDensity.pm
+++ b/modules/Bio/EnsEMBL/Pipeline/Production/NonCodingDensity.pm
@@ -13,22 +13,6 @@ sub get_option {
   return \@biotypes;
 }
 
-sub get_density {
-  my ($self, $block, $biotypes) = @_;
-  my $count = 0;
-  foreach my $biotype (@$biotypes) {
-    $count += scalar(@{ $block->get_all_Genes_by_type($biotype) });
-  }
-  return $count;
-}
-
-sub get_total {
-  my ($self, $option) = @_;
-  my $species = $self->param('species');
-  my $ga = Bio::EnsEMBL::Registry->get_adaptor($species, 'core', 'gene');
-  return scalar(@{ $ga->fetch_all_by_biotype($option) });
-}
-
 1;
 
 
diff --git a/modules/Bio/EnsEMBL/Pipeline/Production/PseudogeneDensity.pm b/modules/Bio/EnsEMBL/Pipeline/Production/PseudogeneDensity.pm
index cec370874f..d71af31dab 100644
--- a/modules/Bio/EnsEMBL/Pipeline/Production/PseudogeneDensity.pm
+++ b/modules/Bio/EnsEMBL/Pipeline/Production/PseudogeneDensity.pm
@@ -13,22 +13,6 @@ sub get_option {
   return \@biotypes;
 }
 
-sub get_density {
-  my ($self, $block, $biotypes) = @_;
-  my $count = 0;
-  foreach my $biotype (@$biotypes) {
-    $count += scalar(@{ $block->get_all_Genes_by_type($biotype) });
-  }
-  return $count;
-}
-
-sub get_total {
-  my ($self, $option) = @_;
-  my $species = $self->param('species');
-  my $ga = Bio::EnsEMBL::Registry->get_adaptor($species, 'core', 'gene');
-  return scalar(@{ $ga->fetch_all_by_biotype($option) });
-}
-
 
 1;
 
-- 
GitLab