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

Annotation of /FigWebServices/wc.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (view) (download)

1 : overbeek 1.1 ########################################################################
2 :     # -*- perl -*-
3 :     #
4 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
5 :     # for Interpretations of Genomes. All Rights Reserved.
6 :     #
7 :     # This file is part of the SEED Toolkit.
8 :     #
9 :     # The SEED Toolkit is free software. You can redistribute
10 :     # it and/or modify it under the terms of the SEED Toolkit
11 :     # Public License.
12 :     #
13 :     # You should have received a copy of the SEED Toolkit Public License
14 :     # along with this program; if not write to the University of Chicago
15 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
16 :     # Genomes at veronika@thefig.info or download a copy from
17 :     # http://www.theseed.org/LICENSE.TXT.
18 :     #
19 :    
20 :     use URI::Escape; # uri_escape
21 :     use gjoseqlib;
22 :     use HTML;
23 :     use strict;
24 :     use CGI;
25 :     my $cgi = new CGI;
26 :     use SeedEnv;
27 :     use tree_utilities;
28 :     use CloseStrains;
29 :    
30 :     if (0) {
31 :     print $cgi->header;
32 :     my @params = $cgi->param;
33 :     print "<pre>\n";
34 :     foreach $_ (@params) {
35 :     print "$_\t:",join(",",$cgi->param($_)),":\n";
36 :     }
37 :     print "\n",join('&',map { "$_=" . $cgi->param($_) } @params),"\n";
38 :     exit;
39 :     }
40 :    
41 :     my $html = [];
42 :    
43 :     my $node = $cgi->param('node');
44 :     my $family = $cgi->param('family');
45 :     my $ali = $cgi->param('alignment');
46 :     my $tree = $cgi->param('tree');
47 :     my $request = $cgi->param('request');
48 :     my $keywords = $cgi->param('keywords');
49 :     my $function = $cgi->param('function');
50 :     my $dataD = $cgi->param('dataD');
51 : overbeek 1.2 my $csD = "/homes/overbeek/Ross/MakeCS.Kbase/Data/CS";
52 :     my $dataDF = "$csD/$dataD";
53 :    
54 :     my $parms = {};
55 :    
56 :     $parms->{genome_types} = &CloseStrains::genome_types($dataDF);
57 :     $parms->{dataDF} = $dataDF;
58 : overbeek 1.1
59 :     if ($request eq "show_otus")
60 :     {
61 :     &show_otus($cgi,$csD);
62 :     exit;
63 :     }
64 :     elsif (($request eq "show_options_for_otu") && $dataD)
65 :     {
66 :     $html = &CloseStrains::show_options_for_otu($cgi,$dataD);
67 :     }
68 :     elsif ($request eq "show_signatures")
69 :     {
70 : overbeek 1.2 &CloseStrains::show_signatures($cgi,$parms,$html);
71 : overbeek 1.1 }
72 :     elsif ($request eq "compute_sigs")
73 :     {
74 : overbeek 1.2 &CloseStrains::compute_signatures($cgi,$parms,$html);
75 : overbeek 1.1 }
76 :     elsif (($request eq "show_func") && $function)
77 :     {
78 :     $function =~ s/^\s+//;
79 :     $function =~ s/\s+$//;
80 : overbeek 1.2 &CloseStrains::show_func($cgi,$parms,$html,$function);
81 : overbeek 1.1 }
82 :     elsif (($request eq "show_family_pegs") && $family)
83 :     {
84 : overbeek 1.2 &CloseStrains::show_family_pegs($cgi,$parms,$html,$family);
85 : overbeek 1.1 }
86 :     elsif (($request eq "show_virulence_functions") && (-s "$dataDF/virulence.functions"))
87 :     {
88 : overbeek 1.2 &CloseStrains::show_virulence_functions($cgi,$parms,$html);
89 : overbeek 1.1 }
90 :     elsif (($request eq 'show_indexed_funcs') && $keywords)
91 :     {
92 : overbeek 1.2 &CloseStrains::show_indexed_funcs($cgi,$parms,$html,$keywords);
93 : overbeek 1.1 }
94 :     elsif (($request eq "show_ali_or_occurs_tree") && $ali)
95 :     {
96 : overbeek 1.2 &CloseStrains::show_ali($cgi,$parms); # NOTE: the alignment invokes Gary's alignment viewer,
97 : overbeek 1.1 # which prints the header, so we print everything in show_ali
98 :     exit;
99 :     }
100 :     elsif (($request eq "show_ali_or_occurs_tree") && $tree)
101 :     {
102 : overbeek 1.2 &CloseStrains::show_occurs_tree($cgi,$parms,$html);
103 : overbeek 1.1 }
104 :     elsif (($request eq "show_family_tree") && $family)
105 :     {
106 : overbeek 1.2 &CloseStrains::show_family_tree($cgi,$parms,$html,$family);
107 : overbeek 1.1 }
108 :     elsif (($request eq "show_node") && $node)
109 :     {
110 : overbeek 1.2 &CloseStrains::show_node($cgi,$parms,$html,$node);
111 : overbeek 1.1 }
112 :     elsif ($request eq "show_otu_tree")
113 :     {
114 : overbeek 1.2 &CloseStrains::show_otu_tree($cgi,$parms,$html,'families');
115 : overbeek 1.1 }
116 :     elsif ($request eq "show_adjacency")
117 :     {
118 : overbeek 1.2 &CloseStrains::show_otu_tree($cgi,$parms,$html,'adjacency');
119 : overbeek 1.1 }
120 :     elsif ($request eq "show_clusters")
121 :     {
122 : overbeek 1.2 &CloseStrains::show_clusters($cgi,$parms,$html);
123 : overbeek 1.1 }
124 : overbeek 1.3 elsif ($request eq "show_help")
125 :     {
126 :     my $type = $cgi->param('type');
127 :     if ($type eq "signatures")
128 :     {
129 :     my $help_sig = &CloseStrains::help_sig();
130 :     push(@$html,"<pre>$help_sig</pre>\n");
131 :     }
132 : overbeek 1.6 elsif ($type eq "compute_signatures")
133 :     {
134 :     my $help_sig_output = &CloseStrains::help_sig_output();
135 :     push(@$html,"<pre>$help_sig_output</pre>\n");
136 :     }
137 :     elsif ($type eq "family")
138 :     {
139 :     my $help_family_output = &CloseStrains::help_family_output();
140 :     push(@$html,"<pre>$help_family_output</pre>\n");
141 :     }
142 :     elsif ($type eq "function")
143 :     {
144 :     my $help_function_output = &CloseStrains::help_function_output();
145 :     push(@$html,"<pre>$help_function_output</pre>\n");
146 :     }
147 : overbeek 1.3 }
148 : overbeek 1.1 else
149 :     {
150 :     push(@$html,"<h1>Invalid request</h1>");
151 :     }
152 :     &HTML::show_page($cgi,$html);
153 :     exit;
154 :    
155 :     sub show_otus {
156 :     my($cgi,$datadir) = @_;
157 :    
158 :     print $cgi->header;
159 :     if (opendir(GENERA,$csD))
160 :     {
161 :     my @genera = grep { $_ !~ /^\./ } readdir(GENERA);
162 :     closedir(GENERA);
163 :     print "<h1>What Changed?</h1>\n";
164 :     print "<h2><a target=_blank href=\"http://bioseed.mcs.anl.gov/~overbeek/what_changed.html\">Getting Started: a short Tutorial</a></h2>\n";
165 :     print "<h2>Genera Available</h2>\n";
166 :     foreach my $g (sort @genera)
167 :     {
168 : overbeek 1.4 print "<h3><a target=_blank href=http://bioseed.mcs.anl.gov/ross/FIG/wc.cgi?request=show_options_for_otu&dataD=$g>$g</a>\n";
169 : overbeek 1.1 }
170 :     }
171 :     else
172 :     {
173 :     print "<h1>The dataD parameter is invalid\n";
174 :     }
175 :     }
176 :    
177 :     sub virulence_functions_link {
178 :     my($cgi,$dataDF) = @_;
179 :    
180 :     if ((-s "$dataDF/virulence.functions") && ($dataDF =~ /([^\/]+)$/))
181 :     {
182 :     my $dataDQ = uri_escape($1);
183 : overbeek 1.4 return "<a target=_blank href=http://bioseed.mcs.anl.gov/ross/FIG/wc.cgi?request=show_virulence_functions&dataD=$dataDQ>Some Posssible Functions Associated with Virulence</a>";
184 : overbeek 1.1 }
185 :     return '';
186 :     }
187 :    
188 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3