Difference between revisions of "2.Install perl and run the program"

From Biolecture.org
imported>Jiyoung Oh
(Created page with "<p> </p> <p><기본 format></p> <p>#!/usr/bin/perl<br /> # Translate DNA into protein</p> <p>use strict;<br /> use warnings;<br /> use BeginPerlBioinfo;  &nbsp...")
 
imported>Jiyoung Oh
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
<p>1. strawberry perl을 깐다</p>
 +
 +
<p>2. editplus를 깔아서 perl과 연동시킨다</p>
 +
 +
<p>3. editplus내에서 코드 입력한 뒤 ctrl + 1 눌러서 실행시킨후 결과 도출하기</p>
 +
 
<p>&nbsp;</p>
 
<p>&nbsp;</p>
  
Line 24: Line 30:
  
 
<p>exit;</p>
 
<p>exit;</p>
 +
 +
<p><span style="color:#FF0000"><strong>&lt;실전적용해보기&gt;</strong></span></p>
 +
 +
<p>I use the DNA sequence of homo sapiens p53.</p>
 +
 +
<p>#!/usr/bin/perl<br />
 +
#Translate DNA into protein<br />
 +
my $dna = &#39;ATGGAGGAGCCGCAGTCAGATCCTAGCGTCGAGCCCCCTCTGAGTCAGGAAACATTTTCAGACCTATGGAAACTACTTCCTGAAAACAACGTTCTGTCCCCCTTGCCGTCCCAAGCAATGGATGATTTGATGCTGTCCCCGGACGATATTGAACAATGGTTCACTGAAGACCCAGGTCCAGATGAAGCTCCCAGAATGCCAGAGGCTGCTCCCCGCGTGGCCCCTGCACCAGCAGCTCCTACACCGGCGGCCCCTGCACCAGCCCCCTCCTGGCCCCTGTCATCTTCTGTCCCTTCCCAGAAAACCTACCAGGGCAGCTACGGTTTCCGTCTGGGCTTCTTGCATTCTGGGACAGCCAAGTCTGTGACTTGCACGTACTCCCCTGCCCTCAACAAGATGTTTTGCCAACTGGCCAAGACCTGCCCTGTGCAGCTGTGGGTTGATTCCACACCCCCGCCCGGCACCCGCGTCCGCGCCATGGCCATCTACAAGCAGTCACAGCACATGACGGAGGTTGTGAGGCGCTGCCCCCACCATGAGCGCTGCTCAGATAGCGATGGTCTGGCCCCTCCTCAGCATCTTATCCGAGTGGAAGGAAATTTGCGTGTGGAGTATTTGGATGACAGAAACACTTTTCGACATAGTGTGGTGGTGCCCTATGAGCCGCCTGAGGTTGGCTCTGACTGTACCACCATCCACTACAACTACATGTGTAACAGTTCCTGCATGGGCGGCATGAACCGGAGGCCCATCCTCACCATCATCACACTGGAAGACTCCAGTGGTAATCTACTGGGACGGAACAGCTTTGAGGTGCATGTTTGTGCCTGTCCTGGGAGAGACCGGCGCACAGAGGAAGAGAATCTCCGCAAGAAAGGGGAGCCTCACCACGAGCTGCCCCCAGGGAGCACTAAGCGAGCACTGTCCAACAACACCAGCTCCTCTCCCCAGCCAAAGAAGAAACCACTGGATGGAGAATATTTCACCCTTCAGATCCGTGGGCGTGAGCGCTTCGAGATGTTCCGAGAGCTGAATGAGGCCTTGGAACTCAAGGATGCCCAGGCTGGGAAGGAGCCAGGGGGGAGCAGGGCTCACTCCAGCCACCTGAAGTCCAAAAAGGGTCAGTCTACCTCCCGCCATAAAAAACTCATGTTCAAGACAGAAGGGCCTGACTCAGACTGA&#39;;<br />
 +
my $protein = &#39;&#39;;<br />
 +
my $codon;<br />
 +
