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

Diff of /FigWebServices/genomebrowser.cgi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3, Thu Feb 3 19:36:47 2005 UTC revision 1.8, Wed Oct 18 21:44:58 2006 UTC
# Line 1  Line 1 
1  # -*- perl -*-  # -*- perl -*-
2    #
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    
20  =pod  =pod
21    
# Line 9  Line 26 
26  =cut  =cut
27    
28  use strict;  use strict;
29    use CGI;
30    use CGI::Carp qw(fatalsToBrowser); # this makes debugging a lot easier by throwing errors out to the browser
31  use FIG;  use FIG;
32  use HTML;  use HTML;
33  use raedraw;  use raedraw;
 use CGI;  
34  my $cgi=new CGI;  my $cgi=new CGI;
35  my $fig;  my $fig;
36  eval {  eval {
# Line 45  Line 63 
63  my $user = $cgi->param('user');  my $user = $cgi->param('user');
64  my $err;  my $err;
65    
66    
67    foreach (@ARGV) {
68     my ($k, $v)=split /\=/;
69     if ($k eq "compare_to") {my @arr=split /\,/, $v; $v=\@arr}
70     $cgi->param(-name=>$k, -value=>$v);
71    }
72    
73  if ($cgi->param('genome')) {  if ($cgi->param('genome')) {
74   # draw the image   # draw the image
75   unshift @$html, "<TITLE>The SEED - Genome Browser </TITLE>\n";   unshift @$html, "<TITLE>The SEED - Genome Browser </TITLE>\n";
76    
77   my %imagefns;   my %imagefns;
78   foreach my $kw   foreach my $kw
79    (qw[width margin top_marg bottom_marg box_height rows box_no_score box_score show_function tick_mark_height genome_lines abrrev stopshort maxn maxp bluescale])    (qw[width margin top_marg bottom_marg box_height rows box_no_score box_score show_function tick_mark_height genome_lines abbrev stopshort
80      maxn maxp bluescale stopshort user])
81   {   {
82    $imagefns{"-".$kw}=$cgi->param($kw);    $imagefns{"-".$kw}=$cgi->param($kw);
83   }   }
# Line 62  Line 88 
88   foreach my $ct ($cgi->param('compare_to')) {   foreach my $ct ($cgi->param('compare_to')) {
89    $ct =~ /\((\d+\.\d+)\)/;    $ct =~ /\((\d+\.\d+)\)/;
90    push @{$imagefns{'-compare_to'}}, $1;    push @{$imagefns{'-compare_to'}}, $1;
   print STDERR "Added $1\n";  
91   }   }
92     if ($cgi->param('subsystems')) {push @{$imagefns{'-compare_to'}}, "subsystems"}
93   if ($cgi->param('pirsf')) {push @{$imagefns{'-compare_to'}}, ['tagvalue', 'pirsf']}   if ($cgi->param('pirsf')) {push @{$imagefns{'-compare_to'}}, ['tagvalue', 'pirsf']}
94   #   #
95   # remember that we also need to pass in scalefactor here if we have one. This should be a tuple of 'pirsf' and the factor   # remember that we also need to pass in scalefactor here if we have one. This should be a tuple of 'pirsf' and the factor
96    
97     if ($ARGV[0]) {
98      print STDERR "These are the compare to's: \n", join "\n", @{$imagefns{'-compare_to'}}, '';
99     }
100    
101   my $image=raedraw->new(%imagefns);   my $image=raedraw->new(%imagefns);
102    
 print STDERR "IMAGE COMPARE TO RETURNS:  ", join "|", @{$image->compareto}, "\n";  
103    
104   my $filename = "$FIG_Config::temp/genomebrowser_$$.svg";   my $filename = "$FIG_Config::temp/genomebrowser_$$.svg";
105   my $url = &FIG::temp_url . "/genomebrowser_$$.svg";   my $url = &FIG::temp_url . "/genomebrowser_$$.svg";
# Line 79  Line 107 
107    
108   my ($width, $height)=$image->write_image($filename);   my ($width, $height)=$image->write_image($filename);
109    
110    
111   push @$html, $cgi->div({class=>"image"}, $cgi->object({class=>"genomebrowser", data=>"$url", width=>"$width", height=>"$height",   push @$html, $cgi->div({class=>"image"}, $cgi->object({class=>"genomebrowser", data=>"$url", width=>"$width", height=>"$height",
112           standby=>"Loading genome browser image, please be patient"},           standby=>"Loading genome browser image, please be patient"},
113           "There should have been an SVG graphic comparing the genomes that you have chosen here, however, you probably need to download ",           "There should have been an SVG graphic comparing the genomes that you have chosen here, however, you probably need to download ",
# Line 93  Line 122 
122   &show_initial($fig,$cgi,$html);   &show_initial($fig,$cgi,$html);
123  }  }
124    
125    push @$err, "Computing this image took " . int((time-$^T)/0.6)/100 . " minutes\n";
126  push @$html, $cgi->div({class=>"errors", style=>"font-size: smaller"}, $cgi->h3("Errors/Diagnoses we caught:"), @$err);  push @$html, $cgi->div({class=>"errors", style=>"font-size: smaller"}, $cgi->h3("Errors/Diagnoses we caught:"), @$err);
127  &HTML::show_page($cgi,$html,1);  &HTML::show_page($cgi,$html,1);
128  exit;  exit;
# Line 122  Line 152 
152     top_marg     => [20,  'top margin'],     top_marg     => [20,  'top margin'],
153     bottom_marg  => [20,  'bottom margin'],     bottom_marg  => [20,  'bottom margin'],
154     box_height   => [10,  'height of the boxes around the pegs'],     box_height   => [10,  'height of the boxes around the pegs'],
155     rows         => [2,   'rows to split the image into'],     rows         => [10,   'split the image into rows'],
156     show_function=> [3,   'show function every n pegs'],     show_function=> [3,   'show function every n pegs'],
157     tick_mark_height=> [3, 'height of the tick marks on the genome line'],     tick_mark_height=> [3, 'height of the tick marks on the genome line'],
158     maxn         => [50, "Max sims"],     maxn         => [5, "Max sims"],
159     maxp         => [1e-5, "Max E-val"],     maxp         => [1e-5, "Max E-val"],
160       stopshort    => [500, "Stop after drawing this many pegs"],
161   );   );
162    
163   my %checkbox=(   my %checkbox=(
# Line 147  Line 178 
178    
179   push @$html, "\n" , $cgi->p, $cgi->div({class=>"advanced"}, $cgi->table($advanced));   push @$html, "\n" , $cgi->p, $cgi->div({class=>"advanced"}, $cgi->table($advanced));
180    
181     push @$html, $cgi->h3("Subsystems"),  $cgi->table($cgi->Tr(
182      $cgi->td([$cgi->checkbox(-name=>'subsystems', -label=>'') . " &nbsp; highlight PEGs in subsystems"])));
183    
184   # now add the table for tag value pairs:   # now add the table for tag value pairs:
185   push @$html, $cgi->h3("Tag value pairs"), $cgi->table($cgi->Tr(   push @$html, $cgi->h3("Tag value pairs"), $cgi->table($cgi->Tr(
186          $cgi->td([$cgi->checkbox(-name=>'pirsf', -label=>'') . " &nbsp; PIR superfamilies", ''])));          $cgi->td([$cgi->checkbox(-name=>'pirsf', -label=>'') . " &nbsp; PIR superfamilies", ''])));
# Line 207  Line 241 
241      #  how they are in the database).  Otherwise, default is Only "complete".      #  how they are in the database).  Otherwise, default is Only "complete".
242      #      #
243      my $req_comp = ( $req_dom_num > $dom_num{ 'Eucarya' } ) ? 'All'      my $req_comp = ( $req_dom_num > $dom_num{ 'Eucarya' } ) ? 'All'
244                   : $cgi->param( 'complete' ) || 'Only "complete"';                   : $cgi->param( $complete ) || 'Only "complete"';
245      my @complete = $cgi->radio_group( -name     => $complete,      my @complete = $cgi->radio_group( -name     => $complete,
246                                        -default  => $req_comp,                                        -default  => $req_comp,
247                                        -override => 1,                                        -override => 1,

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.8

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3