Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: translating multiple DNA sequence to protein sequence

by jwkrahn (Monsignor)
on Aug 19, 2013 at 08:44 UTC ( #1049994=note: print w/ replies, xml ) Need Help??


in reply to translating multiple DNA sequence to protein sequence

#!/usr/bin/perl use warnings; use strict; print 'ENTER THE FILENAME OF THE DNA SEQUENCE:= '; chomp( my $DNAfilename = <STDIN> ); open my $DNAFILE, $DNAfilename or die qq[Cannot open file "$DNAfilenam +e" because: $!]; local $/; ( my $DNA = uc <$DNAFILE> ) =~ tr/ACGT//cd; print "\nThe original DNA file is:\n$DNA\n"; my %codon2aa = qw( TCA S TCC S TCG S TCT S TTC F TTT F TTA L TTG L TAC Y TAT Y TAA _ TAG _ TGC C TGT C TGA _ TGG W CTA L CTC L CTG L CTT L CCA P CCC P CCG P CCT P CAC H CAT H CAA Q CAG Q CGA R CGC R CGG R CGT R ATA I ATC I ATT I ATG M ACA T ACC T ACG T ACT T AAC N AAT N AAA K AAG K AGC S AGT S AGA R AGG R GTA V GTC V GTG V GTT V GCA A GCC A GCG A GCT A GAC D GAT D GAA E GAG E GGA G GGC G GGG G GGT G ); my $protein = ''; while ( $DNA =~ /(...)/g ) { exists $codon2aa{ $1 } or die qq[Bad codon "$1"!!\n]; $protein .= $codon2aa{ $1 }; } print "The translated protein is :\n$protein\n"; <STDIN>;


Comment on Re: translating multiple DNA sequence to protein sequence
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1049994]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (11)
As of 2014-10-25 16:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (145 votes), past polls