From 2901a1ad82341adc41a76e54c1cc6dd74578531b Mon Sep 17 00:00:00 2001
From: Jan-hinnerk Vogel <jhv@sanger.ac.uk>
Date: Wed, 2 Aug 2006 15:12:42 +0000
Subject: [PATCH] fetch_all_by_biotype  added

---
 modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm | 30 ++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm
index 93a7fc6102..ad8f1b4b48 100644
--- a/modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm
+++ b/modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm
@@ -205,6 +205,36 @@ sub fetch_by_stable_id {
   return $gene;
 }
 
+
+
+=head2 fetch_all_by_biotype 
+
+  Arg [1]    : String $biotype 
+               The biotype of the gene to retrieve
+  Example    : $gene = $gene_adaptor->fetch_all_by_biotype('protein_coding') ; 
+  Description: Retrieves an array reference of gene objects from the database via its biotype.
+               The genes will be retrieved in its native coordinate system (i.e.
+               in the coordinate system it is stored in the database). It may
+               be converted to a different coordinate system through a call to
+               transform() or transfer(). If the gene or exon is not found
+               undef is returned instead.
+  Returntype  : listref of Bio::EnsEMBL::Gene
+  Exceptions : if we cant get the gene in given coord system
+  Caller     : general
+  Status     : At Risk 
+
+=cut
+
+sub fetch_all_by_biotype {
+  my ($self, $biotype) = @_;
+
+  my $constraint = "g.biotype = '$biotype' and g.is_current = 1" ;
+  my @genes  = @{ $self->generic_fetch($constraint) };
+  return \@genes ;
+}
+
+
+
 =head2 fetch_all_versions_by_stable_id 
 
   Arg [1]     : String $stable_id 
-- 
GitLab