I wrote a script to gather some data using the Ensembl API on my personal linux machine running perl 5.20. I cloned the install folder to a work machine that runs Perl 5.10.1(not upgradable) to show my findings to some peers and I started receiving errors:
#!/usr/bin/env perl
use warnings;
use strict;
use lib "$ENV{HOME}/Ensembl/src/bioperl-1.6.1";
use lib "$ENV{HOME}/Ensembl/src/ensembl/modules";
use lib "$ENV{HOME}/Ensembl/src/ensembl-compara/modules";
use lib "$ENV{HOME}/Ensembl/src/ensembl-variation/modules";
use lib "$ENV{HOME}/Ensembl/src/ensembl-funcgen/modules";
use Bio::EnsEMBL::Registry;
use Bio::EnsEMBL::Utils::Slice qw(split_Slices);
use Data::Dumper;
use Switch;
print"Establishing connection...";
my $registry = 'Bio::EnsEMBL::Registry';
$registry->load_registry_from_db(
-host => 'ensembldb.ensembl.org',
-user => 'anonymous',
#-port => 3337, #add this line for hg37
);
my $slice_adaptor = $registry->get_adaptor('human','core','slice');
my $chr = '4';
my $start = '152328241';
my $end = '152328241';
my $slice = $slice_adaptor->fetch_by_region('chromosome',$chr,$start,$end);
my $pf_adaptor = $registry->get_adaptor('human', 'variation', 'phenotypefeature');
my $vf_adaptor = $registry->get_adaptor('human', 'variation', 'variationfeature');
my $pfs = $pf_adaptor->fetch_all_by_Slice($slice);
my $somatic_vfs = $vf_adaptor->fetch_all_somatic_by_Slice($slice);
my $germline_vfs = $vf_adaptor->fetch_all_by_Slice($slice);
Specifically I get "Can't call method "fetch_by_region" on an undefined value at metric.pl line 29". I'm not sure what's causing these errors. The Ensembl package is surely being loaded, otherwise there would be a warning further up about dependencies. I would think it has something to do with explicitly loading in the package for the "fetch_by_region" method, but I make these kinds of calls many more times and it would make my script significantly bulkier.
http://www.ensembl.org/info/docs/Doxygen/core-api//classBio_1_1EnsEMBL_1_1DBSQL_1_1SliceAdaptor.html
Anyone have any ideas of why this is happening? Seems like it's a different way functions are handled with 5.10
Thanks
Hi, did you find the answer to this? Can you please share? Thanks