[Bioperl-l] While loop - SearchIO for BioPerl

Rytsareva, Inna (I) IRytsareva at dow.com
Wed Jul 8 19:42:54 UTC 2009


Hello,

I have a follow script to parse the BLAST  report:

my $in = Bio::SearchIO->new (  	-file 	=>$out_file,
				-format =>'blast') or die $!;

while (my $result = $in->next_result) {
	while (my $hit = $result->next_hit)
	{
		while (my $hsp = $hit->next_hsp) 	{
			$qhit = $hit->name;
			$start = $hsp->hit->start;
			$end = $hsp->hit->end;
							}
				
			
	}		print "Hit= ", $qhit,
			",Start = ", $start,
			",End = ", $end,"\n";				
					}

Usually, the report has a number of the same hsp for each hit.
Using "print" command it gives me a hit name, start and end positions
for each hit, except last on. For last one it prints all the hsps.
Something like this:

Hit= gnl|DAS|22386,Start = 7578,End = 7601
Hit= gnl|DAS|25627,Start = 2824,End = 2863
Hit= gnl|DAS|25328,Start = 8864,End = 8887
Hit= gnl|DAS|4890,Start = 1896,End = 1919
Hit= gnl|DAS|12191,Start = 1898,End = 1921
Hit= gnl|DAS|4276,Start = 557,End = 580
Hit= gnl|DAS|12959,Start = 801,End = 824
Hit= gnl|DAS|4092,Start = 2266,End = 2304
Hit= gnl|DAS|19740,Start = 13572,End = 13610
Hit= gnl|DAS|12393,Start = 3901,End = 3924
Hit= gnl|DAS|25687,Start = 10415,End = 10438
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
Hit= gnl|DAS|12277,Start = 7410,End = 7433
 
Where Hit= gnl|DAS|12277,Start = 7410,End = 7433 is the last one.
I don't need these duplicates.
How can I fix that?

Thanks,
Inna Rytsareva
Discovery Information Management
Dow AgroSciences
Indianapolis, IN 
317-337-4716





More information about the Bioperl-l mailing list