Difference between revisions of "Perl change DNA to AA"

From Biolecture.org
imported>Park SeongWan
(Created page with "<p>#!/usr/bin/perl<br /> use strict;<br /> use warnings;</p> <p><br /> my @bases=("a","t","g","c");<br /> my @AA=("K","N&q...")
 
imported>Park SeongWan
 
Line 1: Line 1:
 +
<p><strong>CODE</strong></p>
 +
 +
<hr />
 
<p>#!/usr/bin/perl<br />
 
<p>#!/usr/bin/perl<br />
 
use strict;<br />
 
use strict;<br />
Line 21: Line 24:
 
<p>&nbsp;</p>
 
<p>&nbsp;</p>
  
<p>&nbsp;</p>
+
<p><strong>&nbsp;Result</strong></p>
  
 +
<hr />
 
<p>aaa K&nbsp; aat N&nbsp; aag K&nbsp; aac N&nbsp; ata I&nbsp; att I&nbsp; atg M&nbsp; atc I&nbsp; aga R&nbsp; agt S&nbsp; agg R&nbsp; agc S&nbsp; aca T&nbsp; act T&nbsp; acg T&nbsp; acc T<br />
 
<p>aaa K&nbsp; aat N&nbsp; aag K&nbsp; aac N&nbsp; ata I&nbsp; att I&nbsp; atg M&nbsp; atc I&nbsp; aga R&nbsp; agt S&nbsp; agg R&nbsp; agc S&nbsp; aca T&nbsp; act T&nbsp; acg T&nbsp; acc T<br />
 
taa .&nbsp; tat Y&nbsp; tag .&nbsp; tac Y&nbsp; tta L&nbsp; ttt F&nbsp; ttg L&nbsp; ttc F&nbsp; tga .&nbsp; tgt C&nbsp; tgg W&nbsp; tgc C&nbsp; tca S&nbsp; tct S&nbsp; tcg S&nbsp; tcc S<br />
 
taa .&nbsp; tat Y&nbsp; tag .&nbsp; tac Y&nbsp; tta L&nbsp; ttt F&nbsp; ttg L&nbsp; ttc F&nbsp; tga .&nbsp; tgt C&nbsp; tgg W&nbsp; tgc C&nbsp; tca S&nbsp; tct S&nbsp; tcg S&nbsp; tcc S<br />
 
gaa E&nbsp; gat D&nbsp; gag E&nbsp; gac D&nbsp; gta V&nbsp; gtt V&nbsp; gtg V&nbsp; gtc V&nbsp; gga G&nbsp; ggt G&nbsp; ggg G&nbsp; ggc G&nbsp; gca A&nbsp; gct A&nbsp; gcg A&nbsp; gcc A<br />
 
gaa E&nbsp; gat D&nbsp; gag E&nbsp; gac D&nbsp; gta V&nbsp; gtt V&nbsp; gtg V&nbsp; gtc V&nbsp; gga G&nbsp; ggt G&nbsp; ggg G&nbsp; ggc G&nbsp; gca A&nbsp; gct A&nbsp; gcg A&nbsp; gcc A<br />
 
caa Q&nbsp; cat H&nbsp; cag Q&nbsp; cac H&nbsp; cta L&nbsp; ctt L&nbsp; ctg L&nbsp; ctc L&nbsp; cga R&nbsp; cgt R&nbsp; cgg R&nbsp; cgc R&nbsp; cca P&nbsp; cct P&nbsp; ccg P&nbsp; ccc P</p>
 
caa Q&nbsp; cat H&nbsp; cag Q&nbsp; cac H&nbsp; cta L&nbsp; ctt L&nbsp; ctg L&nbsp; ctc L&nbsp; cga R&nbsp; cgt R&nbsp; cgg R&nbsp; cgc R&nbsp; cca P&nbsp; cct P&nbsp; ccg P&nbsp; ccc P</p>

Latest revision as of 16:55, 23 May 2016

CODE


#!/usr/bin/perl
use strict;
use warnings;


my @bases=("a","t","g","c");
my @AA=("K","N","K","N","I","I","M","I","R","S","R","S","T","T","T","T",".","Y",".","Y","L","F","L","F",
  ".","C","W","C","S","S","S","S","E","D","E","D","V","V","V","V","G","G","G","G","A","A","A","A",
  "Q","H","Q","H","L","L","L","L","R","R","R","R","P","P","P","P");


for (my $i=0;$i<4;$i++) {
for (my $j=0;$j<4;$j++) {
for (my $k=0;$k<4;$k++) {


 print $bases[$i], $bases[$j], $bases[$k], " ",  $AA[16*($i)+4*($j)+($k)], "  ";
}}
print "\n";}

 

 Result


aaa K  aat N  aag K  aac N  ata I  att I  atg M  atc I  aga R  agt S  agg R  agc S  aca T  act T  acg T  acc T
taa .  tat Y  tag .  tac Y  tta L  ttt F  ttg L  ttc F  tga .  tgt C  tgg W  tgc C  tca S  tct S  tcg S  tcc S
gaa E  gat D  gag E  gac D  gta V  gtt V  gtg V  gtc V  gga G  ggt G  ggg G  ggc G  gca A  gct A  gcg A  gcc A
caa Q  cat H  cag Q  cac H  cta L  ctt L  ctg L  ctc L  cga R  cgt R  cgg R  cgc R  cca P  cct P  ccg P  ccc P