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

Annotation of /FigWebServices/protein.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.225 - (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 : parrello 1.220
102 :     my $parameters = { fig_object => $fig,
103 : parrello 1.223 peg_id => $pegID,
104 : parrello 1.220 table_style => 'plain',
105 :     fig_disk => $FIG_Config::fig_disk . "/",
106 :     form_target => 'protein.cgi'
107 :     };
108 :    
109 :     my ($min, $max, $features) = FigWebServices::SeedComponents::Protein::get_region_data($parameters);
110 :     $parameters->{min} = $min;
111 :     $parameters->{max} = $max;
112 :     $parameters->{features} = $features;
113 :    
114 : parrello 1.223 # Format the header information.
115 :     $to->titles($parameters);
116 :     # Spit out an index link.
117 :     $to->add("<br/>" . FigWebServices::SeedComponents::Protein::get_index_link() . "<br/>") if $to->raw;
118 :     $to->add(FigWebServices::SeedComponents::Framework::get_js_css_links()) if $to->raw;
119 : parrello 1.220
120 :     # check for request parameter
121 :     my $request = $cgi->param("request") || "";
122 :    
123 : parrello 1.223 # check for quick assign. Quick assigns do not work in Sprout, but if we're in Sprout and a
124 :     # fast assign is requested, we've already crashed when we tried to create the template.
125 : parrello 1.220 if ($request eq "fast_assign") {
126 : parrello 1.223 &FigWebServices::SeedComponents::Protein::make_assignment($fig,$cgi,$pegID);
127 : parrello 1.220 $request = "";
128 :     }
129 :    
130 :     if ($request eq "view_annotations") {
131 : parrello 1.223 $to->add(results => &FigWebServices::SeedComponents::Protein::view_annotations($fig,$cgi,$pegID));
132 : parrello 1.220 } elsif ($request eq "view_all_annotations") {
133 : parrello 1.223 $to->add(results => &FigWebServices::SeedComponents::Protein::view_all_annotations($fig,$cgi,$pegID));
134 : parrello 1.220 } elsif ($request eq "show_coupling_evidence") {
135 : parrello 1.223 $to->add(results => &FigWebServices::SeedComponents::Protein::show_coupling_evidence($fig,$cgi,$pegID));
136 : parrello 1.220 } elsif ($request eq "abstract_coupling") {
137 : parrello 1.223 $to->add(results => &FigWebServices::SeedComponents::Protein::show_abstract_coupling_evidence($fig,$cgi,$pegID));
138 : parrello 1.220 } elsif ($request eq "ec_to_maps") {
139 : parrello 1.223 $to->add(results => &FigWebServices::SeedComponents::Protein::show_ec_to_maps($fig,$cgi));
140 : parrello 1.220 } elsif ($request eq "link_to_map") {
141 : parrello 1.223 $to->add(results => &FigWebServices::SeedComponents::Protein::link_to_map($fig,$cgi));
142 : parrello 1.220 } elsif ($request eq "fusions") {
143 : parrello 1.223 $to->add(results => &FigWebServices::SeedComponents::Protein::show_fusions($fig,$cgi,$pegID));
144 :     } else {
145 : paczian 1.225 # this has to be done to support calls to previous or next peg
146 :     my $adjust = $cgi->param('previous PEG') ? -1 : $cgi->param('next PEG') ? 1 : 0;
147 :     if ( $adjust ) {
148 :     my ( $prefix, $protnum ) = $pegID =~ /^(.*\.)(\d+)$/;
149 :     if ( $prefix && $protnum ) {
150 :     my $prot2 = $prefix . ($protnum + $adjust);
151 :     if ( $fig->translatable($prot2 ) ) {
152 :     $pegID = $prot2;
153 :     $cgi->delete('prot');
154 :     $cgi->param(-name => 'prot', -value => $pegID);
155 :     $parameters->{peg_id} = $pegID;
156 :     }
157 :     }
158 :     ( $adjust < 0 ) && $cgi->delete('previous PEG');
159 :     ( $adjust > 0 ) && $cgi->delete('next PEG');
160 :     }
161 :    
162 : parrello 1.223 # normal page shown.
163 :     $to->add(title => FigWebServices::SeedComponents::Protein::get_title($parameters));
164 :     $to->add(assign => FigWebServices::SeedComponents::Protein::get_current_assignment($parameters));
165 :     $to->add("<hr/>") if $to->raw;
166 :     $to->add(translink => FigWebServices::SeedComponents::Protein::get_translation_link());
167 :     $to->add("<hr/>") if $to->raw;
168 :     $to->add(context_graphic => FigWebServices::SeedComponents::Protein::get_peg_view($parameters));
169 :     $to->add(context_table => FigWebServices::SeedComponents::Protein::get_chromosome_context($parameters));
170 :     $to->add("<br />") if $to->raw;
171 : parrello 1.224 $to->add(annotation_links => FigWebServices::SeedComponents::Protein::get_annotation_links($parameters));
172 :     $to->add("<hr/><br/>") if $to->raw;
173 : parrello 1.220 $parameters->{initial_value} = 'expanded';
174 : parrello 1.223 $to->add(subsys_connections => FigWebServices::SeedComponents::Protein::get_subsystem_connections($parameters));
175 : parrello 1.220 $parameters->{initial_value} = 'collapsed';
176 : parrello 1.223 $to->add(protein_sequence => FigWebServices::SeedComponents::Protein::get_aa_sequence($parameters));
177 : parrello 1.220 $parameters->{initial_value} = 'collapsed';
178 : parrello 1.223 $to->add(dna_sequence => FigWebServices::SeedComponents::Protein::get_dna_sequence($parameters));
179 : parrello 1.220 $parameters->{initial_value} = 'collapsed';
180 : parrello 1.223 $to->add(flanked_sequence => FigWebServices::SeedComponents::Protein::get_dna_sequence_adjacent($parameters));
181 : parrello 1.220 $parameters->{initial_value} = 'expanded';
182 : parrello 1.223 $to->add(related_assignments => FigWebServices::SeedComponents::Protein::get_assignments_for_identical_proteins($parameters));
183 : parrello 1.220 $parameters->{initial_value} = 'collapsed';
184 : parrello 1.223 $to->add(subsys_links => FigWebServices::SeedComponents::Protein::get_links($parameters));
185 : parrello 1.220 $parameters->{initial_value} = 'collapsed';
186 : parrello 1.223 $to->add(couplings => FigWebServices::SeedComponents::Protein::get_functional_coupling($parameters));
187 : parrello 1.220 $parameters->{initial_value} = 'collapsed';
188 : parrello 1.223 $to->add(attributes => FigWebServices::SeedComponents::Protein::get_attributes($parameters));
189 : parrello 1.220 $parameters->{initial_value} = 'collapsed';
190 : parrello 1.223 if (is_sprout($cgi)) {
191 :     my $link = "<p><a href=\"proteinfamilies.cgi?user=$user&prot=$pegID&equivalence=1\">Explore Protein Families for $pegID</a></p>";
192 :     $to->add(families => $link);
193 :     } else {
194 :     $to->add(families => FigWebServices::SeedComponents::Protein::get_protein_families($parameters));
195 :     $to->add("<br/><hr/>") if $to->raw;
196 : parrello 1.220 }
197 : parrello 1.223 $to->add(compared_regions => FigWebServices::SeedComponents::Protein::get_compared_regions($parameters));
198 :     $to->add("<br/><hr/>") if $to->raw;
199 :     $to->add(pubmed_url => FigWebServices::SeedComponents::Protein::get_pubmed_url($parameters));
200 :     $to->add("<br/><hr/>") if $to->raw;
201 :     $to->add(similarities => FigWebServices::SeedComponents::Protein::get_similarities($parameters));
202 :     $to->add("<br/><hr/>") if $to->raw;
203 : parrello 1.220 $parameters->{noheadline} = 1;
204 : parrello 1.223 $to->add(tools => FigWebServices::SeedComponents::Protein::get_tools($parameters));
205 : parrello 1.220 $parameters->{noheadline} = undef;
206 :     }
207 :    
208 : parrello 1.223 $to->add("<br/><hr/>" . FigWebServices::SeedComponents::Protein::get_index_link()) if $to->raw;
209 : parrello 1.220
210 : parrello 1.223 print $to->finish();
211 : overbeek 1.2 }
212 : redwards 1.160 }
213 :    
214 : paczian 1.218 sub show_standard {
215 : overbeek 1.141
216 :     }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3