|
#!/usr/bin/env perl
use strict;
use warnings;
local $/ =">";
while(<>){
chomp;
my $lineSepPos = index($_,"
");
my $header = substr($_,0,$lineSepPos);
if($header){
print(">", $header,"(reverse-complemented)
");
my $sequence = reverse(substr($_,$lineSepPos));
# see http://shootout.alioth.debian.org/u32/performance.php?test=revcomp#about
# for ambiguity codes and translation
$sequence =~ tr/ACGTUMRWSYKVHDBNacgtumrwsykvhdbn
/TGCAAKYWSRMBDHVNtgcaakywsrmbdhvn/d;
for(my $pos = 0; $pos < length($sequence);$pos += 60){
print(substr($sequence, $pos, 60),"
");
}
}
}
数值60代表每行输出60个碱基。(感谢原作者)
执行命令:perl fasta_re.perl srr.fasta > srr_re.fasta
如若执行不了,记得查看pl文件是否有可执行权限。 |
|
|