From 5e6a89c1a023f1860de193c361e226658b486e61 Mon Sep 17 00:00:00 2001 From: Glenn Proctor <gp1@sanger.ac.uk> Date: Wed, 16 Jul 2003 10:37:43 +0000 Subject: [PATCH] Added more systematically-named list_dbIDs and list_stable_dbIDs to replace list_geneIds and list_stable_geneIds; the old functions are still there for backwards compatibilty but now print a warning and call the appropriate list_ function. Common functionality for list_ functions is in BaseAdaptor.pm. --- modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm | 55 ++++++++++++++++-------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm index b5185bfd37..5d3f9eb34d 100644 --- a/modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm @@ -75,7 +75,7 @@ sub new { Arg [1] : none Example : @gene_ids = $gene_adaptor->list_geneIds(); - Description: Gets an array of internal ids for all genes in the current db + Description: DEPRECATED; use list_dbIDs instead Returntype : list of ints Exceptions : none Caller : ? @@ -85,26 +85,33 @@ sub new { sub list_geneIds { my ($self) = @_; - my @out; - my $sth = $self->prepare("SELECT gene_id FROM gene"); - $sth->execute; + $self->warn("list_geneIds is deprecated; use list_dbIDs instead"); + return $self->list_dbIDs(); +} - while (my ($id) = $sth->fetchrow) { - push(@out, $id); - } +=head2 list_dbIDs + + Arg [1] : none + Example : @gene_ids = $gene_adaptor->list_dbIDs(); + Description: Gets an array of internal ids for all genes in the current db + Returntype : list of ints + Exceptions : none + Caller : ? + +=cut - $sth->finish; +sub list_dbIDs { + my ($self) = @_; - return \@out; + return $self->_list_dbIDs("gene"); } - =head2 list_stable_geneIds Arg [1] : list_stable_gene_ids Example : @stable_ids = $gene_adaptor->list_stable_gene_ids(); - Description: Returns a list stable ids for all genes in the current db + Description: DEPRECATED; use list_stable_dbIDs() instead. Returntype : list of strings Exceptions : none Caller : ? @@ -114,17 +121,27 @@ sub list_geneIds { sub list_stable_geneIds { my ($self) = @_; - my @out; - my $sth = $self->prepare("SELECT stable_id FROM gene_stable_id"); - $sth->execute; - - while (my ($id) = $sth->fetchrow) { - push(@out, $id); - } + $self->warn("list_stable_geneIds is deprecated; use list_stable_dbIDs instead"); + return $self->list_stable_dbIDs(); - return \@out; } +=head2 list_stable_dbIDs + + Arg [1] : none + Example : @stable_gene_ids = $gene_adaptor->list_stable_dbIDs(); + Description: Gets an array of stable ids for all genes in the current db + Returntype : list of ints + Exceptions : none + Caller : ? + +=cut + +sub list_stable_dbIDs { + my ($self) = @_; + + return $self->_list_dbIDs("gene_stable_id", "stable_id"); +} =head2 fetch_by_dbID -- GitLab