-
Notifications
You must be signed in to change notification settings - Fork 0
/
NormalizedStats.pl
54 lines (42 loc) · 1.25 KB
/
NormalizedStats.pl
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
#!/usr/bin/perl
my $runfilePath = "stats/run.txt";
open runfile, "stats/run.txt";
# print index("this is a string", "t");
while(<runfile>) {
chomp;
my $factor = $_;
# print "$factor\n";
open (writefileSampleMean, ">broadhmm/$factor/normalized/factor-sample-mean.txt");
open (writefileRealStat, ">broadhmm/$factor/normalized/factor-real-stat.txt");
for ($state = 1; $state < 16; $state++) {
# print "$state\n";
open factorStateFile, "broadhmm/$factor/normalized/$state.txt";
# print "broadhmm/$factor/normalized/$state.txt\n";
my $factorStateSampleMean = 0;
my $factorStateRealStat = 0;
my $counter = 1;
while (<factorStateFile>) {
chomp;
my $line = $_;
# print "$line\n";
if(index($line, "The sample mean") != -1) {
my @line = split(/\s/,"$_");
$factorStateSampleMean = $line[5];
print "FOUND\n";
# print "@line\n";
# print "$line[5]\n";
}
if(index($line, "The real stat") != -1) {
my @line = split(/\s/,"$_");
$factorStateRealStat = $line[5];
print "FOUND\n";
# print "@line\n";
# print "$line[5]\n";
}
}
print "$factorStateSampleMean\n";
print "$factorStateRealStat\n";
print writefileSampleMean "$factorStateSampleMean\n";
print writefileRealStat "$factorStateRealStat\n";
}
}