[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.7, Sat Dec 18 13:03:01 2004 UTC revision 1.8, Mon Jan 10 13:09:01 2005 UTC
# Line 40  Line 40 
40  my $html = [];  my $html = [];
41  unshift @$html, "<TITLE>The SEED Statistics Page</TITLE>\n";  unshift @$html, "<TITLE>The SEED Statistics Page</TITLE>\n";
42    
43  my $genome = $cgi->param('genome');  my @genomes = $cgi->param('genome');
44  if ((! $genome) || (! -d "$FIG_Config::organisms/$genome"))  my $request = $cgi->param('request');
45    if ((@genomes == 0) && (! $request))
46  {  {
47      unshift @$html, "<TITLE>The SEED Statistics Page</TITLE>\n";      &table_of_genomes($fig,$cgi,$html);
     push(@$html,"<h1>Sorry, you need to specify a valid genome</h1>\n");  
     &HTML::show_page($cgi,$html);  
     exit;  
48  }  }
49    elsif (! $request)
50  my $request = $cgi->param('request');  {
51  if (! $request)      my $genome;
52        foreach $genome (@genomes)
53  {  {
54      &basic_stats($fig,$cgi,$html,$genome);      &basic_stats($fig,$cgi,$html,$genome);
55      push(@$html,$cgi->hr);      push(@$html,$cgi->hr);
# Line 58  Line 57 
57      push(@$html,$cgi->hr);      push(@$html,$cgi->hr);
58      my $user = $cgi->param('user');      my $user = $cgi->param('user');
59      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>");
60            push(@$html,$cgi->br);
61        }
62  }  }
63  elsif ($request eq "hypo_sub")          { &handle_hypo_sub($fig,$cgi,$html,$genome) }  elsif (@genomes == 0)
64  elsif ($request eq "hypo_nosub")        { &handle_hypo_nosub($fig,$cgi,$html,$genome) }  {
65  elsif ($request eq "nothypo_sub")       { &handle_nothypo_sub($fig,$cgi,$html,$genome) }      unshift @$html, "<TITLE>The SEED Statistics Page</TITLE>\n";
66  elsif ($request eq "nothypo_nosub")     { &handle_nothypo_nosub($fig,$cgi,$html,$genome) }      push(@$html,"<h1>Sorry, you need to specify at least one valid genome</h1>\n");
67  elsif ($request eq "show_subsystems")   { &handle_show_subsystems($fig,$cgi,$html,$genome) }      &HTML::show_page($cgi,$html);
68        exit;
69    }
70    else
71    {
72        if ($request eq "hypo_sub")          { &handle_hypo_sub($fig,$cgi,$html,$genomes[0]) }
73        elsif ($request eq "hypo_nosub")        { &handle_hypo_nosub($fig,$cgi,$html,$genomes[0]) }
74        elsif ($request eq "nothypo_sub")       { &handle_nothypo_sub($fig,$cgi,$html,$genomes[0]) }
75        elsif ($request eq "nothypo_nosub")     { &handle_nothypo_nosub($fig,$cgi,$html,$genomes[0]) }
76        elsif ($request eq "show_subsystems")   { &handle_show_subsystems($fig,$cgi,$html,$genomes[0]) }
77  else  else
78  {  {
79      push(@$html,$cgi->h1("Invalid request: $request"));      push(@$html,$cgi->h1("Invalid request: $request"));
80  }  }
81    }
82  &HTML::show_page($cgi,$html);  &HTML::show_page($cgi,$html);
83  exit;  exit;
84    
85  sub basic_stats {  sub basic_stats {
86      my($fig,$cgi,$html,$genome) = @_;      my($fig,$cgi,$html,$genome) = @_;
87    
88      my $rdbH = $fig->db_handle;      my($gname,$szdna,$num_contigs,$pegs,$rnas,$taxonomy) = &get_basic_stats($fig,$genome);
     my $relational_db_response = $rdbH->SQL("SELECT gname,szdna,pegs,rnas,taxonomy FROM genome WHERE genome = '$genome'");  
     my($gname,$szdna,$pegs,$rnas,$taxonomy) = @{$relational_db_response->[0]};  
     $szdna = &commify($szdna);  
89      push(@$html,$cgi->h1('Basic Statistics'));      push(@$html,$cgi->h1('Basic Statistics'));
90      push(@$html,$cgi->br,      push(@$html,$cgi->br,
91                    "<b>Genome ID:</b> $genome",$cgi->br,
92                  "<b>Name:</b> $gname",$cgi->br,                  "<b>Name:</b> $gname",$cgi->br,
93                  "<b>Size (bp):</b> $szdna",$cgi->br,                  "<b>Size (bp):</b> $szdna",$cgi->br,
94                    "<b>Number contigs:</b> $num_contigs",$cgi->br,
95                  "<b>Number CDSs:</b> $pegs",$cgi->br,                  "<b>Number CDSs:</b> $pegs",$cgi->br,
96                  "<b>Number rnas:</b> $rnas",$cgi->br,                  "<b>Number rnas:</b> $rnas",$cgi->br,
97                  "<b>Taxonomy:</b> $taxonomy",$cgi->br                  "<b>Taxonomy:</b> $taxonomy",$cgi->br
# Line 265  Line 275 
275      }      }
276      return $sub_link;      return $sub_link;
277  }  }
278    
279    sub get_basic_stats {
280        my($fig,$genome) = @_;
281    
282        my $rdbH = $fig->db_handle;
283        my $relational_db_response = $rdbH->SQL("SELECT gname,szdna,pegs,rnas,taxonomy FROM genome WHERE genome = '$genome'");
284        my($gname,$szdna,$pegs,$rnas,$taxonomy) = @{$relational_db_response->[0]};
285        my $szdna = &commify($szdna);
286        my $num_contigs = scalar $fig->all_contigs($genome);
287        return ($gname,$szdna,$num_contigs,$pegs,$rnas,$taxonomy);
288    }
289    
290    sub table_of_genomes {
291        my($fig,$cgi,$html) = @_;
292        my(@genomes);
293    
294        push(@$html,"<pre>\n");
295        if ($cgi->param('complete'))
296        {
297            @genomes = $fig->genomes("complete");
298        }
299        else
300        {
301            @genomes = $fig->genomes;
302        }
303    
304        my $genome;
305        push(@$html,join("\t","Genome ID","Complete","Genome Name","Size (bp)","Number Contigs","CDSs","RNAs","Taxonomy") . "\n");
306        my $genome;
307        foreach $genome (@genomes)
308        {
309            push(@$html,join("\t",($genome,$fig->is_complete($genome),&get_basic_stats($fig,$genome))) . "\n");
310        }
311        push(@$html,"</pre>\n");
312    }
313    
314    

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3