Thread my richtig setzen (18 answers)
Opened by Byonik at 2010-06-24 10:28

Gast Byonik
 2010-06-24 10:28
#138894 #138894
Hallo ich hab ein Programm geschrieben, welches DNA zu Proteinen umwandelt.
Ohne 'my'funktioniert es. :-) aber mit nicht :-D.

Kann mir da jemand weiter helfen und mir sagen warum hier und da ein my hin muss.

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!use/bin/perl -w

#use strict;



sub codon2aa {                                                  #eine Subrutine zur übersetzung der zu einer Aminosäure
   my($codon) = @_;
       if ( $codon =~ /TCA/i ) { return 'S' } #Serine 

    elsif ( $codon =~ /TCC/i ) { return 'S' } #Serine
    elsif ( $codon =~ /TCG/i ) { return 'S' } #Serine
    elsif ( $codon =~ /TCT/i ) { return 'S' } #Serine
    
    elsif ( $codon =~ /TTC/i ) { return 'F' } #Phenylalanine
    elsif ( $codon =~ /TTT/i ) { return 'F' } #Phenylalanine

    elsif ( $codon =~ /TTA/i ) { return 'L' } #Leucine
    elsif ( $codon =~ /TTG/i ) { return 'L' } #Leucine

    elsif ( $codon =~ /TAC/i ) { return 'Y' } #Tyrosine
    elsif ( $codon =~ /TAT/i ) { return 'Y' } #Tyrosine

    elsif ( $codon =~ /TAA/i ) { return '_' } # Stop
    elsif ( $codon =~ /TAG/i ) { return '_' } # Stop

    elsif ( $codon =~ /TGC/i ) { return 'C' } #Cysteine
    elsif ( $codon =~ /TGT/i ) { return 'C' } #Cysteine

    elsif ( $codon =~ /TGA/i ) { return '_' } # Stop

    elsif ( $codon =~ /TGG/i ) { return 'W' } #Tryptophan

    elsif ( $codon =~ /CTA/i ) { return 'L' } #Leucine
    elsif ( $codon =~ /CTC/i ) { return 'L' } #Leucine
    elsif ( $codon =~ /CTG/i ) { return 'L' } #Leucine
    elsif ( $codon =~ /CTT/i ) { return 'L' } #Leucine

    elsif ( $codon =~ /CCA/i ) { return 'P' } #Proline
    elsif ( $codon =~ /CCC/i ) { return 'P' } #Proline
    elsif ( $codon =~ /CCG/i ) { return 'P' } #Proline
    elsif ( $codon =~ /CCT/i ) { return 'P' } #Proline

    elsif ( $codon =~ /CAC/i ) { return 'H' } #Histidine
    elsif ( $codon =~ /CAT/i ) { return 'H' } #Histidine

    elsif ( $codon =~ /CAA/i ) { return 'Q' } #Glutamine
    elsif ( $codon =~ /CAG/i ) { return 'Q' } #Glutamine

    elsif ( $codon =~ /CGA/i ) { return 'R' } #Arginine
    elsif ( $codon =~ /CGC/i ) { return 'R' } #Arginine
    elsif ( $codon =~ /CGG/i ) { return 'R' } #Arginine
    elsif ( $codon =~ /CGT/i ) { return 'R' } #Arginine

    elsif ( $codon =~ /ATA/i ) { return 'I' } #Isoleucine
    elsif ( $codon =~ /ATC/i ) { return 'I' } #Isoleucine
    elsif ( $codon =~ /ATT/i ) { return 'I' } #Isoleucine

    elsif ( $codon =~ /ATG/i ) { return 'M' } #Methionine

    elsif ( $codon =~ /ACA/i ) { return 'T' } #Threonine
    elsif ( $codon =~ /ACC/i ) { return 'T' } #Threonine
    elsif ( $codon =~ /ACG/i ) { return 'T' } #Threonine
    elsif ( $codon =~ /ACT/i ) { return 'T' } #Threonine

    elsif ( $codon =~ /AAC/i ) { return 'N' } #Asparagine
    elsif ( $codon =~ /AAT/i ) { return 'N' } #Asparagine

    elsif ( $codon =~ /AAA/i ) { return 'K' } #Lysine
    elsif ( $codon =~ /AAG/i ) { return 'K' } #Lysine

    elsif ( $codon =~ /AGC/i ) { return 'S' } #Serine
    elsif ( $codon =~ /AGT/i ) { return 'S' } #Serine

    elsif ( $codon =~ /AGA/i ) { return 'R' } #Arginine
    elsif ( $codon =~ /AGG/i ) { return 'R' } #Arginine

    elsif ( $codon =~ /GTA/i ) { return 'V' } #Valine
    elsif ( $codon =~ /GTC/i ) { return 'V' } #Valine
    elsif ( $codon =~ /GTG/i ) { return 'V' } #Valine
    elsif ( $codon =~ /GTT/i ) { return 'V' } #Valine

    elsif ( $codon =~ /GCA/i ) { return 'A' } #Alanine
    elsif ( $codon =~ /GCC/i ) { return 'A' } #Alanine
    elsif ( $codon =~ /GCG/i ) { return 'A' } #Alanine
    elsif ( $codon =~ /GCT/i ) { return 'A' } #Alanine

    elsif ( $codon =~ /GAC/i ) { return 'D' } #Aspartic Acid
    elsif ( $codon =~ /GAT/i ) { return 'D' } #Aspartic Acid

    elsif ( $codon =~ /GAA/i ) { return 'E' } #Glutamic Acid
    elsif ( $codon =~ /GAG/i ) { return 'E' } #Glutamic Acid

    elsif ( $codon =~ /GGA/i ) { return 'G' } #Glycine
    elsif ( $codon =~ /GGC/i ) { return 'G' } #Glycine
    elsif ( $codon =~ /GGG/i ) { return 'G' } #Glycine
    elsif ( $codon =~ /GGT/i ) { return 'G' } #Glycine

    else {
        print STDERR "Bad codon \"$codon\"!!\n";
        exit;
    }
}
print "schreibe Dateinamen:  ";
my $dna =<STDIN>;
my $protein ='';
my $codon; 

unless (open (DNADATEI, $dna)) 
        {
                print "can not open file!\n"; 
                <>;
                exit;
        } 

@datei= <DNADATEI>;
close DNADATEI;

 $dna =join ('',@datei);
 $dna =~s/\s//g;


for (my $i=0; $i < (length($dna)-2);$i+=3)
        {
                my $codon =substr($dna,$i,3);
                my $protein .= codon2aa($codon); 
        }

print "$protein"; 

<STDIN>;
exit; 


Danke.

Mfg

Byonik
Last edited: 2010-06-24 10:32:24 +0200 (CEST)

View full thread my richtig setzen