[ensembl-dev] testing Perl API access

Ian Long den ianlongden at gmail.com
Mon Apr 15 23:03:24 BST 2013


You want to connect to the core database and not the variation one.

Mus_musculus_core_67_37


Alternatively use the registry...

Ian.

On 15 Apr 2013, at 20:31, "Alex Reynolds (UW)" <reynolda at uw.edu> wrote:

>> Message: 1
>> Date: Mon, 15 Apr 2013 08:49:56 +0100
>> From: Andy Yates <ayates at ebi.ac.uk>
>> Subject: Re: [ensembl-dev] testing Perl API access
>> To: Ensembl developers list <dev at ensembl.org>
>> Message-ID: <178FC81D-1AD1-4FF0-B30F-26F6C72BAA45 at ebi.ac.uk>
>> Content-Type: text/plain; charset=us-ascii
>> 
>> Dear Alex,
>> 
>> I believe you've hit a number of issues here.
>> 
>> 1). Your output says you are using Ensembl API release 72; this is not the live version. I think you've hit an issue where you pasted the API download URL into a Unix/Linux shell and not quoted the URL. The last release of the website introduced a new URL for downloading the APIs which avoids this issue. For example this link will download the 67 Ensembl core API (switch the number to 71 to download the latest release):
>> 
>> http://www.ensembl.org/cvsdownloads/ensembl-67.tar.gz
>> 
>> 2). You are connecting to USEast but this only hosts the current and previous release of the Ensembl databases. At the time of writing this is releases 71 & 70. Should you require 67 then you will have to use ensembldb.ensembl.org or host the required databases yourself.
> 
> Hi Andy,
> 
> I made some progress applying the tarball you provided. However, I cannot seem to access genes for Mus musculus. 
> 
> Here is an example script to test things out. I am trying to access gene ENSMUSG00000090986, release 67 (also available via: http://uswest.ensembl.org/Mus_musculus/Gene/Idhistory?g=ENSMUSG00000090986):
> 
> ----
> #!/usr/bin/env perl
> 
> use strict;
> use warnings;
> use Data::Dumper;
> use Bio::EnsEMBL::DBSQL::DBAdaptor;
> 
> use Bio::EnsEMBL::ApiVersion;
> printf( "The API version used is %s\n", software_version() );
> 
> my $host   = 'ensembldb.ensembl.org';
> my $user   = 'anonymous';
> my $dbname = 'mus_musculus_variation_67_37';
> my $port   = 5306;
> 
> my $db = new Bio::EnsEMBL::DBSQL::DBAdaptor(-host => $host,
>                                            -user => $user,
>                                            -dbname => $dbname,
>                                            -port => $port);
> 
> my $slice_adaptor = $db->get_SliceAdaptor();
> 
> my $slice = $slice_adaptor->fetch_by_gene_stable_id('ENSMUSG00000090986', 5000);
> 
> my $sequence = $slice->seq();
> 
> print "$sequence\n";
> ----
> 
> And here is the exception that is thrown:
> 
> $ ./test2.pl
> The API version used is 67
> DBD::mysql::st execute failed: Table 'mus_musculus_variation_67_37.gene' doesn't exist at /home/areynolds/src/ensembl/modules/Bio/EnsEMBL/DBSQL/BaseAdaptor.pm line 524.
> 
> -------------------- EXCEPTION --------------------
> MSG: Detected an error whilst executing SQL 'SELECT  g.gene_id, g.seq_region_id, g.seq_region_start, g.seq_region_end, g.seq_region_strand, g.analysis_id, g.biotype, g.display_xref_id, g.description, g.status, g.source, g.is_current, g.canonical_transcript_id, g.canonical_annotation, g.stable_id, g.version, UNIX_TIMESTAMP(g.created_date), UNIX_TIMESTAMP(g.modified_date), x.display_label, x.dbprimary_acc, x.description, x.version, exdb.db_name, exdb.status, exdb.db_release, exdb.db_display_name, x.info_type, x.info_text
> FROM (( (gene g) 
>  LEFT JOIN xref x ON x.xref_id = g.display_xref_id ) 
>  LEFT JOIN external_db exdb ON exdb.external_db_id = x.external_db_id ) 
> WHERE g.stable_id = ? AND g.is_current = 1 
> ': DBD::mysql::st execute failed: Table 'mus_musculus_variation_67_37.gene' doesn't exist at /home/areynolds/src/ensembl/modules/Bio/EnsEMBL/DBSQL/BaseAdaptor.pm line 524.
> 
> STACK Bio::EnsEMBL::DBSQL::BaseAdaptor::generic_fetch /home/areynolds/src/ensembl/modules/Bio/EnsEMBL/DBSQL/BaseAdaptor.pm:525
> STACK Bio::EnsEMBL::DBSQL::GeneAdaptor::fetch_by_stable_id /home/areynolds/src/ensembl/modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm:268
> STACK Bio::EnsEMBL::DBSQL::SliceAdaptor::fetch_by_gene_stable_id /home/areynolds/src/ensembl/modules/Bio/EnsEMBL/DBSQL/SliceAdaptor.pm:1355
> STACK toplevel ./test2.pl:23
> Ensembl API version = 67
> ---------------------------------------------------
> 
> I guess I'm confused about the exception, since it looks like there is a gene record for ENSMUSG00000090986 on the web front-end. Am I still missing something with my setup?
> 
> Regards,
> Alex
> 
> 
> _______________________________________________
> 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