[Bioperl-l] problems with BLAST

omid gulban gulban at sickkids.ca
Wed May 5 18:52:55 EDT 2004


Hello all,

I have a blast ouput that was generated via Blast2.28 it contained results for two query sequences.
I am having difficulties parsing the output: Here is what I wrote:

the problem is that I get parsed results for the first query sequence and not for the other. I checked the input file and
the results are there. Maybe I an not instructing it to go the next query sequence?????


***********************************************************************************************************************

#!/usr/bin/perl -w

use lib 'E:/.cpan/Bioperl-1.2.3';
use strict;
use Bio::Tools::BPlite;
use Bio::SimpleAlign;
use Bio::AlignIO;
use Bio::SeqIO;
use Bio::Seq;

my $outputfile = '<C:\Documents and Settings\me\Desktop\blastMendel\test_output.txt';
open (BLAST_OUTPUT_FILE, "$outputfile") or die 
  "Can't open $outputfile: [$!]\n";

open (PARSED_OUTPUT_FILE, ">>parsed_output.txt") or die
   "Can't open\/create a file called [parsed_output.txt]\n";

my $blast_ouput_for_parsing = new Bio::Tools::BPlite
         (-fh => \*BLAST_OUTPUT_FILE);


print PARSED_OUTPUT_FILE '*'x60 , "\n";
print PARSED_OUTPUT_FILE "Query Name: " , $blast_ouput_for_parsing -> query , "\n";
print PARSED_OUTPUT_FILE "Database Searched: " , $blast_ouput_for_parsing -> database , "\n\n";
print PARSED_OUTPUT_FILE '*'x60 , "\n";  
#print PARSED_OUTPUT_FILE "The name of the subject is: ", $sbjct->name , "\n";

while(my $sbjct = $blast_ouput_for_parsing -> nextSbjct) {  

    my $hsp = $sbjct -> nextHSP;
    print PARSED_OUTPUT_FILE '-'x60 , "\n\n";
    print PARSED_OUTPUT_FILE "Percentage: " , $hsp->percent  , "\n";
    print PARSED_OUTPUT_FILE "Length: " , $hsp->length , "\n";
    print PARSED_OUTPUT_FILE "Match: " , $hsp->match , "\n";   
    print PARSED_OUTPUT_FILE "Positive: " , $hsp->positive , "\n\n";
    print PARSED_OUTPUT_FILE "QueryStart: " , $hsp->query->start , "\n";
    print PARSED_OUTPUT_FILE "QueryEnd: " , $hsp->query->end , "\n";
    print PARSED_OUTPUT_FILE "HitStart: " , $hsp->hit->start , "\n";    
    print PARSED_OUTPUT_FILE "HitEnd: " , $hsp->hit->end , "\n"; 
    print PARSED_OUTPUT_FILE "QuerySeq:    " , $hsp->querySeq , "\n";
    print PARSED_OUTPUT_FILE "homologySeq: " , $hsp->homologySeq , "\n";
    print PARSED_OUTPUT_FILE "sbjctSeq:    " , $hsp->sbjctSeq , "\n";
   print PARSED_OUTPUT_FILE '-'x60 , "\n";
}


***********************************************************************************************************************


Any help you are able to provide is greatly appreciated.

Many thanks
Omid




More information about the Bioperl-l mailing list