-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate_distribution.html
101 lines (97 loc) · 3.69 KB
/
generate_distribution.html
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
<%perl>
sub tmp_cloud {
my $config = shift;
my $filters = shift;
my $species = shift;
my $slipsites = shift;
my $mfe_methods = shift;
my $seqlength = shift;
my $cloud = new PRFGraph(config=>$config);
my $suffix;
my $pknots_only;
foreach my $filter (@$filters) {
if ($filter eq 'pseudoknots only') {
$suffix .= "-pknot";
$pknots_only = 1;
} elsif ($filter eq 'coding sequence only') {
$suffix .= "-cs";
}
}
if ($slipsites eq 'all') {
$suffix .= "-all";
} else {
$suffix .= "-${slipsites}";
}
$suffix .= "-${mfe_methods}-${seqlength}";
my $cloud_output_filename = $cloud->Picture_Filename(type => 'cloud', species => $species, mfe_methods => $mfe_methods, suffix => $suffix,);
my $cloud_url = $cloud->Picture_Filename(type => 'cloud', species => $species, url => 'url', mfe_methods => $mfe_methods, suffix => $suffix,);
my $boot_table = "boot_$species";
my $mt = "mfe_$species";
my $points_stmt = qq"SELECT SQL_BUFFER_RESULT $mt.mfe, $boot_table.zscore, $mt.accession, $mt.knotp, $mt.slipsite, $mt.start, genome.genename FROM $mt, $boot_table, genome WHERE $boot_table.zscore IS NOT NULL AND $mt.mfe > -80 AND $mt.mfe < 5 AND $boot_table.zscore > -10 AND $boot_table.zscore < 10 AND $mt.seqlength = $seqlength AND $mt.id = $boot_table.mfe_id AND ";
my $averages_stmt = qq"SELECT SQL_BUFFER_RESULT avg($mt.mfe), avg($boot_table.zscore), stddev($mt.mfe), stddev($boot_table.zscore) FROM $mt, $boot_table WHERE $boot_table.zscore IS NOT NULL AND $mt.mfe > -80 AND $mt.mfe < 5 AND $boot_table.zscore > -10 AND $boot_table.zscore < 10 AND $mt.seqlength = $seqlength AND $mt.id = $boot_table.mfe_id AND ";
if ($mfe_methods ne 'all') {
if ($mfe_methods eq 'nupack+hotknots') {
$points_stmt .= "( $mt.mfe_method = 'nupack' OR $mt.mfe_method = 'hotknots' ) AND ";
$averages_stmt .= "( $mt.mfe_method = 'nupack' OR $mt.mfe_method = 'hotknots' ) AND ";
} elsif ($mfe_methods eq 'nupack') {
$points_stmt .= "$mt.mfe_method = 'nupack' AND ";
$averages_stmt .= "$mt.mfe_method = 'nupack' AND ";
} elsif ($mfe_methods eq 'pknots') {
$points_stmt .= "$mt.mfe_method = 'pknots' AND ";
$averages_stmt .= "$mt.mfe_method = 'pknots' AND ";
} elsif ($mfe_methods eq 'hotknots') {
$points_stmt .= "$mt.mfe_method = 'hotknots' AND ";
$averages_stmt .= "$mt.mfe_method = 'hotknots' AND ";
}
}
foreach my $filter (@${filters}) {
if ($filter eq 'pseudoknots only') {
$points_stmt .= "$mt.knotp = '1' AND ";
$averages_stmt .= "$mt.knotp = '1' AND ";
} elsif ($filter eq 'coding sequence only') {
$points_stmt .= "";
$averages_stmt .= "";
}
}
$points_stmt .= " $mt.genome_id = genome.id";
$averages_stmt =~ s/AND $//g;
my $points = $db->MySelect(statement => $points_stmt,);
my $averages = $db->MySelect(statement => $averages_stmt, type => 'row');
my %args;
if (defined($pknots_only)) {
%args = (
seqlength => $seqlength,
species => $species,
points => $points,
mfe_methods => $mfe_methods,
averages => $averages,
filename => $cloud_output_filename,
url => $ENV{PRFDB_HOME},
pknot => 1,
slipsites => $slipsites
);
} else {
%args = (
seqlength => $seqlength,
species => $species,
points => $points,
averages => $averages,
mfe_methods => $mfe_methods,
filename => $cloud_output_filename,
url => $ENV{PRFDB_HOME},
slipsites => $slipsites,
);
}
my $cloud_data = $cloud->Make_Cloud(%args);
}
use Proc::Forkfunc;
my @child_args = ($config, $filters, $species, $slipsites, $mfe_methods, $seqlength);
forkfunc(\&tmp_cloud,@child_args);
</%perl>
<%args>
$species => "saccharomyces_cerevisiae"
$mfe_methods => "all"
$seqlength => 100
$slipsites => "all"
$filters => undef
</%args>