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

Annotation of /FigWebServices/pir.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.33 - (view) (download)

1 : redwards 1.1 # -*- perl -*-
2 : olson 1.33 #
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 : redwards 1.1
20 :     =pod
21 :    
22 : parrello 1.30 =head1 pir
23 : redwards 1.1
24 :     Compare some data between SEED and PIR. We probably need to add things like p2p or automatic ftp gets or something like that
25 :    
26 :     =cut
27 :    
28 :     use strict;
29 :     use FIG;
30 :     use HTML;
31 :     use raelib;
32 :     use CGI;
33 :     my $cgi=new CGI;
34 : redwards 1.22 use LWP::Simple qw(!head); # see the caveat in perldoc LWP about importing two head methods.
35 : redwards 1.1
36 :     my $fig;
37 :     eval {
38 :     $fig = new FIG;
39 :     };
40 :    
41 :     if ($@ ne "")
42 :     {
43 :     my $err = $@;
44 :    
45 :     my(@html);
46 :    
47 :     push(@html, $cgi->p("Error connecting to SEED database."));
48 :     if ($err =~ /Could not connect to DBI:.*could not connect to server/)
49 :     {
50 :     push(@html, $cgi->p("Could not connect to relational database of type $FIG_Config::dbms named $FIG_Config::db on port $FIG_Config::dbport."));
51 :     }
52 :     else
53 :     {
54 :     push(@html, $cgi->pre($err));
55 :     }
56 :     &HTML::show_page($cgi, \@html, 1);
57 :     exit;
58 :     }
59 :    
60 :    
61 :    
62 :     $ENV{"PATH"} = "$FIG_Config::bin:$FIG_Config::ext_bin:" . $ENV{"PATH"};
63 :    
64 : redwards 1.22
65 :     # these should probably be in FIG::Config. Oh well.
66 :     my $pir_file_from_pir="$FIG_Config::data/Global/pirsfinfo.dat";
67 :     my $pir_correspondence_file="$FIG_Config::data/Global/pirsfcorrespondence.txt";
68 :     my $pir_source_file="ftp://ftp.pir.georgetown.edu/pir_databases/pirsf/data/pirsfinfo.dat";
69 :    
70 :     # ha ha ha ha ha
71 :     # I am an idiot, and can't spell. so we need to correct that and make sure we always use an e
72 :     if (-e "$FIG_Config::data/Global/pirsfcorrespondance.txt") {rename("$FIG_Config::data/Global/pirsfcorrespondance.txt", $pir_correspondence_file)}
73 :    
74 :    
75 :    
76 : redwards 1.1 my $html = [];
77 :     my $user = $cgi->param('user');
78 :    
79 : redwards 1.19 unshift(@$html, "<TITLE>The SEED - PIR/SEED comparisons </TITLE>\n");
80 : redwards 1.1 # make sure that we read the file at the beginning
81 : redwards 1.26
82 :     unless (-e $pir_file_from_pir) {$html=&check_updates($html); &HTML::show_page($cgi,$html,1); exit(0)}
83 : redwards 1.22 my ($pegbypir, $pirid) =&read_pir_file("initial");
84 :    
85 : redwards 1.1
86 :    
87 : redwards 1.17 if ($cgi->param('submit') eq "Tabulate summary") {
88 : redwards 1.9 $html=&table_annotations($html, $pegbypir, $pirid);
89 : redwards 1.22 push @$html, $cgi->p({class=>"diagnostic"}, ("\n<small>Generating this table took approximately " . (time-$^T) . " seconds\n</small>"));
90 :     }
91 : redwards 1.24 elsif ($cgi->param('submit') =~ m/^Update/) {
92 :     # this should catch Update Data and Updata Anyway
93 :     $html=&update_data($html);
94 :     }
95 : redwards 1.28 elsif ($cgi->param('submit') eq "Create Download File") {
96 :     print STDERR "Creating download file\n";
97 :     $html=&create_download_file($html);
98 :     push @$html, $cgi->p({class=>"diagnostic"}, ("\n<small>Generating this table took approximately " . (time-$^T) . " seconds\n</small>"));
99 :     }
100 : redwards 1.22 elsif ($cgi->param('submit') eq "Check for updates") {
101 :     $html=&check_updates($html);
102 :     push @$html, $cgi->p({class=>"diagnostic"}, ("\n<small>Checking for updates took approximately " . (time-$^T) . " seconds\n</small>"));
103 : redwards 1.5 }
104 : redwards 1.17 elsif ($cgi->param('pirsf') && !($cgi->param('submit') eq "Update view")) {
105 : overbeek 1.21 # we want to display one of the correspondences
106 : redwards 1.5 my $selfurl=$cgi->url;
107 : overbeek 1.32 push @$html, $cgi->p, "<a href=\"Html/pir.html#correspondence\" class=\"help\" target=\"pirhelp\">Help on this correspondence table</a>";
108 : redwards 1.22 if ($cgi->param('ssonly')) {push @$html, "<a href=\"$selfurl?pirsf=" . $cgi->param("pirsf") . "&user=$user\">Show All Matches</a>\n"}
109 :     else {push @$html, "<a href=\"$selfurl?pirsf=" . $cgi->param("pirsf") . "&ssonly='1'&user=$user\">Show only matches with a subsystem</a>\n"}
110 : redwards 1.5
111 : overbeek 1.21 my $col_hdrs = ["PIR Superfamily<br><small>Link goes to PIR<small>", "Genome", "UniProt","PEG", "FIG Function", "FIG Subsystem"];
112 : redwards 1.1 my $tab = [];
113 : redwards 1.22
114 :     # figure out the colors
115 : redwards 1.23 my %color;
116 :     {
117 :     my %function_cnt; my $max;
118 :     foreach my $peg (@{$pegbypir->{$cgi->param('pirsf')}}) {
119 :     $function_cnt{scalar $fig->function_of($peg)}++;
120 :     }
121 :    
122 :     my @all_functions=sort {$function_cnt{$b} <=> $function_cnt{$a}} keys %function_cnt;
123 :     my @color=&cool_colors();
124 :    
125 :     for (my $i=0; $i<=$#all_functions; $i++) {
126 :     if ($i > $#color) {$color{$all_functions[$i]}="#FFFFFF"}
127 :     else {$color{$all_functions[$i]}=$color[$i]}
128 :     }
129 : redwards 1.22 }
130 :    
131 : redwards 1.2 foreach my $peg (@{$pegbypir->{$cgi->param('pirsf')}}) {
132 : redwards 1.1 my @sslinks;
133 :     foreach my $subsys ($fig->subsystems_for_peg($peg)) {
134 : redwards 1.22 my $spaced=$$subsys[0];
135 :     $spaced =~ s/_/ /g;
136 :     push @sslinks, $cgi->a({href => "subsys.cgi?&user=$user&ssa_name=" . $$subsys[0] . "&request=show_ssa"}, $spaced);
137 : redwards 1.1 }
138 :    
139 :     my $pirlink=$cgi->param('pirsf');
140 : redwards 1.2 $pirlink =~ /^PIR(SF\d+)/;
141 :     $pirlink="<a href='http://pir.georgetown.edu/sfcs-cgi/new/pirclassif.pl?id=$1'>PIR$1</a>" . $pirid->{$cgi->param('pirsf')};
142 : redwards 1.4 next if ($cgi->param("ssonly") && !(scalar @sslinks));
143 : redwards 1.22 push (@$tab,
144 :     [$pirlink,
145 :     $fig->genus_species($fig->genome_of($peg)),
146 :     &HTML::uni_link($cgi,$fig->to_alias($peg,"uni")),
147 :     &HTML::fid_link($cgi, $peg, 1),
148 : redwards 1.23 [scalar $fig->function_of($peg), "td style=\"background: $color{scalar $fig->function_of($peg)}\""],
149 : redwards 1.22 (join ", ", @sslinks)]
150 :     );
151 : redwards 1.1 }
152 : redwards 1.22 push(@$html,&HTML::make_table($col_hdrs,$tab,"\nCorrespondence between SEED and PIR"));
153 : redwards 1.1 }
154 :     else {
155 :     unshift @$html, "<TITLE>The SEED - PIR comparison page</TITLE>\n";
156 :     &show_initial($fig,$cgi,$html);
157 :     }
158 :    
159 :     &HTML::show_page($cgi,$html,1);
160 :     exit;
161 :    
162 :    
163 :    
164 :    
165 :    
166 :     sub show_initial {
167 :     my ($fig,$cgi,$html)=@_;
168 :     # generate a blank page
169 :     # we want a list of all functions that have >= 1 peg unless we want all
170 :     my $min=10;
171 :     if ($cgi->param("min")) {$min=$cgi->param("min")}
172 :     if ($cgi->param("showall")) {$min=0}
173 :     my $full=1;
174 :     if ($cgi->param("preliminary")) {$full=0}
175 :     # count different subsystems per sf
176 : redwards 1.26 my $textlimit;
177 :     $cgi->param('textlimit') && ($textlimit = $cgi->param('textlimit'));
178 : redwards 1.1 my $ss; my @pirsf;
179 : redwards 1.2 foreach my $sf (keys %$pegbypir) {
180 :     next unless ($pegbypir->{$sf});
181 :     next unless (scalar @{$pegbypir->{$sf}} >= $min);
182 :     next if ($full && $pirid->{$sf} =~ /\(preliminary\)/i);
183 :     next if (!$full && $pirid->{$sf} =~ /\(full/i);
184 : redwards 1.26 next if ($textlimit && !($pirid->{$sf} =~ m/$textlimit/i || $sf =~ m/$textlimit/i));
185 : redwards 1.1 push @pirsf, $sf;
186 :     if ($cgi->param('showsubsys')) {
187 : redwards 1.2 foreach my $peg (@{$pegbypir->{$sf}}) {
188 : redwards 1.1 foreach my $subsys ($fig->subsystems_for_peg($peg)) {
189 :     $ss->{$sf}->{$$subsys[0]}++;
190 :     }
191 :     }
192 :     }
193 :     }
194 : redwards 1.26
195 : redwards 1.1 # now generate the labels
196 :     my $display;
197 :     foreach my $sf (@pirsf) {
198 :     next unless ($sf);
199 : redwards 1.26 my $displayname=$sf . " " . $pirid->{$sf};
200 : redwards 1.1 if (length($displayname) > 50) {$displayname=substr($displayname, 0, 50)}
201 : redwards 1.2 if ($cgi->param('showsubsys')) {$display->{$sf}=$displayname . " [". scalar @{$pegbypir->{$sf}} . "/". (scalar keys %{$ss->{$sf}}) . "]"}
202 :     else {$display->{$sf}=$displayname . " [". scalar @{$pegbypir->{$sf}} . "]"}
203 : redwards 1.1 }
204 :    
205 : redwards 1.27 my $numberpirfams=scalar keys %$display;
206 : redwards 1.26 unshift @pirsf, ''; $display->{''}='';
207 :     my $size=10;
208 : redwards 1.27 if ($numberpirfams < $size) {$size=$numberpirfams}
209 : redwards 1.28
210 :     # info about the file that they can download
211 : redwards 1.29 my $ftpfile='<p>The comparison file has not been built yet. Please proceed.</p>';
212 : redwards 1.28 if (-e "$FIG_Config::temp/seed2pir.txt") {
213 :     my @stat=stat("$FIG_Config::temp/seed2pir.txt");
214 : redwards 1.29 $ftpfile="<p>The comparison file was last built at ". localtime($stat[8]) . "</p>\n".
215 :     "<p>You may download the file from <a href=\"" . $FIG_Config::temp_base . "seed2pir.txt\">seed2pir.txt</a></p>\n";
216 : redwards 1.28 }
217 :    
218 : redwards 1.1 push (@$html, $cgi->start_form(-action => "pir.cgi"),
219 :     $cgi->h2("Please choose your super family"),
220 : redwards 1.22 "\nFirst, please enter a username: ", $cgi->textfield(-name=>"user", -value=>$user), $cgi->p,
221 : overbeek 1.32 "\n<a href=\"Html/pir.html\" class=\"help\" target=\"pirhelp\">Help on SEED/PIR Correspondence</a>",
222 : redwards 1.22 "\nThe list shows the PIR superfamilies. If only one number is shown (default) this is the number of PEGs that map to that superfamily. ",
223 :     "\nIf you choose to show subsystem counts in this menu, you will get two numbers. The first of the two numbers in parenthesis is the number ",
224 :     "\nof PEGs that map to that superfamily, and the second number in parenthesis is the number of <em>different</em> ",
225 :     "\nsubsystems that those PEGs are in.\n", $cgi->p,"\n",
226 : redwards 1.28 $cgi->scrolling_list(-name=>'pirsf', -values=>[keys %$display], -labels=>$display, -size=>$size+1), $cgi->p,"\n",
227 : redwards 1.27 "\nNumber of superfamilies shown: ", $numberpirfams, $cgi->p,"\n",
228 : overbeek 1.32 "\n<a href=\"Html/pir.html#menu\" class=\"help\" target=\"pirhelp\">Help on the menu contents</a>","\n",
229 : redwards 1.22 "\nMinimum number of pegs per PIR superfamily shown in list &nbsp; <input type='text' name='min' value='$min' size=3 />","\n",
230 :     "\nor show all PIR superfamilies: ", $cgi->checkbox(-name=>"showall", -label=>""), $cgi->p,"\n",
231 :     $cgi->checkbox(-name=>"showsubsys", -label=>"Show subsystem counts in list"), $cgi->p,"\n",
232 :     $cgi->checkbox(-name=>"preliminary", -label=>"Show only preliminary PIR superfamilies"), $cgi->p,"\n",
233 : redwards 1.26 "Limit the list to some text: ", $cgi->textfield(-name=>'textlimit', -size=>20), $cgi->p, "\n",
234 :     $cgi->submit('submit', 'Recreate List'),"\n",
235 : redwards 1.22 $cgi->submit('submit', 'Show Correspondence'),"\n",
236 :     $cgi->reset,"\n",
237 :     $cgi->p, $cgi->hr, $cgi->p,"\n",
238 :     $cgi->p("<strong>Generate Data Tables</strong>"),
239 : overbeek 1.32 "<a href=\"Html/pir.html#datatables\" class=\"help\" target=\"pirhelp\">Help on Generating Data Tables</a>",
240 : redwards 1.22 $cgi->p("The data tables are an alternative way to view the data in summary form. For the summary of the comparisons between PIR and SEED annotations, please check here:\n"),
241 :     $cgi->checkbox(-name=>"onlyss", -label=>"Show only those PEGs that are in a subsystem and a superfamily", -checked=>"on"), $cgi->p,"\n",
242 :     $cgi->checkbox(-name=>"totalsort", -label=>"Sort by the total number of different annotations"), $cgi->p,"\n",
243 :     $cgi->submit('submit', 'Tabulate summary'),"\n",
244 :     $cgi->reset,"\n",
245 :     $cgi->p, $cgi->hr, "\n",
246 :     $cgi->p("<strong>Check for Updates</strong>"),"\n",
247 : overbeek 1.32 "<a href=\"Html/pir.html#updates\" class=\"help\" target=\"pirhelp\">Help on updates</a>", "\n",
248 : redwards 1.22 $cgi->p("Please click the button to check the PIR site and see whether there is a new version of the PIR superfamily data you should use"),"\n",
249 :     $cgi->submit('submit', 'Check for updates'),"\n",
250 : redwards 1.28
251 :     $cgi->p, $cgi->hr, $cgi->p,"\n",
252 :     $cgi->p("<strong>Data for PIR</strong>"),
253 : overbeek 1.32 "<a href=\"Html/pir.html#ftpdown\" class=\"help\" target=\"pirhelp\">Help on Data for PIR</a>\n",
254 : redwards 1.29 $ftpfile,
255 : redwards 1.28 $cgi->p("Please click the button to create a new file.\n"),
256 :     $cgi->submit('submit', 'Create Download File'),"\n",
257 :    
258 : redwards 1.1 $cgi->end_form,
259 :     );
260 :    
261 :     }
262 :    
263 :    
264 :    
265 :     =head1 read_pir_file
266 :    
267 :     Read the PIR data file that describes superfamilies and the PIR proteins that have those families.
268 :     The PIR data file is from ftp://ftp.pir.georgetown.edu/pir_databases/pirsf/data/pirsfinfo.dat and
269 :     contains the family name beginning with a > and then a list of PIR ids.
270 :    
271 : redwards 1.2 I split this using the PIRSF\d+ and return two hashes. One that correlates PIRSF\d+ to fig id and one
272 :     that correlates it to superfamily names.
273 : redwards 1.1
274 :     =cut
275 :    
276 :     sub read_pir_file {
277 : redwards 1.22 unless (-e $pir_file_from_pir) {
278 : redwards 1.23 # background the job here
279 :     &update_data($html);
280 :     }
281 : redwards 1.22 # just read the file, convert it to an HTML table and return it
282 :     unless (-e $pir_correspondence_file) {
283 :     #print STDERR "Can't find the correspondence file pirsfcorrespondence.txt so we are going to make it\n";
284 :     raelib->pirsfcorrespondence($pir_file_from_pir, $pir_correspondence_file);
285 : redwards 1.23 push @$html, "<h2 style=\"background: red\">The PIR correspondence file was rebuilt for you</h2>";
286 : redwards 1.1 }
287 : redwards 1.22 open (IN, $pir_correspondence_file) || die "Can't open $pir_correspondence_file";
288 : redwards 1.1 my $pir;
289 : redwards 1.2 my $functions;
290 :     my $id;
291 : redwards 1.1 my $added;
292 :     while (<IN>) {
293 :     chomp;
294 :     if (s/^>//) {
295 :     unless ($added) {
296 :     # we didn't find anything that maps here
297 : redwards 1.2 $pir->{$id}=undef;
298 : redwards 1.1 }
299 : redwards 1.2 /^(PIRSF\d+)\s+(.*?)$/;
300 :     $id=$1;
301 :     $functions->{$id}=$2;
302 : redwards 1.1 undef $added;
303 :     }
304 :     else {
305 : redwards 1.2 my ($pirid, $peg)=split /\t/;
306 : redwards 1.1 next unless ($peg);
307 : redwards 1.2 push @{$pir->{$id}}, $peg;
308 : redwards 1.1 $added=1;
309 :     }
310 :     }
311 : redwards 1.2 return $pir, $functions;
312 : redwards 1.1 }
313 : redwards 1.5
314 : redwards 1.9 =head1 table_annotations
315 : redwards 1.5
316 : redwards 1.9 Return a table sorted by the number of annotations, and list a bunch of stuff
317 : redwards 1.5
318 :     =cut
319 :    
320 : redwards 1.9 sub table_annotations {
321 :     my ($html, $pegbypir, $pirid)=@_;
322 : redwards 1.12 my $count; my $subsystems; my $countinss;
323 : redwards 1.9 foreach my $sf (keys %$pegbypir) {
324 : redwards 1.12 my $function; my $ss; my $functionandss;
325 : redwards 1.9 foreach my $peg (@{$pegbypir->{$sf}}) {
326 : redwards 1.13 my $fn=scalar $fig->function_of($peg);
327 : redwards 1.16 my $newss=0; # this is a boolean to see whether this peg has a subsys associated with it.
328 :     foreach my $subsys ($fig->subsystems_for_peg($peg)) {$ss->{$$subsys[0]}++; $newss++}
329 : redwards 1.13 $function->{$fn}++;
330 : redwards 1.16 $functionandss->{$fn}++ if ($newss);
331 : redwards 1.5 }
332 : redwards 1.9 $subsystems->{$sf}=join "; ", keys %$ss;
333 :     $count->{$sf}=scalar keys %$function;
334 : redwards 1.12 $countinss->{$sf}=scalar keys %$functionandss;
335 : redwards 1.5 }
336 :    
337 : redwards 1.12 my $col_hdrs = ["Number of annotations in subsystems", "Number of SEED annotations", "PIRSF<br><small>(Link goes to SEED/PIR comparison)</small>",
338 : redwards 1.6 "Superfamily name", "Subsystems in superfamily"];
339 : redwards 1.10 my $tab; my $lastcount; my $row;
340 : redwards 1.12 # note we are going to make a new table every 200 or so rows because that way the browsers don't get messed up. We actually increment between two identical counts
341 :     my @superfamilies=sort {$countinss->{$b} <=> $countinss->{$a}} keys %$count;
342 :     if ($cgi->param('totalsort')) {@superfamilies=sort {$count->{$b} <=> $count->{$a}} keys %$count}
343 :     foreach my $sf (@superfamilies) {
344 :     next if ($cgi->param('onlyss') && !($countinss->{$sf}));
345 : redwards 1.10 $row++;
346 : redwards 1.9 if ($lastcount ne $count->{$sf}) {
347 :     $lastcount=$count->{$sf};
348 : redwards 1.12 if ($tab && ($row > 200)) {
349 : redwards 1.10 push(@$html,&HTML::make_table($col_hdrs,$tab,""));
350 : redwards 1.18 my $et=time-$^T;
351 :     print STDERR "pir.cgi: Added to table at $lastcount after $et total seconds\n";
352 : redwards 1.10 $row=0;
353 :     undef $tab;
354 :     }
355 : redwards 1.9 }
356 :     push @$tab, [
357 : redwards 1.22 "\n".$countinss->{$sf},
358 : redwards 1.9 $count->{$sf},
359 : overbeek 1.32 "<a href=\"pir.cgi?pirsf=$sf&ssonly='1'&user='$user'\">$sf</a>",
360 : redwards 1.9 $pirid->{$sf},
361 :     $subsystems->{$sf},
362 :     ];
363 : redwards 1.5 }
364 : redwards 1.6 push(@$html,&HTML::make_table($col_hdrs,$tab,""));
365 : redwards 1.5 return $html;
366 :     }
367 : redwards 1.22
368 :    
369 :     =pod
370 :    
371 :     =head2 check_updates()
372 :    
373 :     Check the PIR remote site and see whether there are updates that we need to get
374 :    
375 :     =cut
376 :    
377 :     sub check_updates {
378 :     my $html=shift;
379 :    
380 :     # first lets see if we can get the times of the updates to see if we have a newer file
381 :     # using LWP::Simple. this is straight from the perldoc
382 :     my ($content_type, $document_length, $remotemtime, $expires, $server)=LWP::Simple::head($pir_source_file);
383 :     my $localmtime=0;
384 :     # if we don't have the file yet, we don't want to panic!
385 :     if (-e $pir_file_from_pir) {
386 :     my @stat=stat($pir_file_from_pir);
387 :     $localmtime=$stat[8];
388 :     }
389 :     # now we are going to translate the difference in times into some English for the website
390 :     if (!$remotemtime) {
391 :     push @$html, $cgi->p({class=>"error"}, "Could not connect to PIR to check the status of the PIR file. Please check the location of $pir_source_file");
392 :     }
393 :     elsif ($remotemtime > $localmtime) {
394 :     # the remote version is newer
395 :     push @$html, $cgi->p("\nThe remote file $pir_source_file is newer than your current file. You should proceed with the update."),
396 :     $cgi->p("\nThe remote file was modified on ". scalar(localtime($remotemtime))),
397 :     $cgi->p("\nThe local file was modified on ". scalar(localtime($localmtime))),
398 :     $cgi->start_form(), $cgi->hidden(-name=>"user", -value=>$user), $cgi->submit('submit', 'Update Data'), $cgi->end_form();
399 :     }
400 :     else {
401 :     # the local version is as new as the remote one.
402 :     push @$html, $cgi->p("\nThe local file is up to date and there is no need to update your source PIR superfamilies."),
403 :     $cgi->p("\nThe remote file was modified on ". scalar(localtime($remotemtime))),
404 :     $cgi->p("\nThe local file was modified on ". scalar(localtime($localmtime))),
405 :     $cgi->start_form(), $cgi->hidden(-name=>"user", -value=>$user), $cgi->submit('submit', 'Update Anyway'), $cgi->end_form();
406 :     }
407 :    
408 :     return $html;
409 :     }
410 :    
411 :    
412 :     =pod
413 :    
414 :     =head2 update_data()
415 :    
416 :     Download the new data file from pir, and generate the correspondence
417 :    
418 :     =cut
419 :    
420 :     sub update_data {
421 :     # rename the old correspondence file. We are going to add a number to the old file so that we keep it, but this should allow us
422 :     # to save the information for a while in case something happens. At somepoint we should probably move these to /tmp or delete them
423 :     # or something.
424 :     my $html=shift;
425 : redwards 1.23
426 :     # here we need to background downloading and installing the data.
427 :     my $bkj=$fig->run_in_background(sub
428 :     {
429 : redwards 1.25 my $time=time;
430 :     print "Loading new PIR superfamily data started at ", scalar(localtime($time)), "\n";
431 : redwards 1.31 system("load_pirsf -p -v");
432 : redwards 1.25 print "Complete at ", scalar(localtime(time)), ". Running took ", (time-$time)/60, " minutes\n";
433 : redwards 1.23 }
434 :     );
435 :    
436 : redwards 1.24 push @$html, "<h2>Downloading and installing new data has started</h2>",
437 :     "<p>The job has started in the background but will likely take some time.<br />\n",
438 : overbeek 1.32 "The job has an ID of $bkj, and you can check it out from the <A href=\"seed_ctl.cgi\">SEED Control Panel</a></p>\n",
439 : redwards 1.24 "<p>You should not use the PIR superfamilies while the job is runnning</p>\n";
440 : redwards 1.28 return $html;
441 :     }
442 : redwards 1.23
443 : redwards 1.28
444 :     sub create_download_file {
445 :     my $html=shift;
446 :     my $bkj=$fig->run_in_background(sub
447 :     {
448 :     my $time=time;
449 :     print "Generating PIR/SEED correspondance from SEED side began at ", scalar(localtime($time)), "\n";
450 :     system("seed2pir > $FIG_Config::temp/seed2pir.txt");
451 :     print "Complete at ", scalar(localtime(time)), ". Running took ", (time-$time)/60, " minutes\n";
452 :     }
453 :     );
454 :    
455 :     push @$html, "<h2>Creating your data has started</h2>",
456 :     "<p>The job has started in the background but will likely take some time.<br />\n",
457 : overbeek 1.32 "The job has an ID of $bkj, and you can check it out from the <A href=\"seed_ctl.cgi\">SEED Control Panel</a></p>\n";
458 : redwards 1.23 return $html;
459 : redwards 1.22 }
460 :    
461 :    
462 : redwards 1.28
463 :    
464 : redwards 1.22
465 :    
466 :    
467 :     sub cool_colors {
468 :     # just an array of "websafe" colors or whatever colors we want to use. Feel free to remove bad colors (hence the lines not being equal length!)
469 :     return (
470 :     '#C0C0C0', '#FF40C0', '#FF8040', '#FF0080', '#FFC040', '#40C0FF', '#40FFC0', '#C08080', '#C0FF00', '#00FF80', '#00C040',
471 :     "#6B8E23", "#483D8B", "#2E8B57", "#008000", "#006400", "#800000", "#00FF00", "#7FFFD4",
472 :     "#87CEEB", "#A9A9A9", "#90EE90", "#D2B48C", "#8DBC8F", "#D2691E", "#87CEFA", "#E9967A", "#FFE4C4", "#FFB6C1",
473 :     "#E0FFFF", "#FFA07A", "#DB7093", "#9370DB", "#008B8B", "#FFDEAD", "#DA70D6", "#DCDCDC", "#FF00FF", "#6A5ACD",
474 :     "#00FA9A", "#228B22", "#1E90FF", "#FA8072", "#CD853F", "#DC143C", "#FF6347", "#98FB98", "#4682B4",
475 :     "#D3D3D3", "#7B68EE", "#FF7F50", "#FF69B4", "#BC8F8F", "#A0522D", "#DEB887", "#00DED1",
476 :     "#6495ED", "#800080", "#FFD700", "#F5DEB3", "#66CDAA", "#FF4500", "#4B0082", "#CD5C5C",
477 :     "#EE82EE", "#7CFC00", "#FFFF00", "#191970", "#FFFFE0", "#DDA0DD", "#00BFFF", "#DAA520",
478 :     "#00FF7F", "#9400D3", "#BA55D3", "#D8BFD8", "#8B4513", "#3CB371", "#5F9EA0", "#4169E1", "#20B2AA", "#8A2BE2", "#ADFF2F",
479 :     "#F0FFFF", "#B0E0E6", "#FF1493", "#B8860B", "#FF0000", "#F08080", "#7FFF00", "#8B0000",
480 :     "#40E0D0", "#0000CD", "#48D1CC", "#8B008B", "#696969", "#AFEEEE", "#FF8C00", "#EEE8AA", "#A52A2A",
481 :     "#FFE4B5", "#B0C4DE", "#FAF0E6", "#9ACD32", "#B22222", "#FAFAD2", "#808080", "#0000FF",
482 :     "#000080", "#32CD32", "#FFFACD", "#9932CC", "#FFA500", "#F0E68C", "#E6E6FA", "#F4A460", "#C71585",
483 :     "#BDB76B", "#00FFFF", "#FFDAB9", "#ADD8E6", "#778899",
484 :     );
485 :     }
486 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3