Question: Why can't I run my Ensembl API scripts in older versions of perl?
gravatar for brady.forcier1
4.4 years ago by
brady.forcier120 wrote:

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';
  -host => '',
  -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 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.

Anyone have any ideas of why this is happening? Seems like it's a different way functions are handled with 5.10



ensembl perl • 1.3k views
ADD COMMENTlink modified 4.4 years ago by Ben_Ensembl1.5k • written 4.4 years ago by brady.forcier120

Hi, did you find the answer to this? Can you please share? Thanks

ADD REPLYlink written 15 months ago by DanielC120
gravatar for Ben_Ensembl
4.4 years ago by
Ben_Ensembl1.5k wrote:


This means the slice_adaptor is undefined, which is most likely due to the registry not finding a human database, which could be a version incompatibility issue.

I would recommend checking what the version is in the APIVersion module (ensembl/modules/Bio/EnsEMBL/ You can also add a -verbose => 1 flag in the load_registry_from_db call, which should list all the databases found by the registry.

ADD COMMENTlink modified 6 months ago by RamRS27k • written 4.4 years ago by Ben_Ensembl1.5k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1474 users visited in the last hour