[ensembl-dev] How to get all genes having a specific interpro domain

Andy Yates ayates at ebi.ac.uk
Wed Sep 12 10:48:35 BST 2012


Hi Mei,

The name multi is reserved for databases which contain data from more than one species. You should switch to a method of iterating though the species you need to query e.g.

my @species = qw/human mouse zebrafish/;
foreach my $species (@species) {
  my $gene_adaptor=$registry->get_adaptor( $species, 'Core', 'Gene' );
  my @genes=@{$gene_adaptor->fetch_all_by_domain('IPR000047')};
  foreach my $gene (@genes) {
    print $gene->stable_id,"\n";
  }
}

Or if you want all species then you can use:

my @adaptors = $registry->get_all_adaptors(-GROUP => 'core', -TYPE => 'gene');
foreach my $gene_adaptor (@adaptors) {
  my @genes=@{$gene_adaptor->fetch_all_by_domain('IPR000047')};
  foreach my $gene (@genes) {
    print $gene->stable_id,"\n";
  }
}


HTH

Andy

Andrew Yates                   Ensembl Core Software Project Leader
EMBL-EBI                       Tel: +44-(0)1223-492538
Wellcome Trust Genome Campus   Fax: +44-(0)1223-494468
Cambridge CB10 1SD, UK         http://www.ensembl.org/

On 12 Sep 2012, at 03:11, JiangMei wrote:

> Hi All. Sorry to bother you.
> 
> I want to fetch all genes having a specific interpro domain in multiple species. My script is shown in the following:
> 
> use Bio::EnsEMBL::Registry;
> my $registry = 'Bio::EnsEMBL::Registry';
> $registry->load_registry_from_db(
>       -host       =>'ensembldb.ensembl.org',
>       -user       =>'anonymous',
>       -db_version =>'67');
> 
> my $gene_adaptor=$registry->get_adaptor( 'multi', 'Core', 'Gene' );
> my @genes=@{$gene_adaptor->fetch_all_by_domain('IPR000047')};
> for $gene(@genes){
>     print $gene->stable_id,"\n";
> }
> 
> It seems it is not right to use 'multi' (in red) here. My question is how to define multiple species?
> 
> Wish your help! Thanks very much! I really appreciate it.
> 
> 
> Best wish es,
> 
> Mei
> _______________________________________________
> Dev mailing list    Dev at ensembl.org
> List admin (including subscribe/unsubscribe): http://lists.ensembl.org/mailman/listinfo/dev
> Ensembl Blog: http://www.ensembl.info/





More information about the Dev mailing list