[ensembl-dev] Ensemble api tutorial
enrico1970 at yahoo.com
enrico1970 at yahoo.com
Mon Oct 8 21:18:47 BST 2012
Dear Kieron,
thank you very much for the answer.
I downloaded the ensemble core code from the page http://www.ensembl.org/info/docs/api/api_installation.html, in the section "Download the API packages you need: ensembl" at the link:
http://cvs.sanger.ac.uk/cgi-bin/viewvc.cgi/ensembl.tar.gz?root=ensembl&only_with_tag=branch-ensembl-68&view=tar
I inserted db_version => 68 in the code and it retrieves the list of databases,
but when I run the code to retrieve CDS, cDNA, 5' and 3' (that you'll find at the end of this e-mail) it reports the error:
"For homo_sapiens_core_68_37 there is a difference in the software release (69) and the database release (68). You should update one of these to ensure that your script does not crash."
I would really appreciate if you could reply to the following questions:
-How may understand which version of the code I downloaded (the link contained "branch-ensembl-68" but it is not recognised as version 68)
-How can I retrieve the release 68 of the software?
-How can I retrieve the older relases of the software (I will need to compare the results with with Gencode v7that it could use a different annotation version) ?
Thanks,
Enrico
You can find the code to retrieve CDS, cDNA, 5' and 3' below
use Bio::EnsEMBL::Registry;
my $registry = 'Bio::EnsEMBL::Registry';
$registry->load_registry_from_db(
-host => 'ensembldb.ensembl.org', # alternatively 'useastdb.ensembl.org'
-user => 'anonymous',
-verbose => 1,
db_version => 68
);
my $slice_adaptor = $registry->get_adaptor( "Human", 'Core', 'Slice' );
my $slice = $slice_adaptor->fetch_by_region( 'chromosome', 'X', 1e6, 10e6 );
my $genes = $slice->get_all_Genes();
my $transcripts = $gene->get_all_Transcripts();
# The spliced_seq() method returns the concatenation of the exon
# sequences. This is the cDNA of the transcript
print "cDNA: ", $transcript->spliced_seq(), "\n";
# The translateable_seq() method returns only the CDS of the transcript
print "CDS: ", $transcript->translateable_seq(), "\n";
# UTR sequences are obtained via the five_prime_utr() and
# three_prime_utr() methods
my $fiv_utr = $transcript->five_prime_utr();
my $thr_utr = $transcript->three_prime_utr();
print "5' UTR: ", ( defined $fiv_utr ? $fiv_utr->seq() : "None" ), "\n";
print "3' UTR: ", ( defined $thr_utr ? $thr_utr->seq() : "None" ), "\n";
# The protein sequence is obtained from the translate() method. If the
# transcript is non-coding, undef is returned.
my $protein = $transcript->translate();
print "Translation: ", ( defined $protein ? $protein->seq() : "None" ), "\n";
________________________________
From: Kieron Taylor <ktaylor at ebi.ac.uk>
To: enrico1970 at yahoo.com; Ensembl developers list <dev at ensembl.org>
Sent: Monday, 8 October 2012, 20:03
Subject: Re: [ensembl-dev] Ensemble api tutorial
Dear Enrico,
This error is consistent with using the wrong version of the API for a given database.
Under these circumstances you can use the -verbose => 1 flag in load_registry_from_db() to highlight the problem.
If you have checked head code out of CVS, your code will be too new for our public servers. You can correct this with either a release 68 code download, or (less recommended) add the db_version => 68 argument to the load_registry command.
Regards,
On 8 Oct 2012, at 18:29, enrico1970 at yahoo.com wrote:
> Dear Support,
> I am executing the code to "get a list of all Ensemble databases installed on a given database host" from http://www.ensembl.org/info/docs/api/core/core_tutorial.html
> but when I run the code it does not return any database or any error.
>
> Please find the code below.
>
> Thanks,
>
> Enrico
>
> use Bio::EnsEMBL::Registry;
>
> my $registry = 'Bio::EnsEMBL::Registry';
>
> $registry->load_registry_from_db(
> -host => 'ensembldb.ensembl.org', # alternatively 'useastdb.ensembl.org'
> -user => 'anonymous'
> );
>
> my @db_adaptors = @{ $registry->get_all_DBAdaptors() };
>
> foreach my $db_adaptor (@db_adaptors) {
> my $db_connection = $db_adaptor->dbc();
>
> printf(
> "species/group\t%s/%s\ndatabase\t%s\nhost:port\t%s:%s\n\n",
> $db_adaptor->species(), $db_adaptor->group(),
> $db_connection->dbname(), $db_connection->host(),
> $db_connection->port()
> );
> }
> _______________________________________________
> 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/
Kieron Taylor PhD.
Ensembl Core software developer
EMBL - European Bioinformatics Institute
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ensembl.org/pipermail/dev_ensembl.org/attachments/20121008/d661d384/attachment.html>
More information about the Dev
mailing list