#!/usr/bin/perl -w my @row=(); my @prerow=(); my $prot = ""; my $id = ""; my $bestscore = 0; my $chr=""; my $ini=0; my $fin=0; while () { chomp ($_); if ( !@prerow ) { @prerow= split(/\t/,$_); } else { @row= split (/\t/,$_); } if ($row[0] eq $prerow[0]) { $c=$c+1; if ($row[7] >= $prerow[7]) { $prot = $row[0]; $id = $row[4]; $chr=$row[1]; $fam = $row[5]; $bestscore = $row[7]; $ini=$row[2]; $fin=$row[3]; $program=$row[8]; @prerow=(); } else { $prot = $prerow[0]; $id = $prerow[4]; $chr=$prerow[1]; $fam=$prerow[5]; $bestscore = $prerow[7]; $ini=$prerow[2]; $fin=$prerow[3]; $program=$prerow[8]; @row=(); } } else { if ($c == 0) { $prot = $prerow[0]; $id = $prerow[4]; $chr=$prerow[1]; $fam=$prerow[5]; $bestscore=$prerow[7]; $ini=$prerow[2]; $fin=$prerow[3]; $program=$prerow[8]; } print "$prot\t$id\t$chr\t$ini\t$fin\t$fam\t$bestscore\t$program\n"; @prerow= split(/\t/,$_); @row=(); $bestscore = 0; $id = ""; $fam = ""; $prot = ""; $ini=0; $chr=""; $fin=0; $c = 0; $program=""; } }