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

Annotation of /FigWebServices/protein.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.229 - (view) (download)

1 : redwards 1.94 # -*- perl -*-
2 : olson 1.170 #
3 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
4 :     # for Interpretations of Genomes. All Rights Reserved.
5 :     #
6 :     # This file is part of the SEED Toolkit.
7 :     #
8 :     # The SEED Toolkit is free software. You can redistribute
9 :     # it and/or modify it under the terms of the SEED Toolkit
10 :     # Public License.
11 :     #
12 :     # You should have received a copy of the SEED Toolkit Public License
13 :     # along with this program; if not write to the University of Chicago
14 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
15 :     # Genomes at veronika@thefig.info or download a copy from
16 :     # http://www.theseed.org/LICENSE.TXT.
17 :     #
18 :    
19 : paczian 1.218 use warnings;
20 :     use strict;
21 : olson 1.56
22 : paczian 1.218 use CGI qw(:standard);
23 :     use HTML::Template;
24 : olson 1.48 use Data::Dumper;
25 :    
26 : paczian 1.218 use FIG;
27 :     use FIG_Config;
28 :     use FIG_CGI;
29 :     use UserData;
30 :     use FigWebServices::SeedComponents;
31 : parrello 1.223 use PageBuilder;
32 :     use TemplateObject;
33 :    
34 :     print header();
35 : golsen 1.175
36 : paczian 1.218 eval {
37 :     &main();
38 :     };
39 : overbeek 1.184
40 : paczian 1.218 if($@) {
41 : parrello 1.223 print start_html();
42 : paczian 1.218 print STDERR "EXCEPTION: $@\n";
43 :     print "EXCEPTION: $@\n",end_html();
44 :     }
45 :    
46 :     1;
47 :    
48 : parrello 1.223
49 : paczian 1.218 sub main {
50 :     # initialize fig object
51 :     my ($fig, $cgi, $user) = FIG_CGI::init(debug_save => 0,
52 : parrello 1.220 debug_load => 0,
53 :     print_params => 0);
54 : parrello 1.223 # check if an external page is to be displayed, called with data from seed.
55 : paczian 1.218 if ($cgi->param('tool')) {
56 : parrello 1.220
57 : parrello 1.223 # Get the template object.
58 :     my $to = TemplateObject->new($cgi, php => 'Tool');
59 :    
60 :     # Get the PEG.
61 :     my $pegID = $cgi->param('prot');
62 : parrello 1.220
63 :     my $parameters = { fig_object => $fig,
64 : parrello 1.223 peg_id => $pegID,
65 : parrello 1.220 table_style => 'plain',
66 :     fig_disk => $FIG_Config::fig_disk . "/",
67 :     form_target => 'protein.cgi'
68 :     };
69 :    
70 : parrello 1.223 # Format the header information.
71 :     $to->titles($parameters);
72 :     # Spit out an index link.
73 :     $to->add(undef => "<br/>" . FigWebServices::SeedComponents::Protein::get_index_link() . "<br/><hr/>");
74 :    
75 :     # Call the tool.
76 :     $to->add(results => & FigWebServices::SeedComponents::Basic::call_tool($fig, $pegID));
77 :    
78 :     # Spit out another copy of the index link.
79 :     $to->add(undef => "<hr/>" . FigWebServices::SeedComponents::Protein::get_index_link());
80 : paczian 1.218
81 : parrello 1.223 # Output the page.
82 :     print $to->finish();
83 : paczian 1.218
84 :     # check for the new framework
85 :     } elsif ($cgi->param('new_framework')) {
86 : parrello 1.220
87 :     # display the new version
88 :     my @out = `./frame.cgi`;
89 :     print @out;
90 :     exit;
91 :    
92 : paczian 1.218 } else {
93 : parrello 1.220
94 :     # display the old version
95 :    
96 : parrello 1.223 # Get the template object.
97 :     my $to = TemplateObject->new($cgi, php => 'Protein', $cgi->param("request"));
98 :    
99 :     # Get the PEG.
100 :     my $pegID = $cgi->param('prot');
101 : paczian 1.228 if ($pegID !~ /^fig\|/) {
102 :     my @poss = $fig->by_alias($pegID);
103 :    
104 :     if (@poss > 0) {
105 :     $pegID = $poss[0];
106 :     }
107 :     }
108 : parrello 1.220
109 :     my $parameters = { fig_object => $fig,
110 : parrello 1.223 peg_id => $pegID,
111 : parrello 1.220 table_style => 'plain',
112 :     fig_disk => $FIG_Config::fig_disk . "/",
113 :     form_target => 'protein.cgi'
114 :     };
115 :    
116 :     my ($min, $max, $features) = FigWebServices::SeedComponents::Protein::get_region_data($parameters);
117 :     $parameters->{min} = $min;
118 :     $parameters->{max} = $max;
119 :     $parameters->{features} = $features;
120 :    
121 : parrello 1.223 # Format the header information.
122 :     $to->titles($parameters);
123 :     # Spit out an index link.
124 :     $to->add("<br/>" . FigWebServices::SeedComponents::Protein::get_index_link() . "<br/>") if $to->raw;
125 :     $to->add(FigWebServices::SeedComponents::Framework::get_js_css_links()) if $to->raw;
126 : parrello 1.220
127 :     # check for request parameter
128 :     my $request = $cgi->param("request") || "";
129 :    
130 : parrello 1.223 # check for quick assign. Quick assigns do not work in Sprout, but if we're in Sprout and a
131 :     # fast assign is requested, we've already crashed when we tried to create the template.
132 : parrello 1.220 if ($request eq "fast_assign") {
133 : parrello 1.223 &FigWebServices::SeedComponents::Protein::make_assignment($fig,$cgi,$pegID);
134 : parrello 1.220 $request = "";
135 :     }
136 :    
137 :     if ($request eq "view_annotations") {
138 : parrello 1.223 $to->add(results => &FigWebServices::SeedComponents::Protein::view_annotations($fig,$cgi,$pegID));
139 : parrello 1.220 } elsif ($request eq "view_all_annotations") {
140 : parrello 1.223 $to->add(results => &FigWebServices::SeedComponents::Protein::view_all_annotations($fig,$cgi,$pegID));
141 : parrello 1.220 } elsif ($request eq "show_coupling_evidence") {
142 : parrello 1.223 $to->add(results => &FigWebServices::SeedComponents::Protein::show_coupling_evidence($fig,$cgi,$pegID));
143 : parrello 1.220 } elsif ($request eq "abstract_coupling") {
144 : parrello 1.223 $to->add(results => &FigWebServices::SeedComponents::Protein::show_abstract_coupling_evidence($fig,$cgi,$pegID));
145 : parrello 1.220 } elsif ($request eq "ec_to_maps") {
146 : parrello 1.223 $to->add(results => &FigWebServices::SeedComponents::Protein::show_ec_to_maps($fig,$cgi));
147 : parrello 1.220 } elsif ($request eq "link_to_map") {
148 : parrello 1.223 $to->add(results => &FigWebServices::SeedComponents::Protein::link_to_map($fig,$cgi));
149 : parrello 1.220 } elsif ($request eq "fusions") {
150 : parrello 1.223 $to->add(results => &FigWebServices::SeedComponents::Protein::show_fusions($fig,$cgi,$pegID));
151 :     } else {
152 : paczian 1.225 # this has to be done to support calls to previous or next peg
153 :     my $adjust = $cgi->param('previous PEG') ? -1 : $cgi->param('next PEG') ? 1 : 0;
154 :     if ( $adjust ) {
155 :     my ( $prefix, $protnum ) = $pegID =~ /^(.*\.)(\d+)$/;
156 :     if ( $prefix && $protnum ) {
157 :     my $prot2 = $prefix . ($protnum + $adjust);
158 :     if ( $fig->translatable($prot2 ) ) {
159 :     $pegID = $prot2;
160 :     $cgi->delete('prot');
161 :     $cgi->param(-name => 'prot', -value => $pegID);
162 :     $parameters->{peg_id} = $pegID;
163 :     }
164 :     }
165 :     ( $adjust < 0 ) && $cgi->delete('previous PEG');
166 :     ( $adjust > 0 ) && $cgi->delete('next PEG');
167 :     }
168 :    
169 : paczian 1.229 # initialize the return value variable
170 :     my $retval;
171 :    
172 : parrello 1.223 # normal page shown.
173 : paczian 1.229 $retval = FigWebServices::SeedComponents::Protein::get_title($parameters);
174 :     $to->add(title => "<br/>".$retval->{body});
175 :     $to->add(assign => "<br/><br/>".FigWebServices::SeedComponents::Protein::get_current_assignment($parameters));
176 : parrello 1.223 $to->add("<hr/>") if $to->raw;
177 :     $to->add(translink => FigWebServices::SeedComponents::Protein::get_translation_link());
178 :     $to->add("<hr/>") if $to->raw;
179 :     $to->add(context_graphic => FigWebServices::SeedComponents::Protein::get_peg_view($parameters));
180 : paczian 1.229 $parameters->{initial_value} = 'expanded';
181 :     $retval = FigWebServices::SeedComponents::Protein::get_chromosome_context($parameters);
182 :     delete($parameters->{title});
183 :     delete($parameters->{id});
184 :     $to->add(context_table => "<br/><br/>".$retval->{title} . "<br/><br/>" . $retval->{body});
185 : parrello 1.223 $to->add("<br />") if $to->raw;
186 : parrello 1.224 $to->add(annotation_links => FigWebServices::SeedComponents::Protein::get_annotation_links($parameters));
187 : paczian 1.229 $to->add("<hr/>") if $to->raw;
188 : parrello 1.220 $parameters->{initial_value} = 'expanded';
189 : paczian 1.229 $retval = FigWebServices::SeedComponents::Protein::get_subsystem_connections($parameters);
190 :     delete($parameters->{title});
191 :     delete($parameters->{id});
192 :     $to->add(subsys_connections => "<br/><br/>".$retval->{button} . "&nbsp;&nbsp;" . $retval->{title} . "<br/><br/>" . $retval->{body});
193 :     $parameters->{initial_value} = 'collapsed';
194 :     $retval = FigWebServices::SeedComponents::Protein::get_aa_sequence($parameters);
195 :     delete($parameters->{title});
196 :     delete($parameters->{id});
197 :     $to->add(protein_sequence => "<br/><br/>".$retval->{button} . "&nbsp;&nbsp;" . $retval->{title} . "<br/><br/>" . $retval->{body});
198 :     $parameters->{initial_value} = 'collapsed';
199 :     $retval = FigWebServices::SeedComponents::Protein::get_dna_sequence($parameters);
200 :     delete($parameters->{title});
201 :     delete($parameters->{id});
202 :     $to->add(dna_sequence => "<br/><br/>".$retval->{button} . "&nbsp;&nbsp;" . $retval->{title} . "<br/><br/>" . $retval->{body});
203 :     $parameters->{initial_value} = 'collapsed';
204 :     $retval = FigWebServices::SeedComponents::Protein::get_dna_sequence_adjacent($parameters);
205 :     delete($parameters->{title});
206 :     delete($parameters->{id});
207 :     $to->add(flanked_sequence => "<br/><br/>".$retval->{button} . "&nbsp;&nbsp;" . $retval->{title} . "<br/><br/>" . $retval->{body});
208 : parrello 1.220 $parameters->{initial_value} = 'expanded';
209 : paczian 1.229 $retval = FigWebServices::SeedComponents::Protein::get_assignments_for_identical_proteins($parameters);
210 :     delete($parameters->{title});
211 :     delete($parameters->{id});
212 :     $to->add(related_assignments => "<br/><br/>". $retval->{button} . "&nbsp;&nbsp;" . $retval->{title} . "<br/><br/>" . $retval->{body});
213 :     $parameters->{initial_value} = 'collapsed';
214 :     $retval = FigWebServices::SeedComponents::Protein::get_links($parameters);
215 :     delete($parameters->{title});
216 :     delete($parameters->{id});
217 :     $to->add(subsys_links => "<br/><br/>".$retval->{button} . "&nbsp;&nbsp;" . $retval->{title} . "<br/><br/>" . $retval->{body});
218 :     $parameters->{initial_value} = 'collapsed';
219 :     $retval = FigWebServices::SeedComponents::Protein::get_functional_coupling($parameters);
220 :     delete($parameters->{title});
221 :     delete($parameters->{id});
222 :     $to->add(couplings => "<br/><br/>".$retval->{button} . "&nbsp;&nbsp;" . $retval->{title} . "<br/><br/>" . $retval->{body});
223 :     $parameters->{initial_value} = 'collapsed';
224 :     $retval = FigWebServices::SeedComponents::Protein::get_attributes($parameters);
225 :     delete($parameters->{title});
226 :     delete($parameters->{id});
227 :     $to->add(attributes => "<br/><br/>".$retval->{button} . "&nbsp;&nbsp;" . $retval->{title} . "<br/><br/>" . $retval->{body});
228 :     $parameters->{initial_value} = 'collapsed';
229 :     $retval = FigWebServices::SeedComponents::Protein::get_protein_families($parameters);
230 :     delete($parameters->{title});
231 :     delete($parameters->{id});
232 :     $to->add(families => "<br/><br/>".$retval->{button} . "&nbsp;&nbsp;" . $retval->{title} . "<br/><br/>" . $retval->{body});
233 : parrello 1.226 $to->add("<br/><hr/>") if $to->raw;
234 : parrello 1.223 $to->add(compared_regions => FigWebServices::SeedComponents::Protein::get_compared_regions($parameters));
235 : paczian 1.229 $to->add("<hr/>") if $to->raw;
236 : parrello 1.223 $to->add(pubmed_url => FigWebServices::SeedComponents::Protein::get_pubmed_url($parameters));
237 :     $to->add("<br/><hr/>") if $to->raw;
238 : parrello 1.227 if (is_sprout($cgi)) {
239 :     $to->add(similarities => FigWebServices::SeedComponents::Protein::get_bbhs($parameters));
240 :     } else {
241 : paczian 1.229 $parameters->{initial_value} = 'expanded';
242 :     $retval = FigWebServices::SeedComponents::Protein::get_similarities($parameters);
243 :     delete($parameters->{title});
244 :     delete($parameters->{id});
245 :     $to->add(similarities => $retval->{title} . "<br/><br/>" . $retval->{form} . "<br/>" . $retval->{body});
246 : parrello 1.227 }
247 : parrello 1.223 $to->add("<br/><hr/>") if $to->raw;
248 : paczian 1.229 $parameters->{initial_value} = 'expanded';
249 :     $retval = FigWebServices::SeedComponents::Protein::get_tools($parameters);
250 :     delete($parameters->{title});
251 :     delete($parameters->{id});
252 :     $to->add(tools => $retval->{body});
253 : parrello 1.220 $parameters->{noheadline} = undef;
254 :     }
255 :    
256 : parrello 1.223 $to->add("<br/><hr/>" . FigWebServices::SeedComponents::Protein::get_index_link()) if $to->raw;
257 : parrello 1.220
258 : parrello 1.223 print $to->finish();
259 : overbeek 1.2 }
260 : redwards 1.160 }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3