1234567891011121314151617181920212223242526272829 |
- #!/usr/bin/perl -w
- die "USage\n\tperl $0 gene_protein pep.fa > pep_geneid.fa\n" unless(@ARGV==2);
- open IN1, $ARGV[0]||die $!;
- open IN2,$ARGV[1]||die $!;
- my %hash;
- while(<IN1>){
- chomp;
- next if(/^\s*$/);
- my @a=split/\t/,$_;
- $hash{$a[1]}=$a[0];
- }
- while(<IN2>){
- chomp;
- next if(/^\s*$/);
- #next unless(/^>/);
-
- if(/^>/){
- $_=~s/^>//;
- print ">$hash{$_}\n";
- }else{
- print "$_\n";
- }
- }
- close IN1;
- close IN2;
|