[Bioperl-l] Re: blast.pl parsing

Jason Stajich jason@cgt.mc.duke.edu
Tue, 29 Jan 2002 13:09:24 -0500 (EST)


Don't use Bio::Tools::Blast - I would use BPlite

use Bio::Tools::BPlite;
 my $report = new Bio::Tools::BPlite(-file=>$filename);

  {
    $report->query;
    $report->database;
    SBJCT: while(my $sbjct = $report->nextSbjct) {
        $sbjct->name;
        while (my $hsp = $sbjct->nextHSP) {
	   next SBJCT if ( $hsp->P > $min_evalue);

           $hsp->score;
            $hsp->bits;
            $hsp->percent;
            $hsp->P;
            $hsp->match;
            $hsp->positive;
            $hsp->length;
            $hsp->querySeq;
            $hsp->sbjctSeq;
            $hsp->homologySeq;
	   # you can get query start/end position
            $hsp->query->start;
            $hsp->query->end;
	   # and hit start/end position
            $hsp->hit->start;
            $hsp->hit->end;
            $hsp->hit->seqname;
            $hsp->hit->overlaps($exon);
        }
    }

    # the following line takes you to the next report in the stream/file
    # it will return 0 if that report is empty,
    # but that is valid for an empty blast report.
    # Returns -1 for EOF.

    last if ($report->_parseHeader == -1);
    redo;
  }


On Tue, 29 Jan 2002, Seth Redmond wrote:

> I'm trying to parse from an NCBI blast file such that I can get the
> positions of hsp's on the subject strand.
>
>       $blast = Bio::Tools::Blast->new('-file'   => $infile,
> 	     					'-signif' => 1e-5,
> 	     						'-parse'  => 1,
> 							     '-stats'  => 1,
> 							     '-check_all_hits' => 1, );
>
> 	     $num_hits =  $blast->num_hits;
> 	     for ($j=0; $j<=($num_hits-1); $j++)
> 	     			{
> 				     @matches = $hits[$j]->hsp->seq_inds('sbjct', 'id');
>          ...etc
>
> Although I can get to each hit (that is, each different matching strand in
> my database) I am having problems where there is more than one match on the
> same sequence, in that the script only parses out the first match.
>
> any advice would be much appreciated.
>
> Seth Redmond
>
>
>
> _________________________________________________________________
> Join the world’s largest e-mail service with MSN Hotmail.
> http://www.hotmail.com
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
>

-- 
Jason Stajich
Duke University
jason@cgt.mc.duke.edu