From 21fb32c8bc0bed3830aebcd62624925a298783c8 Mon Sep 17 00:00:00 2001
From: Magali Ruffier <mr6@ebi.ac.uk>
Date: Tue, 4 Sep 2012 12:58:02 +0000
Subject: [PATCH] get_slice method specific for gene count rather than return
 all toplevel slices, returns all slices with genes does not affect much
 species with a reduced number of toplevel slices but increases things
 considerably for large number of toplevel slices

---
 .../Bio/EnsEMBL/Pipeline/Production/GeneCount.pm  | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/modules/Bio/EnsEMBL/Pipeline/Production/GeneCount.pm b/modules/Bio/EnsEMBL/Pipeline/Production/GeneCount.pm
index d88e141aa1..6cc5914efb 100644
--- a/modules/Bio/EnsEMBL/Pipeline/Production/GeneCount.pm
+++ b/modules/Bio/EnsEMBL/Pipeline/Production/GeneCount.pm
@@ -25,6 +25,21 @@ sub get_total {
   return $total;
 }
 
+sub get_slices {
+  my ($self, $species) = @_;
+  my @slices;
+  my $dba = Bio::EnsEMBL::Registry->get_DBAdaptor($species, 'core');
+  my $sa = Bio::EnsEMBL::Registry->get_adaptor($species, 'core', 'slice');
+  my $helper = $dba->dbc()->sql_helper();
+  my $sql = q{
+    SELECT DISTINCT seq_region_id FROM gene };
+  my @ids = @{ $helper->execute_simple(-SQL => $sql) };
+  foreach my $id(@ids) {
+    push @slices, $sa->fetch_by_seq_region_id($id);
+  }
+  return \@slices;
+}
+
 
 sub get_feature_count {
   my ($self, $slice, $key, $biotypes) = @_;
-- 
GitLab