Open main menu

Biolecture.org β

2.Install perl and run the program

Revision as of 02:02, 27 May 2016 by imported>Jiyoung Oh

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]]