Schrift
[thread]6586[/thread]

Syntax Error



<< >> 3 Einträge, 1 Seite
crackbrained
 2004-12-20 14:30
#50193 #50193
User since
2004-12-13
12 Artikel
BenutzerIn
[default_avatar]
Hallo!
Kann mir jemand helfen meinen Syntax Error zu finden. Ich erhalte folgende Fehlermeldung:
syntax error at info2.pl line 50, near ");"
Execution of info2.pl aborted due to compilation errors.

Code: (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
#!/usr/bin/perl -w

use strict;
use File::Basename;
use Getopt::Std;

# parsing commandline options

my (%opts);
getopts('f:', \%opts);

my ($seqname,$opts, $seq, %seqs, $seqlen, $i, $as, $horiz, %count, $entropie,   );

readseq();

# $seqs{$seqname} = $seq;
#  $seqs{7s} = gaucgaucgaucgaucga;
#  $seqs{5s} = acgaucgaugcagc;
#  $seqs{meine} = aucg;
#
for ($horiz = 0; $horiz < $seqlen; $horiz++)
{

# initialisieren: alles 0 setzen

foreach $seqname (keys %seqs)   #vertikal: 7s, 5s, meine
{  

# zeile: seqname, spalte: $horiz
$as = substr($seqs{$seqname}, $horiz, 1);
$count{$as} += 1;
print "dies ist $as in zeile $seqname spalte $horiz\n";
print "zaehle count{$as} +1 =$count{$as}\n";
}
print "fertig mit spalte $horiz: jetzt rechnen\n";

# subroutines
#sub log 10 {
# my $n = shift;
# return log($n)/log(10);
#}
 
# Entropie
# foreach ($count {$as} / 0.05)
   foreach $as (keys %count);     #ZEILE:50 FEHLERMELDUNG!!!!!
                                  # für jede aminosäure
   {
       #my $entropie=$count{$as} * ((log($n)/log(2)) * ($count{$as} / 0.05));
       my $entropie = $count{$as} * log2($count{$as} / 0.05);
       print "In der Spalte betraegt der Wert: $entropie fr $as\n";
   }

}


# end main

###############################################################################
sub log2 {
##########
   my $n = shift;
   return log($n)/log(2);
}

###############################################################################
# read sequence from file or command line
sub readseq {
#############
  # from file
       open(FILE, "$opts{f}")
           or die "can't open file:!";
       while (<FILE>){
           if ($_ =~ /^>/) {
               chomp;
               ($seqname = $_) =~ s/^> *//;
           } elsif (/^[ACDEFGHIKLMNPQRSTVWYacdefghiklmnpqrstvwy-]+$/) {
               chomp;
               $seq = uc($_);
               $seqs{$seqname} = $seq;
$seqlen=length($seq);
           } elsif (/^$/) {
               next;
           } else {
               print "Sequence \"$seqname\" is not nucleic acid!\n";
exit -1;
           }
       }
       close FILE;
}
# end readseq
Relais
 2004-12-20 14:37
#50194 #50194
User since
2003-08-06
2244 Artikel
ModeratorIn
[Homepage] [default_avatar]
Das Semikolon (;) muß aus genau jener Zeile raus.
Erst denken, dann posten --
26. Deutscher Perl- u. Raku -Workshop 15. bis 17.04.2024 in Frankfurt/M.

Winter is Coming
crackbrained
 2004-12-20 14:47
#50195 #50195
User since
2004-12-13
12 Artikel
BenutzerIn
[default_avatar]
aaaarrrrrggghhhhhh

Vielen Dank!!! Da hätte ich auch selbst drauf kommen können
<< >> 3 Einträge, 1 Seite



View all threads created 2004-12-20 14:30.