use warnings;use strict;my $dna='cgacgtcttcgtacgggactagctcgtgtcggtcgc';my $protein=' ';my $codon;for(my $i=0; $i<(length($dna)-2);$i+=3){ $codon=substr($dna,$i,3); $protein.=codon2aa($codon);}print "I translated the DNA\n\n$dna\n\n into the protein\n\n$protein\n\n";exit;#*****************************************************************************************8# codon2aa # # A subroutine to translate a DNA 3-character codon to an amino acID # Version 3,using hash lookup sub codon2aa { my($codon) = @_; $codon = uc $codon;#uc=uppercase;lc=lowercase #也就是大小写转换,uc表示将所有的小写 转换为大写 #lc将所有的大写转换为小写 my(%genetic_code) = ( 'TCA' => 'S',# Serine 'TCC' => 'S',# Serine 'TCG' => 'S',# Serine 'TCT' => 'S',# Serine 'TTC' => 'F',# Phenylalanine 'TTT' => 'F',# Phenylalanine 'TTA' => 'L',# Leucine 'TTG' => 'L',# Leucine 'TAC' => 'Y',# Tyrosine 'TAT' => 'Y',# Tyrosine 'TAA' => '_',# Stop 'TAG' => '_',# Stop 'TGC' => 'C',# Cysteine 'TGT' => 'C',# Cysteine 'TGA' => '_',# Stop 'TGG' => 'W',# Tryptophan 'CTA' => 'L',# Leucine 'CTC' => 'L',# Leucine 'CTG' => 'L',# Leucine 'CTT' => 'L',# Leucine 'CCA' => 'P',# Proline 'CCC' => 'P',# Proline 'CCG' => 'P',# Proline 'CCT' => 'P',# Proline 'CAC' => 'H',# HistIDine 'CAT' => 'H',# HistIDine 'CAA' => 'Q',# glutamine 'CAG' => 'Q',# glutamine 'CGA' => 'R',# Arginine 'CGC' => 'R',# Arginine 'CGG' => 'R',# Arginine 'CGT' => 'R',# Arginine 'ATA' => 'I',# Isoleucine 'ATC' => 'I',# Isoleucine 'ATT' => 'I',# Isoleucine 'ATG' => 'M',# Methionine 'ACA' => 'T',# Threonine 'ACC' => 'T',# Threonine 'ACG' => 'T',# Threonine 'ACT' => 'T',# Threonine 'AAC' => 'N',# Asparagine 'AAT' => 'N',# Asparagine 'AAA' => 'K',# Lysine 'AAG' => 'K',# Lysine 'AGC' => 'S',# Serine 'AGT' => 'S',# Serine 'AGA' => 'R',# Arginine 'AGG' => 'R',# Arginine 'GTA' => 'V',# Valine 'GTC' => 'V',# Valine 'GTG' => 'V',# Valine 'GTT' => 'V',# Valine 'GCA' => 'A',# Alanine 'GCC' => 'A',# Alanine 'GCG' => 'A',# Alanine 'GCT' => 'A',# Alanine 'GAC' => 'D',# Aspartic AcID 'GAT' => 'D',# Aspartic AcID 'GAA' => 'E',# glutamic AcID 'GAG' => 'E',# glutamic AcID 'GGA' => 'G',# Glycine 'GGC' => 'G',# Glycine 'GGG' => 'G',# Glycine 'GGT' => 'G',# Glycine ); if(exists $genetic_code{$codon}) { return $genetic_code{$codon}; } else { print STDERR "Bad codon \"$codon\"!!\n"; exit; } } #*****************************************************************************************
结果如下:
F:\>perl\a.plI translated teh DNAcgacgtcttcgtacgggactagctcgtgtcggtcgc into the protein RRLRTGLARVGR总结
以上是内存溢出为你收集整理的perl应用:DNA序列翻译为蛋白质的完整程序(中)全部内容,希望文章能够帮你解决perl应用:DNA序列翻译为蛋白质的完整程序(中)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)