iTOL与netsurfp前期处理程序

来源:互联网 发布:鸡胸肉 知乎 编辑:程序博客网 时间:2024/06/13 22:39
#!perluse warnings;use strict;use List::Util qw(max);my (%hash);open RSA, $ARGV[0] or die $!;open SS, "> $ARGV[1].ss" or die $!;while(<RSA>){chomp;next if(/^#/);my @tmp = split;my $maxv = max @tmp[7..9];my $type;for(my $i = 7; $i < 10; $i ++){if($maxv == $tmp[$i]){if($i == 7){$type = "H";}elsif($i == 8){$type = "E";}elsif($i == 9){$type = "C";}}}push @{$hash{$tmp[2]}}, $type;print SS "$tmp[2]\t$tmp[1]\t$type\t$tmp[0]\n";}open DM, "> $ARGV[1].domains" or die $!;foreach(keys %hash){my $len = @{$hash{$_}};print DM "$_\t$len";my (@h, @e);for(my $i = 0; $i < @{$hash{$_}}; $i ++){if($hash{$_}[$i] eq "H"){push @h, $i + 1;}elsif($hash{$_}[$i] eq "E"){push @e, $i + 1;}}my ($hs, $he, $es, $ee);$hs = $h[0];$he = $h[0] + 1;for(my $i = 0; $i < @h - 1; $i ++){if($h[$i + 1] - $h[$i] == 1){$he = $h[$i + 1] + 1;}else{print DM "\tRE|$hs|$he|#ff0000|$_.$hs.$he";$hs = $h[$i + 1];$he = $h[$i + 1] + 1;}}print DM "\tRE|$hs|$he|#ff0000|$_.$hs.$he";if(@e > 0){$es = $e[0];$ee = $e[0] + 1;for(my $i = 0; $i < @e - 1; $i ++){if($e[$i + 1] - $e[$i] == 1){$ee = $e[$i + 1] + 1;}else{print DM "\tTR|$es|$ee|#0000ff|$_.$es.$ee";$es = $e[$i + 1];$ee = $e[$i + 1] + 1;}}print DM "\tTR|$es|$ee|#0000ff|$_.$es.$ee\n";}else{print DM "\n";}}

0 0
原创粉丝点击