&nbsp;sub Codon_table {<br />
 +
&nbsp; &nbsp; &nbsp;my($codon) = @_;<br />
 +
&nbsp; &nbsp; &nbsp; &nbsp; if( $codon =~ /TCA/i ){ return &#39;S&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /TCC/i ){ return &#39;S&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /TCG/i ){ return &#39;S&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /TCT/i ){ return &#39;S&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /TTC/i ){ return &#39;F&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /TTT/i ){ return &#39;F&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /TTA/i ){ return &#39;L&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /TTG/i ){ return &#39;L&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /TAC/i ){ return &#39;Y&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /TAT/i ){ return &#39;Y&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /TAA/i ){ return &#39;*&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /TAG/i ){ return &#39;*&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /TGC/i ){ return &#39;C&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /TGT/i ){ return &#39;C&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /TGA/i ){ return &#39;*&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /TGG/i ){ return &#39;W&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /CTA/i ){ return &#39;L&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /CTC/i ){ return &#39;L&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /CTG/i ){ return &#39;L&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /CTT/i ){ return &#39;L&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /CCA/i ){ return &#39;P&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /CCC/i ){ return &#39;P&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /CCG/i ){ return &#39;P&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /CCT/i ){ return &#39;P&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /CAC/i ){ return &#39;H&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /CAT/i ){ return &#39;H&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /CAA/i ){ return &#39;Q&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /CAG/i ){ return &#39;Q&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /CGA/i ){ return &#39;R&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /CGC/i ){ return &#39;R&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /CGG/i ){ return &#39;R&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /CGT/i ){ return &#39;R&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /ATA/i ){ return &#39;I&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /ATC/i ){ return &#39;I&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /ATT/i ){ return &#39;I&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /ATG/i ){ return &#39;M&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /ACA/i ){ return &#39;T&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /ACC/i ){ return &#39;T&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /ACG/i ){ return &#39;T&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /ACT/i ){ return &#39;T&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /AAC/i ){ return &#39;N&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /AAT/i ){ return &#39;N&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /AAA/i ){ return &#39;K&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /AAG/i ){ return &#39;K&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /AGC/i ){ return &#39;S&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /AGT/i ){ return &#39;S&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /AGA/i ){ return &#39;R&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /AGG/i ){ return &#39;R&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /GTA/i ){ return &#39;V&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /GTC/i ){ return &#39;V&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /GTG/i ){ return &#39;V&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /GTT/i ){ return &#39;V&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /GCA/i ){ return &#39;A&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /GCC/i ){ return &#39;A&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /GCG/i ){ return &#39;A&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /GCT/i ){ return &#39;A&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /GAC/i ){ return &#39;D&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /GAT/i ){ return &#39;D&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /GAA/i ){ return &#39;E&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /GAG/i ){ return &#39;E&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /GGA/i ){ return &#39;G&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /GGC/i ){ return &#39;G&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /GGG/i ){ return &#39;G&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;elsif( $codon =~ /GGT/i ){ return &#39;G&#39; }<br />
 +
&nbsp; &nbsp; &nbsp;else{print STDERR &quot;Wrong!!\nPlease check your sequence\n\n&quot;;<br />
 +
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit;}<br />
 +
}<br />
 +
for(my $i=0; $i &lt; (length($dna) - 2) ; $i += 3) {<br />
 +
&nbsp; &nbsp; $codon = substr($dna,$i,3);<br />
 +
&nbsp; &nbsp; $protein .= Codon_table($codon);<br />
 +
}<br />
 +
print &quot;\n &nbsp;&lt;DNA&gt;\n\n$dna\n\n &nbsp;&lt;Protein&gt;\n\n$protein\n\n&quot;;<br />
 +
exit;</p>
 +
 +
<p>[[Result]]</p>
 +
 +
<p>&nbsp;</p>
 +
 +
<p>&nbsp;</p>

Latest revision as of 02:02, 27 May 2016

1. strawberry perl을 깐다

2. editplus를 깔아서 perl과 연동시킨다

3. editplus내에서 코드 입력한 뒤 ctrl + 1 눌러서 실행시킨후 결과 도출하기

 

<기본 format>

#!/usr/bin/perl

  1. Translate DNA into protein

use strict;
use warnings;
use BeginPerlBioinfo;   

# Initialize variables
my $dna = '';
my $protein = '';
my $codon;

# Translate each three-base codon into an amino acid, and append to a protein 
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;

<실전적용해보기>

I use the DNA sequence of homo sapiens p53.

#!/usr/bin/perl

  1. Translate DNA into protein

my $dna = 'ATGGAGGAGCCGCAGTCAGATCCTAGCGTCGAGCCCCCTCTGAGTCAGGAAACATTTTCAGACCTATGGAAACTACTTCCTGAAAACAACGTTCTGTCCCCCTTGCCGTCCCAAGCAATGGATGATTTGATGCTGTCCCCGGACGATATTGAACAATGGTTCACTGAAGACCCAGGTCCAGATGAAGCTCCCAGAATGCCAGAGGCTGCTCCCCGCGTGGCCCCTGCACCAGCAGCTCCTACACCGGCGGCCCCTGCACCAGCCCCCTCCTGGCCCCTGTCATCTTCTGTCCCTTCCCAGAAAACCTACCAGGGCAGCTACGGTTTCCGTCTGGGCTTCTTGCATTCTGGGACAGCCAAGTCTGTGACTTGCACGTACTCCCCTGCCCTCAACAAGATGTTTTGCCAACTGGCCAAGACCTGCCCTGTGCAGCTGTGGGTTGATTCCACACCCCCGCCCGGCACCCGCGTCCGCGCCATGGCCATCTACAAGCAGTCACAGCACATGACGGAGGTTGTGAGGCGCTGCCCCCACCATGAGCGCTGCTCAGATAGCGATGGTCTGGCCCCTCCTCAGCATCTTATCCGAGTGGAAGGAAATTTGCGTGTGGAGTATTTGGATGACAGAAACACTTTTCGACATAGTGTGGTGGTGCCCTATGAGCCGCCTGAGGTTGGCTCTGACTGTACCACCATCCACTACAACTACATGTGTAACAGTTCCTGCATGGGCGGCATGAACCGGAGGCCCATCCTCACCATCATCACACTGGAAGACTCCAGTGGTAATCTACTGGGACGGAACAGCTTTGAGGTGCATGTTTGTGCCTGTCCTGGGAGAGACCGGCGCACAGAGGAAGAGAATCTCCGCAAGAAAGGGGAGCCTCACCACGAGCTGCCCCCAGGGAGCACTAAGCGAGCACTGTCCAACAACACCAGCTCCTCTCCCCAGCCAAAGAAGAAACCACTGGATGGAGAATATTTCACCCTTCAGATCCGTGGGCGTGAGCGCTTCGAGATGTTCCGAGAGCTGAATGAGGCCTTGGAACTCAAGGATGCCCAGGCTGGGAAGGAGCCAGGGGGGAGCAGGGCTCACTCCAGCCACCTGAAGTCCAAAAAGGGTCAGTCTACCTCCCGCCATAAAAAACTCATGTTCAAGACAGAAGGGCCTGACTCAGACTGA';
my $protein = '';
my $codon;
 sub Codon_table {
     my($codon) = @_;
        if( $codon =~ /TCA/i ){ return 'S' }
     elsif( $codon =~ /TCC/i ){ return 'S' }
     elsif( $codon =~ /TCG/i ){ return 'S' }
     elsif( $codon =~ /TCT/i ){ return 'S' }
     elsif( $codon =~ /TTC/i ){ return 'F' }
     elsif( $codon =~ /TTT/i ){ return 'F' }
     elsif( $codon =~ /TTA/i ){ return 'L' }
     elsif( $codon =~ /TTG/i ){ return 'L' }
     elsif( $codon =~ /TAC/i ){ return 'Y' }
     elsif( $codon =~ /TAT/i ){ return 'Y' }
     elsif( $codon =~ /TAA/i ){ return '*' }
     elsif( $codon =~ /TAG/i ){ return '*' }
     elsif( $codon =~ /TGC/i ){ return 'C' }
     elsif( $codon =~ /TGT/i ){ return 'C' }
     elsif( $codon =~ /TGA/i ){ return '*' }
     elsif( $codon =~ /TGG/i ){ return 'W' }
     elsif( $codon =~ /CTA/i ){ return 'L' }
     elsif( $codon =~ /CTC/i ){ return 'L' }
     elsif( $codon =~ /CTG/i ){ return 'L' }
     elsif( $codon =~ /CTT/i ){ return 'L' }
     elsif( $codon =~ /CCA/i ){ return 'P' }
     elsif( $codon =~ /CCC/i ){ return 'P' }
     elsif( $codon =~ /CCG/i ){ return 'P' }
     elsif( $codon =~ /CCT/i ){ return 'P' }
     elsif( $codon =~ /CAC/i ){ return 'H' }
     elsif( $codon =~ /CAT/i ){ return 'H' }
     elsif( $codon =~ /CAA/i ){ return 'Q' }
     elsif( $codon =~ /CAG/i ){ return 'Q' }
     elsif( $codon =~ /CGA/i ){ return 'R' }
     elsif( $codon =~ /CGC/i ){ return 'R' }
     elsif( $codon =~ /CGG/i ){ return 'R' }
     elsif( $codon =~ /CGT/i ){ return 'R' }
     elsif( $codon =~ /ATA/i ){ return 'I' }
     elsif( $codon =~ /ATC/i ){ return 'I' }
     elsif( $codon =~ /ATT/i ){ return 'I' }
     elsif( $codon =~ /ATG/i ){ return 'M' }
     elsif( $codon =~ /ACA/i ){ return 'T' }
     elsif( $codon =~ /ACC/i ){ return 'T' }
     elsif( $codon =~ /ACG/i ){ return 'T' }
     elsif( $codon =~ /ACT/i ){ return 'T' }
     elsif( $codon =~ /AAC/i ){ return 'N' }
     elsif( $codon =~ /AAT/i ){ return 'N' }
     elsif( $codon =~ /AAA/i ){ return 'K' }
     elsif( $codon =~ /AAG/i ){ return 'K' }
     elsif( $codon =~ /AGC/i ){ return 'S' }
     elsif( $codon =~ /AGT/i ){ return 'S' }
     elsif( $codon =~ /AGA/i ){ return 'R' }
     elsif( $codon =~ /AGG/i ){ return 'R' }
     elsif( $codon =~ /GTA/i ){ return 'V' }
     elsif( $codon =~ /GTC/i ){ return 'V' }
     elsif( $codon =~ /GTG/i ){ return 'V' }
     elsif( $codon =~ /GTT/i ){ return 'V' }
     elsif( $codon =~ /GCA/i ){ return 'A' }
     elsif( $codon =~ /GCC/i ){ return 'A' }
     elsif( $codon =~ /GCG/i ){ return 'A' }
     elsif( $codon =~ /GCT/i ){ return 'A' }
     elsif( $codon =~ /GAC/i ){ return 'D' }
     elsif( $codon =~ /GAT/i ){ return 'D' }
     elsif( $codon =~ /GAA/i ){ return 'E' }
     elsif( $codon =~ /GAG/i ){ return 'E' }
     elsif( $codon =~ /GGA/i ){ return 'G' }
     elsif( $codon =~ /GGC/i ){ return 'G' }
     elsif( $codon =~ /GGG/i ){ return 'G' }
     elsif( $codon =~ /GGT/i ){ return 'G' }
     else{print STDERR "Wrong!!\nPlease check your sequence\n\n";
          exit;}
}
for(my $i=0; $i < (length($dna) - 2) ; $i += 3) {
    $codon = substr($dna,$i,3);
    $protein .= Codon_table($codon);
}
print "\n  <DNA>\n\n$dna\n\n  <Protein>\n\n$protein\n\n";
exit;

Result