[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.5, Tue Oct 26 14:01:00 2004 UTC revision 1.6, Wed Oct 27 02:51:43 2004 UTC
# Line 56  Line 56 
56      push(@$html,$cgi->hr);      push(@$html,$cgi->hr);
57      &assignment_stats($fig,$cgi,$html,$genome);      &assignment_stats($fig,$cgi,$html,$genome);
58      push(@$html,$cgi->hr);      push(@$html,$cgi->hr);
59      push(@$html,"<a href=./genome_statistics.cgi?genome=$genome&request=show_subsystems>Show Subsystems</a>");      my $user = $cgi->param('user');
60        push(@$html,"<a href=./genome_statistics.cgi?genome=$genome&request=show_subsystems&user=$user>Show Subsystems</a>");
61  }  }
62  elsif ($request eq "hypo_sub")          { &handle_hypo_sub($fig,$cgi,$html,$genome) }  elsif ($request eq "hypo_sub")          { &handle_hypo_sub($fig,$cgi,$html,$genome) }
63  elsif ($request eq "hypo_nosub")        { &handle_hypo_nosub($fig,$cgi,$html,$genome) }  elsif ($request eq "hypo_nosub")        { &handle_hypo_nosub($fig,$cgi,$html,$genome) }
# Line 111  Line 112 
112      my $nothypo_sub = 0;      my $nothypo_sub = 0;
113      my $nothypo_nosub = 0;      my $nothypo_nosub = 0;
114    
115        my($subsystem_data,$assignments_data) = &get_data($fig,$cgi,$genome);
116        my %in = map { $_->[2] => 1 } @$subsystem_data;
117        my $in = keys(%in);
118    
119      my $relational_db_response = $rdbH->SQL("SELECT DISTINCT protein FROM subsystem_index WHERE ( protein like 'fig\|$genome.peg.%')");      foreach $_ (@$assignments_data)
   
     my $in = @$relational_db_response;  
     my %in = map { $_->[0] => 1 } @$relational_db_response;  
   
   
     $relational_db_response = $rdbH->SQL("SELECT prot,assigned_function FROM assigned_functions WHERE ( prot like 'fig\|$genome.peg.%' AND made_by = 'master' )");  
   
     foreach $_ (@$relational_db_response)  
