[ensembl-dev] testing Perl API access
Alex Reynolds
reynolda at uw.edu
Sun Apr 14 03:07:36 BST 2013
I am attempting to learn the Ensembl Perl API for accessing some mouse data from Ensembl release 67.
I started with the installation document here:
http://may2012.archive.ensembl.org/info/docs/api/api_installation.html
I replaced "bioperl-live" with "bioperl-1.2.3"
I used the core API documentation examples to write a test script.
http://may2012.archive.ensembl.org/info/docs/api/core/core_tutorial.html#connecting
Here is the script I wrote:
----
$ more ensembl_test.pl
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
use Bio::EnsEMBL::Registry;
use Bio::EnsEMBL::ApiVersion;
printf( "The API version used is %s\n", software_version() );
my $registry = 'Bio::EnsEMBL::Registry';
$registry->load_registry_from_db(
-host => 'useastdb.ensembl.org',
-user => 'anonymous'
);
# should return Dumped contents of reference to list
print Dumper $registry->get_all_DBAdaptors();
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()
);
}
----
The output from this script is:
----
The API version used is 72
$VAR1 = [];
----
Should the value of @db_adaptors (or the list-reference equivalent) be empty? Or did I miss something with the module setup process?
Regards,
Alex
More information about the Dev
mailing list