2.Install perl and run the program

From Biolecture.org
Revision as of 13:56, 26 May 2016 by 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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

 

<기본 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;