[Bioperl-l] can't locate object method "next_result" (probably a simple problem)
Chris Fields
cjfields at uiuc.edu
Fri Mar 17 15:44:09 UTC 2006
> -----Original Message-----
> From: bioperl-l-bounces at lists.open-bio.org [mailto:bioperl-l-
> bounces at lists.open-bio.org] On Behalf Of Brian Osborne
> Sent: Friday, March 17, 2006 7:59 AM
> To: Andrew Norman; bioperl-l
> Subject: Re: [Bioperl-l] can't locate object method "next_result"
> (probably a simple problem)
>
> Andy,
>
> Change "btblastall" to "blastall", let's see what happens.
>
> A question: does your search work from the commandline?
>
> >blastall -p blastx -d Tetraodon_nigroviridis.TETRAODON7.mar.pep.fa -i
> blast_input.fasta
>
> Something like that...
>
> Brian O.
You also might want to try passing any text output from that run through
SearchIO to see if it parses w/o breaking or freezing. You're using an old
version of bioperl, so it may not parse.
-------------------------------
use Bio::SearchIO;
my $file = shift @ARGV;
my $v = 0 ;
my $searchin = new Bio::SearchIO(-verbose => $v,
-format => 'blast',
-file => $file);
while( my $result = $searchin->next_result ) {
print $result->query_description,"\n";
while( my $hit = $result->next_hit ) {
print " ", $hit->expect,"\n";
}
}
-------------------------------
> On 3/16/06 6:53 PM, "Andrew Norman" <anorman at stanford.edu> wrote:
>
> > Hi Everyone
> >
> > I'm brand new to bioperl and object oriented programming in general.
> I've
> > been trying some of the example scripts in the HOWTO and I ran into the
> > following error (I'm using bioperl v. 1.2.3, windows XP) while trying to
> get
> > some blast results to print:
> >
> > "can't locate object method "next_result" via package "Bio::Seq" at
> > blast_tetra.pl"
> >
> > Here's the script:
> >
> > use Bio::Seq;
> > use Bio::SeqIO;
> > use Bio::Tools::Run::StandAloneBlast;
> >
> >
> >
> > open OUTPUT, ">>blast_output.txt";
> >
> > my $file_obj = Bio::SeqIO->new(-file => "blast_input.fasta", -format =>
> > "fasta" );
> > my @params = (program => 'blastx', database =>
> > 'Tetraodon_nigroviridis.TETRAODON7.mar.pep.fa', _READMETHOD =>
> 'SearchIO' );
> > my $blast_obj = Bio::Tools::Run::StandAloneBlast->new(@params);
> >
> >
> > while (my $seq_obj = $file_obj->next_seq){
> >
> > my $report_obj = $blast_obj->btblastall($seq_obj);
I agree with Torsten here. This shouldn't work but does in a weird way.
The error indicates that, instead of getting a result you're getting a
Bio::Seq object. That makes sense if you consider that StandAloneBlast uses
AUTOLOAD. The name of the function is stored in $AUTOLOAD and sort of
illustrates the problems with using AUTOLOADed subs. Here's the AUTOLOAD
sub in StandAloneBlast with my comments:
-------------------------------
sub AUTOLOAD {
my $self = shift;
# $AUTOLOAD should be Bio::Tools::Run::StandAloneBlast::btblastall
my $attr = $AUTOLOAD;
$attr =~ s/.*:://;
# $attr is now 'btblastall'
my $attr_letter = $BLASTTYPE eq 'ncbi' ? substr($attr, 0, 1) : $attr;
# $attr_letter is now 'b'
# actual key is first letter of $attr unless first attribute
# letter is underscore (as in _READMETHOD), the $attr is a BLAST
# parameter and should be truncated to its first letter only
$attr = ($attr_letter eq '_') ? $attr : $attr_letter;
# $attr now is 'b'
$self->throw("Unallowed parameter: $attr !") unless $OK_FIELD{$attr};
# passes this try at catching weird sub names (@BLASTALL_PARAMS has 'b')
# $self->throw("Unallowed parameter: $attr !") unless
$ok_field{$attr_letter};
$self->{$attr_letter} = shift if @_;
# places seq object in $self->{$attr_letter}
return $self->{$attr_letter};
# oops, returns seq object
}
-------------------------------
So, don't use 'btblastall'. Not sure about using AUTOLOAD here but it seems
to be used in Bioperl-run tools (which StandAloneBlast is really)
> > my $result_obj = $report_obj->next_result;
> > print OUTPUT $result_obj->num_hits,"\t",$result_obj->hits, "\n";
> >
> >
> >
> > }
> >
> > close OUTPUT;
> >
> >
> > I'd appreciate any help anyone has to offer. Thanks!
> >
> > andy
> > _______________________________________________
> > 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 - Switzer Lab
Dept. of Biochemistry
University of Illinois Urbana-Champaign
More information about the Bioperl-l
mailing list