linux&Perl&R  

问了高人,找到答案了!在Bio::SeqIO可以直接进行translate操作,有兴趣可以看看。

 

my $in = Bio::SeqIO->new(-file =>"$infile", -format => 'fasta',-alphabet => 'DNA' );
my $out = Bio::SeqIO->new( -file => ">$prefix-nm.fasta", -format => 'fasta',-alphabet=>'protein' );

while(my $seq =$in->next_seq()){
        $seq = $seq->translate();

        $out->write_seq($seq);
}

输出如下:

>AADACL3|CCDS41252.1|+chr=chr1;
HGNPPWHMLSFVQGE*LRGSGSWLPQVT*A*VSSASKRLLGGHHPLPEVPGCIWSGSSPG
CGLR*QFRRGNSRSGLSTTCGQARSAPDPGSDPDLCHSPSPGFTNPFVSTEEKHPTAHLE
FHLLLFFSKPGFQLLLARGHHERCPFAC*SLGKVQKVVGPRKHP*EV*GEGLPTEAP*AH

via http://yunbio.com/2137

2012-08-29 perlBio::SeqIO

评论

©linux&Perl&R Powered by LOFTER