120      {      {
121          my($peg,$func) = @$_;          my($peg,$func) = @$_;
122          my $is_hypo = &FIG::hypo($func);          my $is_hypo = &FIG::hypo($func);
# Line 136  Line 132 
132      my $fracHNS = sprintf "%4.2f", $hypo_nosub / $tot;      my $fracHNS = sprintf "%4.2f", $hypo_nosub / $tot;
133      my $fracNHNS = sprintf "%4.2f", $nothypo_nosub / $tot;      my $fracNHNS = sprintf "%4.2f", $nothypo_nosub / $tot;
134    
135        my $user = $cgi->param('user');
136    
137      push(@$html,"<b>PEGs with hypothetical functions and in subsystem:</b> <a href=./genome_statistics.cgi?genome=$genome&request=hypo_sub>$hypo_sub ($fracHS)</a>",$cgi->br,      push(@$html,"<b>PEGs with hypothetical functions and in subsystem:</b> <a href=./genome_statistics.cgi?user=$user&genome=$genome&request=hypo_sub>$hypo_sub ($fracHS)</a>",$cgi->br,
138                  "<b>PEGs with nonhypothetical functions and in subsystem:</b> <a href=./genome_statistics.cgi?genome=$genome&request=nothypo_sub>$nothypo_sub ($fracNHS)</a>",$cgi->br,                  "<b>PEGs with nonhypothetical functions and in subsystem:</b> <a href=./genome_statistics.cgi?user=$user&genome=$genome&request=nothypo_sub>$nothypo_sub ($fracNHS)</a>",$cgi->br,
139                  "<b>PEGs with hypothetical functions and not in subsystem:</b> <a href=./genome_statistics.cgi?genome=$genome&request=hypo_nosub>$hypo_nosub ($fracHNS)</a>",$cgi->br,                  "<b>PEGs with hypothetical functions and not in subsystem:</b> <a href=./genome_statistics.cgi?user=$user&genome=$genome&request=hypo_nosub>$hypo_nosub ($fracHNS)</a>",$cgi->br,
140                  "<b>PEGs with nonhypothetical functions and not in subsystem:</b> <a href=./genome_statistics.cgi?genome=$genome&request=nothypo_nosub>$nothypo_nosub ($fracNHNS)</a>",$cgi->br                  "<b>PEGs with nonhypothetical functions and not in subsystem:</b> <a href=./genome_statistics.cgi?user=$user&genome=$genome&request=nothypo_nosub>$nothypo_nosub ($fracNHNS)</a>",$cgi->br
141           );           );
142  }  }
143    
144  sub handle_show_subsystems {  sub handle_show_subsystems {
145      my($fig,$cgi,$html,$genome) = @_;      my($fig,$cgi,$html,$genome) = @_;
146        my(%in,$sub,$role,$protein,$sub_link);
147    
148      my $rdbH = $fig->db_handle;      my($subsystem_data,$assignments_data) = &get_data($fig,$cgi,$genome);
149      my $relational_db_response = $rdbH->SQL("SELECT DISTINCT subsystem FROM subsystem_index WHERE ( protein like 'fig\|$genome.peg.%')");      foreach $_ (@$subsystem_data)
150        {
151      my $col_hdrs = ["subsystem"];          ($sub,$role,$protein) = @$_;
152            push(@{$in{$sub}->{$role}},&HTML::fid_link($cgi,$protein,0) . ": " . scalar $fig->function_of($protein));
153        }
154        foreach $sub (sort keys(%in))
155        {
156            $sub_link = &sub_link($cgi,$sub);
157            push(@$html,$cgi->h2($sub_link));
158            my $roles = [];
159            foreach $role (sort keys(%{$in{$sub}}))
160            {
161                push(@$roles,$cgi->ul($cgi->li($in{$sub}->{$role})));
162            }
163            push(@$html,$cgi->ul($cgi->li($roles)));
164        }
165  }  }
166    
167  sub handle_hypo_sub {  sub handle_hypo_sub {
168      my($fig,$cgi,$html,$genome) = @_;      my($fig,$cgi,$html,$genome) = @_;
169    
170        my($subsystem_data,$assignments_data) = &get_data($fig,$cgi,$genome);
171        my %subs = map { $_->[2] => $_->[0] } @$subsystem_data;
172        my $col_hdrs = ["PEG","Function","Subsystem"];
173        my $tab = [];
174        foreach $_ (@$assignments_data)
175        {
176            my($peg,$func) = @$_;
177            if (&FIG::hypo($func) && ($subs{$peg}))
178            {
179                push(@$tab,[&HTML::fid_link($cgi,$peg,0),$func,&sub_link($cgi,$subs{$peg})]);
180            }
181        }
182        $_ = @$tab;
183        push(@$html,&HTML::make_table($col_hdrs,$tab,"$_ Hypothetical Pegs in Subsystems"));
184  }  }
185    
186  sub handle_hypo_nosub {  sub handle_hypo_nosub {
187      my($fig,$cgi,$html,$genome) = @_;      my($fig,$cgi,$html,$genome) = @_;
188    
189        my($subsystem_data,$assignments_data) = &get_data($fig,$cgi,$genome);
190        my %subs = map { $_->[2] => $_->[0] } @$subsystem_data;
191        my $col_hdrs = ["PEG","Function"];
192        my $tab = [];
193        foreach $_ (@$assignments_data)
194        {
195            my($peg,$func) = @$_;
196            if (&FIG::hypo($func) && (! $subs{$peg}))
197            {
198                push(@$tab,[&HTML::fid_link($cgi,$peg,0),$func]);
199            }
200        }
201        $_ = @$tab;
202        push(@$html,&HTML::make_table($col_hdrs,$tab,"$_ Hypothetical Pegs NOT in Subsystems"));
203  }  }
204    
205  sub handle_nothypo_sub {  sub handle_nothypo_sub {
206      my($fig,$cgi,$html,$genome) = @_;      my($fig,$cgi,$html,$genome) = @_;
207    
208        my($subsystem_data,$assignments_data) = &get_data($fig,$cgi,$genome);
209        my %subs = map { $_->[2] => $_->[0] } @$subsystem_data;
210        my $col_hdrs = ["PEG","Function","Subsystem"];
211        my $tab = [];
212        foreach $_ (@$assignments_data)
213        {
214            my($peg,$func) = @$_;
215            if ((! &FIG::hypo($func)) && ($subs{$peg}))
216            {
217                push(@$tab,[&HTML::fid_link($cgi,$peg,0),$func,&sub_link($cgi,$subs{$peg})]);
218            }
219        }
220        $_ = @$tab;
221        push(@$html,&HTML::make_table($col_hdrs,$tab,"$_ Nonhypothetical Pegs in Subsystems"));
222  }  }
223    
224  sub handle_nothypo_nosub {  sub handle_nothypo_nosub {
225      my($fig,$cgi,$html,$genome) = @_;      my($fig,$cgi,$html,$genome) = @_;
226    
227        my($subsystem_data,$assignments_data) = &get_data($fig,$cgi,$genome);
228        my %subs = map { $_->[2] => $_->[0] } @$subsystem_data;
229        my $col_hdrs = ["PEG","Function"];
230        my $tab = [];
231        foreach $_ (@$assignments_data)
232        {
233            my($peg,$func) = @$_;
234            if ((! &FIG::hypo($func)) && (! $subs{$peg}))
235            {
236                push(@$tab,[&HTML::fid_link($cgi,$peg,0),$func]);
237            }
238        }
239        $_ = @$tab;
240        push(@$html,&HTML::make_table($col_hdrs,$tab,"$_ Nonhypothetical Pegs NOT in Subsystems"));
241    }
242    
243    sub get_data {
244        my($fig,$cgi,$genome) = @_;
245    
246        my $rdbH = $fig->db_handle;
247        my $subsystem_data = $rdbH->SQL("SELECT DISTINCT subsystem,role,protein FROM subsystem_index WHERE ( protein like 'fig\|$genome.peg.%')");
248        my $assignment_data = $rdbH->SQL("SELECT prot,assigned_function FROM assigned_functions WHERE ( prot like 'fig\|$genome.peg.%' AND made_by = 'master' )");
249    
250        return ($subsystem_data,$assignment_data);
251  }  }
252    
253    sub sub_link {
254        my($cgi,$sub) = @_;
255        my($sub_link);
256    
257        my $user = $cgi->param('user');
258        if ($user)
259        {
260            $sub_link = "<a href=./subsys.cgi?ssa_name=$sub&request=show_ssa&user=$user>$sub</a>";
261        }
262        else
263        {
264            $sub_link = $sub;
265        }
266        return $sub_link;
267    }

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3