[Bioperl-l] Bio::SearchIO
Jason Stajich
jason at cgt.duhs.duke.edu
Wed Aug 4 12:38:18 EDT 2004
I don't have time to play with your code right now, but the reason for
your error is you are not getting an hsp for a hit - you need to either
protect your hsp calls like this:
if( $hsp = $hit->next_hsp ) {
}
and/or make sure B=V when you run blastall
blastall -b 500 -v 500
-jason
On Wed, 4 Aug 2004, Alberto Davila wrote:
> Hi Jason,
>
> I am listing my code below... I tried it with the blast results (blastx)
> annexed to this msg... the error msg I get is:
>
> Query= 366
> 2
> 0
> 28
> 46
> 201
> 437
> 174
> 247
>
> Query= 366
> Can't call method "query" on an undefined value at parser.pl line 22,
> <GEN1> line 8164.
>
> Curiously the script worked well (without any warning/error) parsing
> another file resulting from a tblastx search.
>
> Thanks in advance, Alberto
>
> *****
>
> CODE:
>
> #!/usr/bin/perl
>
> use lib "/usr/local/bioperl14";
> use Bio::SearchIO;
>
> $searchio = new Bio::SearchIO ('-format' => 'blast',
> '-file' => 'clusters.blast');
>
> while ($result = $searchio->next_result) {
> $query_name = $result->query_name();
> $cluster_id = $query_name;
>
> while ($hit = $result->next_hit) {
> ($gi) = $hit->name =~ /gi\|(\d+)\|/;
> $hsp = $hit->next_hsp;
> $accession = $hit->accession;
> $description = $hit->description();
> $expect = $hit->significance();
> $score = $hit->raw_score();
> $length = $hit->length();
> print "Query= $cluster_id\n";
> $query_frame = $hsp->query->frame;
> print "$query_frame\n";
> $hit_frame = $hsp->hit->frame;
> print "$hit_frame\n";
> $identical=$hsp->num_identical;
> print "$identical\n";
> $conserved=$hsp->num_conserved;
> print "$conserved\n";
> $query_start=$hsp->start('query');
> print "$query_start\n";
> $query_end=$hsp->end('query');
> print "$query_end\n";
> $hit_start=$hsp->start('hit');
> print "$hit_start\n";
> $hit_end=$hsp->end('hit');
> print "$hit_end\n\n";
>
>
>
> }
>
> }
>
>
>
>
> On Wed, 2004-07-28 at 10:10, Jason Stajich wrote:
> > good - so Alberto - we need some way to replicate your problem. What
> > version of bioperl are you using, etc....
> >
> > -jason
> >
> > On Wed, 28 Jul 2004, Brian Osborne wrote:
> >
> > > Jason,
> > >
> > > Yes, $hsp->end('query') works using the latest bioperl-live code.
> > >
> > > Brian O.
> > >
> > > -----Original Message-----
> > > From: bioperl-l-bounces at portal.open-bio.org
> > > [mailto:bioperl-l-bounces at portal.open-bio.org]On Behalf Of Jason Stajich
> > > Sent: Tuesday, July 27, 2004 10:04 AM
> > > To: davila
> > > Cc: bioperl-l at bioperl.org
> > > Subject: Re: [Bioperl-l] Bio::SearchIO
> > >
> > > It should still work.
> > >
> > > You may try:
> > > $hsp->query->start
> > > $hsp->query->end
> > >
> > > $hsp->hit->start
> > > $hsp->hit->end
> > >
> > > This should be equivalent with
> > > $hsp->start('hit'), $hsp->end('hit'), ... etc
> > >
> > > But it is possible that something has been changed in the object layer
> > > that broke this. I'm not really sure since it should be in the tests...
> > >
> > > if you can post code + an example BLAST file as a bug report at
> > > http://bugzilla.bioperl.org which demonstrates the problem we'll have a
> > > look.
> > >
> > > -jason
> > >
> > > On Tue, 27 Jul 2004, davila wrote:
> > >
> > > > I was using the last year a Blast parser with the following lines:
> > > >
> > > > $query_start=$hsp->start('query');
> > > > $query_end=$hsp->end('query');
> > > > $hit_start=$hsp->start('hit');
> > > > $hit_end=$hsp->end('hit');
> > > >
> > > > however it is no longer working and I had to comment them in order to have
> > > the parser working. If there were any changes, how I could now catch the
> > > "query_start", "query_end", "hit_start" and "hit_end" from the Blast results
> > > ?
> > > >
> > > > Thanks in advance, Alberto
> > > >
> > > >
> > > > _______________________________________________
> > > > Bioperl-l mailing list
> > > > Bioperl-l at portal.open-bio.org
> > > > http://portal.open-bio.org/mailman/listinfo/bioperl-l
> > > >
> > >
> > > --
> > > Jason Stajich
> > > Duke University
> > > jason at cgt.mc.duke.edu
> > > _______________________________________________
> > > Bioperl-l mailing list
> > > Bioperl-l at portal.open-bio.org
> > > http://portal.open-bio.org/mailman/listinfo/bioperl-l
> > >
> > >
> >
> > --
> > Jason Stajich
> > Duke University
> > jason at cgt.mc.duke.edu
>
--
Jason Stajich
Duke University
jason at cgt.mc.duke.edu
More information about the Bioperl-l
mailing list