[Bioperl-l] Problem: Can't call method "features" on an undefined value at BIO::DB::GFF.pl
Chris Fields
cjfields at uiuc.edu
Sun Jan 20 17:10:27 UTC 2008
It's bp_seqfeature_load.pl (if you have the full bioperl core
distribution, it's in script/Bio-SeqFeature/Store). I had some
problems with the fast-loading option but it was likely just my gff
formatting; example data loaded just fine.
As for the error, you need to use the '-create' flag when initializing
a database (or wiping data from a current one):
=============================================================
use Bio::DB::SeqFeature::Store;
use Bio::DB::SeqFeature::Store::GFF3Loader;
my $db = Bio::DB::SeqFeature::Store->new(-adaptor => 'DBI::mysql',
-dsn => 'dbi:mysql:test',
-user => 'root',
-pass => 'XXXXX',
-write => 1
-create => 1);
my $loader = Bio::DB::SeqFeature::Store::GFF3Loader->new(-store =>
$db,
-verbose =>
1);
$loader->load(./'dmel-all-r5.4.gff');
=============================================================
chris
On Jan 20, 2008, at 9:25 AM, Scott Cain wrote:
> Jon,
>
> There is a script for loading a SeqFeature database just like the GFF
> database, though I don't know what it's called off hand (I'm not at my
> normal computer right now). Be sure to read the documentation and you
> will probably want to use the 'fast' option (I don't remember what
> it is
> called either).
>
> Scott
>
>
> ----------------------------------------------------------------------
> Scott Cain, Ph. D. cain at cshl.edu
> GMOD Coordinator, http://www.gmod.org/ (216)392-3087
> ----------------------------------------------------------------------
>
>
> On Sun, 20 Jan 2008, Hang wrote:
>
>>
>> Hi, Scott,
>> I tried to change sequence-region line to "4 FlyBase
>> chromosome_arm 1
>> 1351857 . . . ID=4;Name=4", it doesn't work. "$!" didn't say
>> anything but
>> "died at line 12".
>>
>> So, I went ahead with the Bio::DB::SeqFeature::Store. Here is my
>> code to
>> load the dmel-all-r5.4.gff(from Flybase) to a test database:
>> =============================================================
>> use Bio::DB::SeqFeature::Store;
>> use Bio::DB::SeqFeature::Store::GFF3Loader;
>> my $db = Bio::DB::SeqFeature::Store->new(-adaptor => 'DBI::mysql',
>> -dsn => 'dbi:mysql:test',
>> -user => 'root',
>> -pass => 'XXXXX',
>> -write => 1 );
>> my $loader = Bio::DB::SeqFeature::Store::GFF3Loader->new(-store
>> => $db,
>> -verbose
>> => 1);
>> $loader->load(./'dmel-all-r5.4.gff');
>> =============================================================
>> I got bunch of errors like this:
>> "DBD::mysql::execute failed: Table 'test.locationlist' doesn't
>> exist at
>> C:\Biology\perl\site\lib\Bio\DB\SeqFeature\Store\DBI\mysql.pm line
>> 1316".
>> The line 1316 in mysql.pm looks like this: $sth->execute($name) or
>> die
>> $sth->errstr;
>> I checked the database test after failed loading. There is only one
>> table
>> created, which call 'meta'. I also tried 'grant all on test to
>> XXX at localhost' and used that -user and -pass to load gff, it didn't
>> work
>> either.
>>
>> Jon
>>
>>
>> Scott Cain-3 wrote:
>>>
>>> Hi Jon,
>>>
>>> Well, seeing the error message would be helpful, but my first guess
>>> without is that there are a few things you can try:
>>>
>>> * removing the "sequence-region" line from the GFF file, adding a
>>> line
>>> like this:
>>>
>>> 4 FlyBase chromosome_arm 1 1351857 . . . ID=4;Name=4
>>>
>>> and then reloading the database.
>>>
>>> * Or, you may want to consider using Bio::DB::SeqFeature::Store,
>>> since
>>> Bio::DB::GFF3 doesn't always behave correctly with complex GFF3
>>> (that
>>> is, with three levels of features (like gene, mRNA and CDS)).
>>>
>>> Scott
>>>
>>> On Sat, 2008-01-19 at 19:49 -0800, Hang wrote:
>>>> Hi, Scott,
>>>>
>>>> After adding die $!, I know something is wrong at line:
>>>> "my $segment = $db->segment(-name => '4', -start => 20000, -end =>
>>>> 25000);"
>>>>
>>>> my gff file is like this:
>>>> ##gff-version 3
>>>> ##sequence-region 4 1 1351857
>>>> 4 FlyBase transposable_element 2 611 . + .
>>>> ID=FBti0062890;Name=ninja-Dsim-
>>>> like
>>>> {}4829
>>>> ;Dbxref=FlyBase_Annotation_IDs:TE62890;derived_cyto_location=-;
>>>> 4 repeatmasker_dummy match 2 347 . + .
>>>> ID=:1395923_repeatmasker_dummy;Name=1%2C347-AE003845.4-dummy-
>>>> RepeatMasker;
>>>> 4 repeatmasker_dummy match_part 2 347 2367 + .
>>>> ID=:5142029_dummy;Name=:5142029;Parent=:
>>>> 1395923_repeatmasker_dummy;target_type=so;Target=D83207
>>>> 5860 6210 +;
>>>> ...
>>>> ...
>>>> I really got confused. Any further suggestion? Thank you!
>>>>
>>>> Jon
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Scott Cain-3 wrote:
>>>>>
>>>>> 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
>>>>>
>>>>> _______________________________________________
>>>>> Bioperl-l mailing list
>>>>> Bioperl-l at lists.open-bio.org
>>>>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>>>>>
>>>>>
>>>>
>>> --
>>> ------------------------------------------------------------------------
>>> Scott Cain, Ph. D. cain at cshl.edu
>>> GMOD Coordinator (http://www.gmod.org/)
>>> 216-392-3087
>>> Cold Spring Harbor Laboratory
>>>
>>> _______________________________________________
>>> Bioperl-l mailing list
>>> Bioperl-l at lists.open-bio.org
>>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>>>
>>>
>>
>> --
>> View this message in context: http://www.nabble.com/Problem%3A-Can%27t-call-method-%22features%22-on-an-undefined-value-at-BIO%3A%3ADB%3A%3AGFF.pl-tp14971922p14982665.html
>> Sent from the Perl - Bioperl-L mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
Christopher Fields
Postdoctoral Researcher
Lab of Dr. Robert Switzer
Dept of Biochemistry
University of Illinois Urbana-Champaign
More information about the Bioperl-l
mailing list