[Bio] / FigWebServices / wc.cgi Repository:
ViewVC logotype

Annotation of /FigWebServices/wc.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.17 - (view) (download)

1 : overbeek 1.17 #!/usr/bin/env /vol/ross/FIGdisk/bin/run_perl
2 :    
3 :     BEGIN {
4 :     unshift @INC, qw(
5 :     /homes/overbeek/Ross/Nelly/bin
6 :     /vol/ross/FIGdisk/dist/releases/dev/FigKernelPackages
7 :     /vol/ross/FIGdisk/dist/releases/dev/common/lib
8 :     /vol/ross/FIGdisk/dist/releases/dev/common/lib/FigKernelPackages
9 :     /vol/ross/FIGdisk/dist/releases/dev/common/lib/WebApplication
10 :     /vol/ross/FIGdisk/dist/releases/dev/common/lib/FortyEight
11 :     /vol/ross/FIGdisk/dist/releases/dev/common/lib/PPO
12 :     /vol/ross/FIGdisk/dist/releases/dev/common/lib/RAST
13 :     /vol/ross/FIGdisk/dist/releases/dev/common/lib/MGRAST
14 :     /vol/ross/FIGdisk/dist/releases/dev/common/lib/SeedViewer
15 :     /vol/ross/FIGdisk/dist/releases/dev/common/lib/ModelSEED
16 :     /vol/ross/FIGdisk/dist/anon/common/lib
17 :     /vol/ross/FIGdisk/dist/anon/common/lib/FigKernelPackages
18 :     /vol/ross/FIGdisk/config
19 :    
20 :     );
21 :     }
22 :     use Data::Dumper;
23 :     use Carp;
24 :     use FIG_Config;
25 :     $ENV{'BLASTMAT'} = "/vol/ross/FIGdisk/BLASTMAT";
26 :     $ENV{'FIG_HOME'} = "/vol/ross/FIGdisk";
27 :     # end of tool_hdr
28 :     ########################################################################
29 :     use CGI;
30 :    
31 :    
32 :     if (-f "$FIG_Config::data/Global/why_down")
33 :     {
34 :     local $/;
35 :     open my $fh, "<$FIG_Config::data/Global/why_down";
36 :     my $down_msg = <$fh>;
37 :    
38 :     print CGI::header();
39 :     print CGI::head(CGI::title("SEED Server down"));
40 :     print CGI::start_body();
41 :     print CGI::h1("SEED Server down");
42 :     print CGI::p("The seed server is not currently running:");
43 :     print CGI::pre($down_msg);
44 :     print CGI::end_body();
45 :     exit;
46 :     }
47 :    
48 :     if ($FIG_Config::readonly)
49 :     {
50 :     CGI::param("user", undef);
51 :     }
52 :    
53 : overbeek 1.1 # -*- perl -*-
54 :     #
55 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
56 :     # for Interpretations of Genomes. All Rights Reserved.
57 :     #
58 :     # This file is part of the SEED Toolkit.
59 :     #
60 :     # The SEED Toolkit is free software. You can redistribute
61 :     # it and/or modify it under the terms of the SEED Toolkit
62 :     # Public License.
63 :     #
64 :     # You should have received a copy of the SEED Toolkit Public License
65 :     # along with this program; if not write to the University of Chicago
66 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
67 :     # Genomes at veronika@thefig.info or download a copy from
68 :     # http://www.theseed.org/LICENSE.TXT.
69 :     #
70 :    
71 : olson 1.13 eval {
72 :     require FIG_Config;
73 :     };
74 :    
75 : overbeek 1.1 use URI::Escape; # uri_escape
76 :     use gjoseqlib;
77 :     use HTML;
78 :     use strict;
79 :     use CGI;
80 : olson 1.15 our $cgi = new CGI;
81 : overbeek 1.1 use SeedEnv;
82 :     use tree_utilities;
83 :     use CloseStrains;
84 :    
85 :     if (0) {
86 :     print $cgi->header;
87 :     my @params = $cgi->param;
88 :     print "<pre>\n";
89 :     foreach $_ (@params) {
90 :     print "$_\t:",join(",",$cgi->param($_)),":\n";
91 :     }
92 :     print "\n",join('&',map { "$_=" . $cgi->param($_) } @params),"\n";
93 :     exit;
94 :     }
95 :    
96 : olson 1.15 our $html = [];
97 : overbeek 1.1
98 : olson 1.15 our $node = $cgi->param('node');
99 :     our $family = $cgi->param('family');
100 :     our $genome = $cgi->param('genome');
101 :     our $ali = $cgi->param('alignment');
102 :     our $tree = $cgi->param('tree');
103 :     our $request = $cgi->param('request');
104 :     our $keywords = $cgi->param('keywords');
105 :     our $function = $cgi->param('function');
106 :     our $reaction = $cgi->param('reaction');
107 :     our $dataD = $cgi->param('dataD');
108 :     our $base = $cgi->param('base');
109 : olson 1.13 #
110 :     # If we are operating in RAST, the csD sits within the
111 :     # RAST job directory and the dataD setting is the
112 :     # RAST job number.
113 :     #
114 :    
115 : olson 1.15 our $csD;
116 : overbeek 1.14 if ($base)
117 :     {
118 :     $csD = $base;
119 :     }
120 :     else
121 :     {
122 :     $csD = "/homes/overbeek/Ross/MakeCS.Kbase/Data/CS";
123 :     }
124 : olson 1.13 if ($FIG_Config::rast_jobs && -d $FIG_Config::rast_jobs)
125 :     {
126 :     $csD = "$FIG_Config::rast_jobs/$dataD/CloseStrains";
127 :     }
128 :    
129 : olson 1.15 our $dataDF = "$csD/$dataD";
130 : overbeek 1.2
131 : olson 1.15 our $parms = {};
132 : overbeek 1.2
133 :     $parms->{genome_types} = &CloseStrains::genome_types($dataDF);
134 :     $parms->{dataDF} = $dataDF;
135 : overbeek 1.17 $parms->{base} = $base;
136 : overbeek 1.1
137 :     if ($request eq "show_otus")
138 :     {
139 : overbeek 1.14 &show_otus($cgi,$csD,$base);
140 : overbeek 1.1 exit;
141 :     }
142 :     elsif (($request eq "show_options_for_otu") && $dataD)
143 :     {
144 : overbeek 1.14 $html = &CloseStrains::show_options_for_otu($cgi,$dataD,$dataDF,$base);
145 :     push(@$html,"<a target=_blank href=./wc.cgi?dataD=$dataD&base=$base&request=newick_tree>Newick Tree</a>\n");
146 :     }
147 :     elsif ($request eq "newick_tree")
148 :     {
149 :     if (open(TREE,"<$dataDF/estimated.phylogeny.nwk"))
150 :     {
151 :     my @tree = map { $_ =~ s/,/,\n/g; $_ } <TREE>;
152 :    
153 :     push(@$html,"<pre>",@tree,"</pre>");
154 :     close(TREE);
155 :     }
156 : overbeek 1.1 }
157 :     elsif ($request eq "show_signatures")
158 :     {
159 : overbeek 1.14 &CloseStrains::show_signatures($cgi,$parms,$html,$base);
160 : overbeek 1.1 }
161 : overbeek 1.10 elsif ($request eq "show_signatures_reactions")
162 :     {
163 : overbeek 1.14 &CloseStrains::show_signatures_reactions($cgi,$parms,$html,$base);
164 : overbeek 1.10 }
165 : overbeek 1.1 elsif ($request eq "compute_sigs")
166 :     {
167 : overbeek 1.14 &CloseStrains::compute_signatures($cgi,$parms,$html,$base);
168 : overbeek 1.1 }
169 : overbeek 1.10 elsif ($request eq "compute_signatures_reactions")
170 :     {
171 : overbeek 1.17 &CloseStrains::compute_signatures_reactions($cgi,$parms,$html,$base);
172 : overbeek 1.10 }
173 : overbeek 1.1 elsif (($request eq "show_func") && $function)
174 :     {
175 :     $function =~ s/^\s+//;
176 :     $function =~ s/\s+$//;
177 : overbeek 1.14 &CloseStrains::show_func($cgi,$parms,$html,$function,$base);
178 : overbeek 1.1 }
179 :     elsif (($request eq "show_family_pegs") && $family)
180 :     {
181 : overbeek 1.14 &CloseStrains::show_family_pegs($cgi,$parms,$html,$family,$base);
182 : overbeek 1.1 }
183 :     elsif (($request eq "show_virulence_functions") && (-s "$dataDF/virulence.functions"))
184 :     {
185 : overbeek 1.14 &CloseStrains::show_virulence_functions($cgi,$parms,$html,$base);
186 : overbeek 1.1 }
187 :     elsif (($request eq 'show_indexed_funcs') && $keywords)
188 :     {
189 : overbeek 1.14 &CloseStrains::show_indexed_funcs($cgi,$parms,$html,$keywords,$base);
190 : overbeek 1.1 }
191 :     elsif (($request eq "show_ali_or_occurs_tree") && $ali)
192 :     {
193 : overbeek 1.14 &CloseStrains::show_ali($cgi,$parms,$base); # NOTE: the alignment invokes Gary's alignment viewer,
194 : overbeek 1.1 # which prints the header, so we print everything in show_ali
195 :     exit;
196 :     }
197 :     elsif (($request eq "show_ali_or_occurs_tree") && $tree)
198 :     {
199 : overbeek 1.14 &CloseStrains::show_occurs_tree($cgi,$parms,$html,$base);
200 : overbeek 1.1 }
201 :     elsif (($request eq "show_family_tree") && $family)
202 :     {
203 : overbeek 1.14 &CloseStrains::show_family_tree($cgi,$parms,$html,$family,$base);
204 : overbeek 1.1 }
205 :     elsif (($request eq "show_node") && $node)
206 :     {
207 : overbeek 1.14 &CloseStrains::show_node($cgi,$parms,$html,$node,$base);
208 : overbeek 1.1 }
209 :     elsif ($request eq "show_otu_tree")
210 :     {
211 : overbeek 1.14 &CloseStrains::show_otu_tree($cgi,$parms,$html,'families',$base);
212 : overbeek 1.1 }
213 : overbeek 1.10 elsif ($request eq "show_reactions")
214 :     {
215 : overbeek 1.14 &CloseStrains::show_reactions($cgi,$parms,$html,$base);
216 : overbeek 1.10 }
217 :     elsif (($request eq "show_reaction_on_tree") && $reaction)
218 :     {
219 : overbeek 1.14 &CloseStrains::show_reaction_on_tree($cgi,$reaction,$parms,$html,$base);
220 : overbeek 1.10 }
221 :     elsif (($request eq "show_reaction_genome_data") && $reaction && $genome)
222 :     {
223 : overbeek 1.14 &CloseStrains::show_reaction_genome_data($cgi,$reaction,$genome,$dataDF,$parms,$html,$base);
224 : overbeek 1.10 }
225 :     elsif ($request eq "show_options_for_reactions")
226 :     {
227 : overbeek 1.14 &CloseStrains::show_options_for_reactions($cgi,$html,$dataD,$dataDF,$base);
228 :     # &CloseStrains::show_signatures_reactions($cgi,$parms,$html,$base);
229 : overbeek 1.11 }
230 :     elsif ($request eq "show_otu_tree_reactions")
231 :     {
232 : overbeek 1.16 &CloseStrains::show_otu_tree($cgi,$parms,$html,'reaction',$base);
233 : overbeek 1.10 }
234 : overbeek 1.1 elsif ($request eq "show_adjacency")
235 :     {
236 : overbeek 1.14 &CloseStrains::show_otu_tree($cgi,$parms,$html,'adjacency',$base);
237 : overbeek 1.1 }
238 :     elsif ($request eq "show_clusters")
239 :     {
240 : overbeek 1.14 &CloseStrains::show_clusters($cgi,$parms,$html,$base);
241 : overbeek 1.1 }
242 : overbeek 1.3 elsif ($request eq "show_help")
243 :     {
244 :     my $type = $cgi->param('type');
245 :     if ($type eq "signatures")
246 :     {
247 :     my $help_sig = &CloseStrains::help_sig();
248 :     push(@$html,"<pre>$help_sig</pre>\n");
249 :     }
250 : overbeek 1.10 elsif ($type eq "signatures_reactions")
251 :     {
252 :     my $help_sig_reactions = &CloseStrains::help_sig_reactions();
253 :     push(@$html,"<pre>$help_sig_reactions</pre>\n");
254 :     }
255 :     elsif ($type eq "reaction_on_tree")
256 :     {
257 :     my $help_reaction_on_tree = &CloseStrains::help_reaction_on_tree;
258 :     push(@$html,$help_reaction_on_tree);
259 :     }
260 : overbeek 1.6 elsif ($type eq "compute_signatures")
261 :     {
262 :     my $help_sig_output = &CloseStrains::help_sig_output();
263 :     push(@$html,"<pre>$help_sig_output</pre>\n");
264 :     }
265 : overbeek 1.10 elsif ($type eq "compute_signatures_reactions")
266 :     {
267 :     my $help_sig_output_reactions = &CloseStrains::help_sig_output_reactions();
268 :     push(@$html,"<pre>$help_sig_output_reactions</pre>\n");
269 :     }
270 : overbeek 1.6 elsif ($type eq "family")
271 :     {
272 :     my $help_family_output = &CloseStrains::help_family_output();
273 :     push(@$html,"<pre>$help_family_output</pre>\n");
274 :     }
275 :     elsif ($type eq "function")
276 :     {
277 :     my $help_function_output = &CloseStrains::help_function_output();
278 :     push(@$html,"<pre>$help_function_output</pre>\n");
279 :     }
280 : overbeek 1.3 }
281 : overbeek 1.1 else
282 :     {
283 :     push(@$html,"<h1>Invalid request</h1>");
284 :     }
285 :     &HTML::show_page($cgi,$html);
286 :     exit;
287 :    
288 :     sub show_otus {
289 : overbeek 1.14 my($cgi,$datadir,$base) = @_;
290 : overbeek 1.1
291 :     print $cgi->header;
292 :     if (opendir(GENERA,$csD))
293 :     {
294 :     my @genera = grep { $_ !~ /^\./ } readdir(GENERA);
295 :     closedir(GENERA);
296 :     print "<h1>What Changed?</h1>\n";
297 : olson 1.13 # print "<h2><a target='_blank' href=\"http://bioseed.mcs.anl.gov/~overbeek/what_changed.html\">Getting Started: a short Tutorial</a></h2>\n";
298 : overbeek 1.1 print "<h2>Genera Available</h2>\n";
299 :     foreach my $g (sort @genera)
300 :     {
301 : overbeek 1.14 print "<h3><a target='_blank' href='wc.cgi?request=show_options_for_otu&dataD=$g&base=$base'>$g</a>\n";
302 : overbeek 1.1 }
303 :     }
304 :     else
305 :     {
306 :     print "<h1>The dataD parameter is invalid\n";
307 :     }
308 :     }
309 :    
310 :     sub virulence_functions_link {
311 :     my($cgi,$dataDF) = @_;
312 :    
313 :     if ((-s "$dataDF/virulence.functions") && ($dataDF =~ /([^\/]+)$/))
314 :     {
315 :     my $dataDQ = uri_escape($1);
316 : overbeek 1.14 return "<a target='_blank' href='wc.cgi?request=show_virulence_functions&base=$base&dataD=$dataDQ'>Some Posssible Functions Associated with Virulence</a>";
317 : overbeek 1.1 }
318 :     return '';
319 :     }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3