- 论坛徽章:
- 0
|
本帖最后由 iamxesam 于 2010-08-28 20:17 编辑
- #!/usr/bin/perl
- if (@ARGV < 2){
- die "usage: outputseq See script for details.\n";
- }
- open(LOCI, "$ARGV[0]") || die ;
- open(DNASEQ, "$ARGV[1]") || die ;
- my %hash_name;
- $/=">";
- <LOCI>;
- while(<LOCI>){
- my ($head,$seq)=split(/\n/,$_);
- $hash_name{$head}=$seq;
- }
- $/="\n";
- while(<DNASEQ>){
- my $head=(split(/\s+/,$_))[1];
- print “$hash_name{$head}\n" if defined $hash_name{$head};
- }
- close LOCI;
- close DNASEQ;
复制代码 错误时因为<LOCI>后面掉了一个分号;
第一个文件:
>chromosome01
atcgatcgatcgatcgatcgatcgatcgatcgatcgatcgatcgatcg
第二个文件:
001 chromosome01
002 chromosome02
003 chromosome03 |
|