[Bioperl-l] Problem: Can't call method "features" on an undefined value at BIO::DB::GFF.pl

Scott Cain cain.cshl at gmail.com
Sun Jan 20 03:36:44 UTC 2008


Hi Jon,

I think it's funny that you have "or die" on the database opening line,
"or die" on the @features line, but you didn't put one on the $segment
line.  Try adding "or die: $!" to the $segment line to see what it says,
also add a 'print $segment' after you create it and before you try to
get the features from it.  

Clearly, the problem is that $segment is not defined (that is, nothing
is in it, not that the wrong thing is in it).  The next trick is to find
out why.  My first guess, without looking at the data set, is that the
arm is not really named '4'.

Scott

On Sat, 2008-01-19 at 10:25 -0800, Hang wrote:
> Hi, everyone,
> 
> I met this problem when I was running this script to extract features
> overlaps with 4:20,000..25,000. It always responds like "Can't call method
> "features" on an undefined value at BIO::DB::GFF.pl line XX".
> ==============================================================
> use Bio::DB::GFF;
> use Bio::Tools::GFF;
> my $db = Bio::DB::GFF->new(-adaptor => 'dbi::mysql',
>                                         -dsn =>
> 'dbi:mysql:dmel_gff:localhost',
>                                         -user => 'XXXX',
>                                         -pass => 'XXXX') || die "database
> open failed";
> 
> my $segment = $db->segment(-name => '4', -start => 20000, -end => 25000);
> my @features = $segment->features(-types => ['gene', 'exon', 'intron',
> 'five_prime_UTR', 'three_prime_UTR', 'CDS']) or die "no features";
> print(scalar(@features)."\n");
> 
> ================================================================
> I am using activeperl 5.8.8 and bioperl 1.5.2 under Win32. I loaded
> dmel_5.4.gff into mysql database by bulk_load_gff.pl without any error.
> Other methods failed also. 
> 
> Any help will be deeply appreciated!
> 
> Best,
> Jon
> 
-- 
------------------------------------------------------------------------
Scott Cain, Ph. D.                                         cain at cshl.edu
GMOD Coordinator (http://www.gmod.org/)                     216-392-3087
Cold Spring Harbor Laboratory




More information about the Bioperl-l mailing list