[Bioperl-l] Bio::SEarchIO::blastxml

Nathan Haigh n.haigh at sheffield.ac.uk
Mon Sep 25 09:47:53 EDT 2006


I'm trying to parse a blastxml file i've generated locally. I used a
FASTA file containing multiple sequences as input to blastall 2.2.14 out
output the results to an xml file.

When using SearchIO to parse the results, I can't seem to get just hit
data pertaining to a single query seq, I just seem to get all the hits
from all the queries without knowing which hit is for which query seq.
Any ideas what might be going on? My code is below.

Thanks
Nathan

      1#!/usr/bin/perl -w
      2
      3 use strict;
      4
      5 use Bio::SearchIO;
      6 use Data::Dumper;
      7
      8 my $in = new Bio::SearchIO(
      9         -format => 'blastxml',
     10         -file   => $ARGV[0],
     11 );
     12
     13 while( my $result = $in->next_result ) {
     14         #
     15         while( my $hit = $result->next_hit ) {
     16                 while( my $hsp = $hit->next_hsp ) {
     17                         print   "Hit= ",       $hit->name,
     18                                 ",E-Value=",    $hsp->evalue,
     19                                 ",Length=",    
$hsp->length('total'),
     20                                 ",Percent_id=",
$hsp->percent_identity, "\n";
     21                 }
     22                 #last;   # only look at first hit for each query
     23         }
     24 }



More information about the Bioperl-l mailing list