Question: Why can't I run my Ensembl API scripts in older versions of perl?
0
gravatar for brady.forcier1
3.6 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';
$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

 

ensembl perl • 1.1k views
ADD COMMENTlink modified 3.6 years ago by Ben_Ensembl1.0k • written 3.6 years ago by brady.forcier120

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

ADD REPLYlink written 5 months ago by DanielC90
0
gravatar for Ben_Ensembl
3.6 years ago by
Ben_Ensembl1.0k
EMBL-EBI
Ben_Ensembl1.0k wrote:

Hi,

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/APIVersion.pm). 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 written 3.6 years ago by Ben_Ensembl1.0k
Please log in to add an answer.

Help
Access

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