3 Author: Hu Xuesong @ BIOPIC <galaxy001@gmail.com>
4 Version: 1.0.0 @ 20120330
8 #use Data::Dump qw(ddx);
10 die "Usage: $0 <nt header> <blast file>\n" if @ARGV<2;
15 open H
,'<',$header or die "Error opening $header : $!\n";
18 s/^>// or warn "[x][$_]\n";
21 /^gi(\S*) (.*)/ or die;
23 #print "[@dat] ----- $1,$2\n";
27 warn "[!]Load Hearers done.\n";
30 open O
,'>',$blastf.'.anot' or die "Error opening $blastf.anot : $!\n";
31 print O
"# Count qseqid sacc length evalue mismatch annot bitscore qstart qend sstart send btop sseqid\n";
37 push @
{$Dat{$_->[2]}},$_;
39 for my $k (keys %Dat) {
40 my $Emin=(sort {$b->[10] <=> $a->[10] || $a->[7] <=> $b->[7]} @
{$Dat{$k}})[0]; # len Desc, E Asc
41 push @Arr,[$Emin,scalar @
{$Dat{$k}}];
45 my ($qseqid,$sseqid,$sacc,$qstart,$qend,$sstart,$send,$evalue,$bitscore,$score,$length,$pident,$nident,$mismatch,$positive,$gapopen,$gaps,$btop)=@
$Emin;
48 if (exists $Anno{$annot}) {
49 $annot = '['.$Anno{$annot}.']';
50 print O
join("\t",$_->[1],$qseqid,$sacc,$length,$evalue,$mismatch,$annot,$bitscore,$qstart,$qend,$sstart,$send,$btop,$sseqid),"\n";
61 open B
,'<',$blastf or die "Error opening $blastf : $!\n";
65 if ($t[0] eq $lastID) {
68 &deal
(\
@lastDat) if @lastDat>0;