#!/usr/bin/perl open(FILE, "$ARGV[0]")|| die "Csn not open $ARGV[0]!!\n"; open(OUT, ">>$ARGV[1]")|| die "Can not open $ARGV[1]!!\n"; $/= "\n#"; $tmp = $ARGV[0].".tmp"; while(){ chomp($_); my @line = split("\n", $_); open(TMP, ">>$tmp"); for my $i(0..$#line){ # if ($i == 1 || $i ==2 || $i == 4 ||$i ==5 || $i == 10 || $i ==11 || $i == 13 || $i == 14){ if($line[$i] =~ /^>.*\s+(\S+)$/){ print TMP ">$1\n$line[$i+1]\n\n"; } # } } system ("mafft-linsi --thread 3 --clustalout $tmp >$tmp.out"); `rm $tmp`; open(TEMP, "$tmp.out"); $/ = "\ng"; undef($hum); undef($cow); undef($dog); undef($mouse); undef($rat); undef($star); while(my $k=){ chomp($k); my @org = split("\n",$k); for my $i(0..$#org){ if($org[$i] =~ /^rape\s+(\S+)$/){$hum .=$1; print "$1\n";} elsif($org[$i] =~ /^arabidopsis\s+(\S+)$/){$cow .=$1; print "$1\n";} elsif($org[$i] =~ /^moss\s+(\S+)$/){$dog .=$1; print "$1\n";} elsif($org[$i] =~ /^populus\s+(\S+)$/){$mouse .=$1; $str_ln=1; print "$1\n";} elsif($org[$i] =~ /^rice\s+(\S+)$/){$rat .=$1; $str_ln=1; print "$1\n";} elsif($str_ln>0){ #if($org[$i] =~ /\*/){ $str_ln=0; $star .= substr($org[$i], 16, (length($org[$i])-16)); #print "$star\n"; } } } print OUT "> $line[0]\n$hum\n$cow\n$dog\n$mouse\n$rat\n$star\n\n"; $/ = "\n#"; `rm $tmp.out`; }