File: Class.pl

package info (click to toggle)
ampliconnoise 1.29-10
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 6,040 kB
  • sloc: ansic: 18,080; sh: 2,899; perl: 2,089; makefile: 235
file content (45 lines) | stat: -rwxr-xr-x 645 bytes parent folder | download | duplicates (9)
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
#!/usr/bin/perl

my $distFile = shift;

my $alpha = shift;
my $beta =  shift;

my $total = 0;

open(FILE, $distFile) or die "Can't open $distFile\n";

$line = <FILE>;
chomp($line);
@tokens = split(/ /,$line);
$total = $tokens[0];

for($i = 0; $i < $total; $i++){
    $line = <FILE>;
    
    chomp($line);

    @tokens = split(/ /,$line);

    $id = $tokens[1];

    $id =~ /.*_(.*)/;

    $freq = $1;
    
    $x = $tokens[11]; 
    $y = $tokens[12];
    $z = $tokens[13];

    if($x >= 0.15 || $y > 0.0){
	$p = 0.0;
    }
    else{
	$r = $alpha + $beta*$z;
	$p = 1.0/(1.0 + exp(-$r));
    }
    
    print "$id $x $y $z $p\n";
}

close(FILE);