[ensembl-dev] FW: ensembl api query

BURT David dave.burt at roslin.ed.ac.uk
Sat Jun 11 15:03:12 BST 2011

Recently ran a "simple" test of my Ensembl perl api install using an example from the core tutorial - to list external database entries.

Perl program and output is attached and below.


#!/bin/perl.exe -w

use strict;

use Bio::EnsEMBL::Registry;
my $registry = 'Bio::EnsEMBL::Registry';

# Define a helper subroutine to print DBEntries
sub print_DBEntries
    my $db_entries = shift;

    foreach my $dbe ( @{$db_entries} ) {
        printf "\tXREF %s (%s)\n", $dbe->display_id(), $dbe->dbname();

my $gene_adaptor = $registry->get_adaptor( 'Human', 'Core', 'Gene' );

# Get the 'COG6' gene from human
my $gene = $gene_adaptor->fetch_by_display_label('COG6');

print "GENE ", $gene->stable_id(), "\n";
print_DBEntries( $gene->get_all_DBEntries() );

foreach my $transcript ( @{ $gene->get_all_Transcripts() } ) {
    print "TRANSCRIPT ", $transcript->stable_id(), "\n";
    print_DBEntries( $transcript->get_all_DBEntries() );

    # Watch out: pseudogenes have no translation
    if ( defined $transcript->translation() ) {
        my $translation = $transcript->translation();

        print "TRANSLATION ", $translation->stable_id(), "\n";
        print_DBEntries( $translation->get_all_DBEntries() );


$ perl dbentry_test.pl
GENE ENSG00000133103
Use of uninitialized value in printf at dbentry_test.pl line 15.
        XREF OTTHUMG00000016768 ()
Use of uninitialized value in printf at dbentry_test.pl line 15.
        XREF COG6 ()
Can't locate object method "add_linkage_type" via package "Bio::EnsEMBL::Identit
yXref" at /cygdrive/c/Bioinformatics/Ensembl/src/ensembl/modules/Bio/EnsEMBL/DBS
QL/DBEntryAdaptor.pm line 1262.
Any ideas why this no longer works? Last time I ran this was with build 56.
Looks like $dbe->dbname() is undefined?

Dave Burt

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dbentry_errors.txt
URL: <http://mail.ensembl.org/pipermail/dev_ensembl.org/attachments/20110611/d1a4a009/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbentry_test.pl
Type: application/octet-stream
Size: 1099 bytes
Desc: dbentry_test.pl
URL: <http://mail.ensembl.org/pipermail/dev_ensembl.org/attachments/20110611/d1a4a009/attachment.obj>

More information about the Dev mailing list