[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.4, Sun Oct 24 02:45:41 2004 UTC revision 1.5, Tue Oct 26 14:01:00 2004 UTC
# Line 1  Line 1 
1  #### start ####  #### start ####
2    
3  use FIG;  use FIG;
4  my $fig = new FIG;  my $fig = new FIG;
5    
# Line 55  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      &subsystem_stats($fig,$cgi,$html,$genome);      push(@$html,"<a href=./genome_statistics.cgi?genome=$genome&request=show_subsystems>Show Subsystems</a>");
60  }  }
61    elsif ($request eq "hypo_sub")          { &handle_hypo_sub($fig,$cgi,$html,$genome) }
62    elsif ($request eq "hypo_nosub")        { &handle_hypo_nosub($fig,$cgi,$html,$genome) }
63    elsif ($request eq "nothypo_sub")       { &handle_nothypo_sub($fig,$cgi,$html,$genome) }
64    elsif ($request eq "nothypo_nosub")     { &handle_nothypo_nosub($fig,$cgi,$html,$genome) }
65    elsif ($request eq "show_subsystems")   { &handle_show_subsystems($fig,$cgi,$html,$genome) }
66  else  else
67  {  {
68      push(@$html,$cgi->h1("Invalid request: $request"));      push(@$html,$cgi->h1("Invalid request: $request"));
# Line 98  Line 104 
104  sub assignment_stats {  sub assignment_stats {
105      my($fig,$cgi,$html,$genome) = @_;      my($fig,$cgi,$html,$genome) = @_;
106    
107        my $rdbH = $fig->db_handle;
108    
109        my $hypo_sub = 0;
110        my $hypo_nosub = 0;
111        my $nothypo_sub = 0;
112        my $nothypo_nosub = 0;
113    
114    
115        my $relational_db_response = $rdbH->SQL("SELECT DISTINCT protein FROM subsystem_index WHERE ( protein like 'fig\|$genome.peg.%')");
116    
117        my $in = @$relational_db_response;
118        my %in = map { $_->[0] => 1 } @$relational_db_response;
119    
120    
121        $relational_db_response = $rdbH->SQL("SELECT prot,assigned_function FROM assigned_functions WHERE ( prot like 'fig\|$genome.peg.%' AND made_by = 'master' )");
122    
123        foreach $_ (@$relational_db_response)
124        {
125            my($peg,$func) = @$_;
126            my $is_hypo = &FIG::hypo($func);
127    
128            if    ($is_hypo && $in{$peg})           { $hypo_sub++ }
129            elsif ($is_hypo && ! $in{$peg})         { $hypo_nosub++ }
130            elsif ((! $is_hypo) && (! $in{$peg}))   { $nothypo_nosub++ }
131            elsif ((! $is_hypo) && $in{$peg})       { $nothypo_sub++ }
132        }
133        my $tot = $hypo_sub + $nothypo_sub + $hypo_nosub + $nothypo_nosub;
134        my $fracHS = sprintf "%4.2f", $hypo_sub / $tot;
135        my $fracNHS = sprintf "%4.2f", $nothypo_sub / $tot;
136        my $fracHNS = sprintf "%4.2f", $hypo_nosub / $tot;
137        my $fracNHNS = sprintf "%4.2f", $nothypo_nosub / $tot;
138    
139    
140        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,
141                    "<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,
142                    "<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,
143                    "<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
144             );
145    }
146    
147    sub handle_show_subsystems {
148        my($fig,$cgi,$html,$genome) = @_;
149    
150        my $rdbH = $fig->db_handle;
151        my $relational_db_response = $rdbH->SQL("SELECT DISTINCT subsystem FROM subsystem_index WHERE ( protein like 'fig\|$genome.peg.%')");
152    
153        my $col_hdrs = ["subsystem"];
154  }  }
155    
156  sub subsystem_stats {  sub handle_hypo_sub {
157      my($fig,$cgi,$html,$genome) = @_;      my($fig,$cgi,$html,$genome) = @_;
158    
159  }  }
160    
161    sub handle_hypo_nosub {
162        my($fig,$cgi,$html,$genome) = @_;
163    
164    }
165    
166    sub handle_nothypo_sub {
167        my($fig,$cgi,$html,$genome) = @_;
168    
169    }
170    
171    sub handle_nothypo_nosub {
172        my($fig,$cgi,$html,$genome) = @_;
173    
174    }
175    

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3