[ensembl-dev] local Compara and perl API

Thomas Derrien tderrien at univ-rennes1.fr
Mon Jul 21 08:56:11 BST 2014


Hi Stephen,

Thank you, it works!
Looking at your examples, I realized the only parameter I was not sure was the port. I then commented the line and it works perfectly well.
Thanks again

Thomas

Le 18 juil. 2014 à 15:06, Stephen Fitzgerald <stephenf at ebi.ac.uk> a écrit :

> Hi Thomas, can you try to specify the compara database schema version (I'm guessing it's the latest,  version 75) in the reg_conf.pl eg.
> 
>       new Bio::EnsEMBL::Compara::DBSQL::DBAdaptor(
>              -host => 'xxxx',
>              -user => 'xxxx',
>              -port => 5306,
>              -pass => 'xxxx',
>              -db_version=>'75',
>              -species => 'Multi',
>              -group => 'compara',
>              -dbname => 'xxxx');
> 
> Are you using the same API code version with the same database schema version (you can find this in the meta table) ?
> 
> 
> Can you also try your code with the publicly available ensembl mysql server using the following 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 => 'ensembldb.ensembl.org',
>        -user => 'anonymous',
>        -species => 'Multi',
>        -db_version=> 75,
>        -group => 'compara',
>        -port => 5306,
>        -dbname => 'ensembl_compara_75');
> 
> 1;
> 
> 
> You should get the following output:
> 
> $VAR1 = bless( {
>                 '_is_multispecies' => '',
>                 'db' => bless( {
>                                  '_is_multispecies' => '',
>                                  '_dbc' => bless( {
>                                                     'db_handle3467' => bless( {}, 'DBI::db' ),
>                                                     'connected3467' => 1,
>                                                     '_password' => sub { "DUMMY" },
>                                                     '_username' => 'anonymous',
>                                                     '_timeout' => 0,
>                                                     '_driver_object' => bless( {
> 
> '_parent' => $VAR1->{'db'}{'_dbc'}
> 
> }, 'Bio::EnsEMBL::DBSQL::Driver::mysql' ),
>                                                     '_host' => 'ensembldb.ensembl.org',
>                                                     '_port' => 5306,
>                                                     '_query_count' => 1,
>                                                     '_driver' => 'mysql',
>                                                     '_dbname' => 'ensembl_compara_75'
>                                                   }, 'Bio::EnsEMBL::DBSQL::DBConnection' ),
>                                  '_species' => 'Multi',
>                                  '_group' => 'compara',
>                                  '_species_id' => 1
>                                }, 'Bio::EnsEMBL::Compara::DBSQL::DBAdaptor' ),
>                 'dbc' => $VAR1->{'db'}{'_dbc'},
>                 'species_id' => 1
>               }, 'Bio::EnsEMBL::Compara::DBSQL::GeneMemberAdaptor' );
> 
> Cheers,
> Stephen.
> 
> 
> 
> On Fri, 18 Jul 2014, Thomas Derrien wrote:
> 
>> Hi Stephen,
>> Thank you for your reply.
>> With your example, I encounter another error (copy-pasted here):
>> Could not connect to database XXXX as user XXXX using [DBI:mysql:database=XXXXX;host=XXXX;port=5306] as a locator:
>> DBI connect(‘database=XXXX;host=genobdd;port=5306’,'XXXX',...) failed: Can't connect to MySQL server on ‘XXXX' (111) at
>> src/ensembl/modules/Bio/EnsEMBL/DBSQL/DBConnection.pm line 263.
>> -------------------- EXCEPTION --------------------
>> MSG: Could not connect to database GENOCOMP as user XXXXX using [DBI:mysql:database=XXXXX;host=XXXX;port=5306] as a locator:
>> DBI connect(‘database=XXX;host=genobdd;port=5306’,'XXXXX',...) failed: Can't connect to MySQL server on ‘xxxxx' (111) at
>> /home/genouest/umr6061/recomgen/tderrien/src/ensembl/modules/Bio/EnsEMBL/DBSQL/DBConnection.pm line 263.
>> STACK Bio::EnsEMBL::DBSQL::DBConnection::connect
>> /home/genouest/umr6061/recomgen/tderrien/src/ensembl/modules/Bio/EnsEMBL/DBSQL/DBConnection.pm:279
>> STACK Bio::EnsEMBL::DBSQL::DBConnection::db_handle
>> /home/genouest/umr6061/recomgen/tderrien/src/ensembl/modules/Bio/EnsEMBL/DBSQL/DBConnection.pm:676
>> STACK Bio::EnsEMBL::DBSQL::DBConnection::prepare
>> /home/genouest/umr6061/recomgen/tderrien/src/ensembl/modules/Bio/EnsEMBL/DBSQL/DBConnection.pm:707
>> STACK Bio::EnsEMBL::DBSQL::BaseAdaptor::prepare
>> /home/genouest/umr6061/recomgen/tderrien/src/ensembl/modules/Bio/EnsEMBL/DBSQL/BaseAdaptor.pm:176
>> STACK Bio::EnsEMBL::DBSQL::BaseMetaContainer::list_value_by_key
>> /home/genouest/umr6061/recomgen/tderrien/src/ensembl/modules/Bio/EnsEMBL/DBSQL/BaseMetaContainer.pm:121
>> STACK Bio::EnsEMBL::DBSQL::BaseMetaContainer::get_schema_version
>> /home/genouest/umr6061/recomgen/tderrien/src/ensembl/modules/Bio/EnsEMBL/DBSQL/BaseMetaContainer.pm:77
>> STACK Bio::EnsEMBL::Registry::version_check
>> /home/genouest/umr6061/recomgen/tderrien/src/ensembl/modules/Bio/EnsEMBL/Registry.pm:2675
>> STACK Bio::EnsEMBL::Registry::get_adaptor
>> /home/genouest/umr6061/recomgen/tderrien/src/ensembl/modules/Bio/EnsEMBL/Registry.pm:1050
>> STACK toplevel connect.pl:7
>> Date (localtime)    = Fri Jul 18 14:27:14 2014
>> Ensembl API version = 75
>> For information, a "normal" connection with "mysql -u XXX -h XXXX -D XXXX -p" works well.
>> Thank you for your help.
>> Cheers,
>> Thomas
>> Le 18 juil. 2014 à 12:23, Stephen Fitzgerald <stephenf at ebi.ac.uk> a écrit :
>> 
>>      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;
>> 
>>      _______________________________________________
>>      Dev mailing list    Dev at ensembl.org
>>      Posting guidelines and subscribe/unsubscribe info: http://lists.ensembl.org/mailman/listinfo/dev
>>      Ensembl Blog: http://www.ensembl.info/
> _______________________________________________
> Dev mailing list    Dev at ensembl.org
> Posting guidelines and subscribe/unsubscribe info: http://lists.ensembl.org/mailman/listinfo/dev
> Ensembl Blog: http://www.ensembl.info/





More information about the Dev mailing list