[ensembl-dev] local Compara and perl API

Stephen Fitzgerald stephenf at ebi.ac.uk
Fri Jul 18 11:23:18 BST 2014


Hi Thomas, try using this "reg_conf.pl" file in the same directory as your 
script:

> cat reg_conf.pl

###
use strict;
use Bio::EnsEMBL::Utils::ConfigRegistry;
use Bio::EnsEMBL::DBSQL::DBAdaptor;
use Bio::EnsEMBL::Compara::DBSQL::DBAdaptor;
use Bio::EnsEMBL::Registry;

my @aliases;


new Bio::EnsEMBL::Compara::DBSQL::DBAdaptor(
         -host => 'xxxx',
         -user => 'xxxx',
         -port => 5306,
         -pass => 'xxxx',
         -species => 'Multi',
         -group => 'compara',
         -dbname => 'xxxx');

1;



and call it explicitly in your script.

###
use strict;
use warnings;
use Data::Dumper;
use Bio::EnsEMBL::Registry;

Bio::EnsEMBL::Registry->load_all("reg_conf.pl");
my $member_adaptor = Bio::EnsEMBL::Registry->get_adaptor('Multi', 'compara', 'GeneMember');
print Dumper $member_adaptor;
###

See if this works.

Cheers,
Stephen.




On Fri, 18 Jul 2014, Thomas Derrien wrote:

> Dear all,
> 
> I have installed a local version of the compara database named GENOCOMP (without the core(s) databases).
> Then, I would like to use the perl API to query it.
> Here is the simple script I used with the ensembl.init file at the end of the email.
> 
> ###############
> use strict;
> use warnings;
> use Data::Dumper;
> use Bio::EnsEMBL::Registry;
> 
> Bio::EnsEMBL::Registry->load_all();
> my $member_adaptor = Bio::EnsEMBL::Registry->get_adaptor('Compara', 'compara', 'GeneMember');
> print Dumper $member_adaptor;
> #################
> 
> This scripts returns the following error:
> 
> ------------------- WARNING ----------------------
> MSG: Compara is not a valid species name (check DB and API version)
> FILE: Bio/EnsEMBL/Registry.pm LINE: 1198
> CALLED BY: Bio/EnsEMBL/Registry.pm  LINE: 983
> Date (localtime)    = Fri Jul 18 11:04:36 2014
> Ensembl API version = 75
> ---------------------------------------------------
> 
> -------------------- EXCEPTION --------------------
> MSG: Can not find internal name for species 'Compara'
> STACK Bio::EnsEMBL::Registry::get_adaptor /home/genouest/umr6061/recomgen/tderrien/src/ensembl/modules/Bio/EnsEMBL/Registry.pm:985
> STACK toplevel getOrthologAPI_genocomp.pl:65
> Date (localtime)    = Fri Jul 18 11:04:36 2014
> Ensembl API version = 75
> ---------------------------------------------------
> 
> 
> I also tried with:
> my $member_adaptor = Bio::EnsEMBL::Registry->get_adaptor(‘Multi', 'compara', 'GeneMember');
> without any success.
> 
> Any help would be much appreciated.
> 
> Thanks in advance
> 
> Thomas
> 
> 
> 
> PS: My ensembl.init file
> $ cat ~/.ensembl_init 
> use strict;
> 
> use Bio::EnsEMBL::Utils::ConfigRegistry;
> use Bio::EnsEMBL::DBSQL::DBAdaptor;
> use Bio::EnsEMBL::Compara::DBSQL::DBAdaptor;
> 
> 
> my $host   = 'genobdd';
> my $user   = 'GENOCOMP';
> my $port   = 5306;
> my $dbname = 'GENOCOMP';
> my $pass = ‘XXXXXXXXX';
> 
> 
> new Bio::EnsEMBL::Compara::DBSQL::DBAdaptor(
>   -host    => $host,
>   -user    => $user,
>   -pass   => $pass,
>   -port    => $port,
>   -dbname  => $dbname,
>   -verbose => 1
> );
> 
> 1;
> 
>


More information about the Dev mailing list