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

Diff of /FigWebServices/genome_statistics.cgi

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

revision 1.20, Tue Aug 9 14:44:58 2005 UTC revision 1.21, Tue Aug 9 18:12:16 2005 UTC
# Line 68  Line 68 
68          push(@$html,$cgi->hr);          push(@$html,$cgi->hr);
69          &kv_stats($fig, $cgi, $html, $genome);          &kv_stats($fig, $cgi, $html, $genome);
70          my $user = $cgi->param('user');          my $user = $cgi->param('user');
71          push(@$html,"<a href=./genome_statistics.cgi?genome=$genome&request=show_subsystems&user=$user>Show Subsystems</a>");          push(@$html,"<a href=./genome_statistics.cgi?genome=$genome&request=show_subsystems&user=$user>Show Subsystems</a><br>\n");
72            push(@$html,"<a href=./genome_statistics.cgi?genome=$genome&request=show_reactions&user=$user>Show Reactions</a><br>\n");
73          push(@$html,$cgi->br);          push(@$html,$cgi->br);
74      }      }
75  }  }
# Line 83  Line 84 
84      elsif ($request eq "nothypo_sub")       { &handle_nothypo_sub($fig,$cgi,$html,$genomes[0]) }      elsif ($request eq "nothypo_sub")       { &handle_nothypo_sub($fig,$cgi,$html,$genomes[0]) }
85      elsif ($request eq "nothypo_nosub")     { &handle_nothypo_nosub($fig,$cgi,$html,$genomes[0]) }      elsif ($request eq "nothypo_nosub")     { &handle_nothypo_nosub($fig,$cgi,$html,$genomes[0]) }
86      elsif ($request eq "show_subsystems")   { &handle_show_subsystems($fig,$cgi,$html,$genomes[0]) }      elsif ($request eq "show_subsystems")   { &handle_show_subsystems($fig,$cgi,$html,$genomes[0]) }
87        elsif ($request eq "show_reactions")    { &handle_show_reactions($fig,$cgi,$html,$genomes[0]) }
88      else      else
89      {      {
90          push(@$html,$cgi->h1("Invalid request: $request"));          push(@$html,$cgi->h1("Invalid request: $request"));
# Line 249  Line 251 
251      }      }
252  }  }
253    
254    sub handle_show_reactions {
255        my($fig,$cgi,$html,$genome) = @_;
256        my($react_for_role,$r,%topic,%reaction,$sub,$role,$protein,$sub_link,$tuple,$categories);
257        my(%reactions_for_sub,%class,$reactions,$classL,$category);
258    
259        my($subsystem_data,$assignments_data) = &get_data($fig,$cgi,$genome);
260        foreach $_ (@$subsystem_data)
261        {
262            ($sub,$role,$protein) = @$_;
263            if (! defined($reactions_for_sub{$sub}))
264            {
265                my $subsystem = new Subsystem($sub,$fig,0);
266                $reactions = $subsystem->get_reactions;
267                $reactions = $reactions ? $reactions : "";
268                $reactions_for_sub{$sub} = $reactions;
269                $class{$sub} = $fig->subsystem_classification($sub);
270            }
271    
272            if (($reactions = $reactions_for_sub{$sub}) && ($react_for_role = $reactions->{$role}))
273            {
274                $classL = $class{$sub};
275                $category = ((@$classL > 0) && $classL->[0]) ? $classL->[0] : "Misc";
276                foreach $r (@$react_for_role)
277                {
278                    $reaction{$r}->{$protein} = 1;
279                    push(@{$topic{$category}},$r);
280                }
281            }
282        }
283    
284        my @all       = sort { $a cmp $b } keys(%topic);
285        foreach $category (@all)
286        {
287            &show_class_react($fig,$cgi,$html,$category,$topic{$category},\%reaction);
288        }
289    
290        if ($_ = $topic{"Misc"})
291        {
292            &show_class_react($fig,$cgi,$html,'Misc',$_,\%reaction);
293        }
294    }
295    
296    sub show_class_react {
297        my($fig,$cgi,$html,$class,$for_topic,$reaction) = @_;
298        my($r,@pegs,$peg);
299    
300        push(@$html,$cgi->h1($class));
301        foreach $r (@$for_topic)
302        {
303            my $disp_react = $fig->displayable_reaction($r);
304            $disp_react =~ s/^R\d+\: //;
305    
306            my $rstring = &HTML::reaction_link($r) . ": $disp_react";
307            push(@$html,$cgi->h2($rstring),"\n");
308            @pegs = sort { &FIG::by_fig_id($a,$b) } keys(%{$reaction->{$r}});
309            push(@$html,"<ul>\n");
310            foreach $peg (@pegs)
311            {
312                push(@$html,"<li>" . &HTML::fid_link($cgi,$peg) . " " . scalar $fig->function_of($peg) . "\n");
313            }
314            push(@$html,"</ul>\n");
315        }
316    }
317    
318  sub handle_hypo_sub {  sub handle_hypo_sub {
319      my($fig,$cgi,$html,$genome) = @_;      my($fig,$cgi,$html,$genome) = @_;
320    

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3