[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.17, Thu Aug 4 21:06:05 2005 UTC revision 1.18, Thu Aug 4 22:35:28 2005 UTC
# Line 6  Line 6 
6    
7  use HTML;  use HTML;
8  use strict;  use strict;
9    use CGI::Carp qw(fatalsToBrowser);
10  use CGI;  use CGI;
11  my $cgi = new CGI;  my $cgi = new CGI;
12    use raelib;
13    
14    
15  if (0)  if (0)
16  {  {
# Line 43  Line 46 
46    
47  my @genomes = $cgi->param('genome');  my @genomes = $cgi->param('genome');
48  my $request = $cgi->param('request');  my $request = $cgi->param('request');
49    my $user = $cgi->param('user');
50    
51  if ($request eq "subsystems_summary")  if ($request eq "subsystems_summary")
52  {  {
# Line 71  Line 75 
75          &kv_peg_stats($fig, $cgi, $html, $genome);          &kv_peg_stats($fig, $cgi, $html, $genome);
76          push(@$html,$cgi->hr);          push(@$html,$cgi->hr);
77          &kv_stats($fig, $cgi, $html, $genome);          &kv_stats($fig, $cgi, $html, $genome);
78          my $user = $cgi->param('user');          push(@$html,"<p><a href=./genome_statistics.cgi?genome=$genome&request=show_subsystems&user=$user>Show Subsystems</a></p>");
79          push(@$html,"<a href=./genome_statistics.cgi?genome=$genome&request=show_subsystems&user=$user>Show Subsystems</a>");          push(@$html,"<p><a href=./genome_statistics.cgi?genome=$genome&request=subsystems_by_homology&user=$user>Count Proteins in Subsystems</a></p>");
80          push(@$html,$cgi->br);          push(@$html,$cgi->br);
81      }      }
82  }  }
# Line 525  Line 529 
529    
530  sub subsys_homol {  sub subsys_homol {
531   my ($fig,$cgi,$html, $genome)=@_;   my ($fig,$cgi,$html, $genome)=@_;
532    
533     if (!$genome && $cgi->param('korgs')) {$genome=$cgi->param('korgs')}
534     if (!$genome) {push @$html, 'Please specify a genome\n'; return}
535    
536   # here we are going to get some subsystems based on what genes are present and what they are homologous to   # here we are going to get some subsystems based on what genes are present and what they are homologous to
537   my ($maxN, $maxP)=(($cgi->param('maxN') or 50), ($cgi->param('maxP') or 1e-20));   my ($maxN, $maxP)=(($cgi->param('maxN') or 5), ($cgi->param('maxP') or 1e-20));
538     my $sscount;
539   foreach my $peg ($fig->pegs_of($genome)) {   foreach my $peg ($fig->pegs_of($genome)) {
540    map {$sscount->{$_}->{'Annotated'}++} $fig->subsystems_for_peg($peg);    map {$sscount->{$_->[0]}->{'Annotated'}++} $fig->subsystems_for_peg($peg);
541    map {map {$sscount->{$_}->{'Homology'}++} $fig->subsystems_for_peg($_->[1])} $fig->sims($peg, $maxN, $maxP, 'fig');    map {map {$sscount->{$_->[0]}->{'Homology'}->{$peg}++} $fig->subsystems_for_peg($_->[1])} $fig->sims($peg, $maxN, $maxP, 'fig');
542   }   }
543    
544   my $col_hdrs=["Susbystems by Annotation", "Number of proteins", "Subsystems by Homology", "Number of Proteins"];   my %label;
545     my @ss=sort {$a cmp $b} keys %$sscount;
546     my @labels=raelib->subsys_names_for_display(@ss);
547     foreach my $i (0 .. @ss) {$label{$ss[$i]}=$labels[$i]}
548    
549     my $col_hdrs=["Susbystems", "Proteins in subsystem", "Proteins by<br>homology to other<br>proteins in subsystems"];
550   my $tab=[];   my $tab=[];
551   foreach my $ss (keys %$sscount) {   foreach my $ss (@ss) {
552    my @row;    $sscount->{$ss}->{"Homology"}={} unless (exists $sscount->{$ss}->{"Homology"});
553    if ($sscount->{$ss}->{"Annotated"}) {push @row, ($ss, $sscount->{$ss}->{"Annotated"})}    my @row=("<a href='/FIG/subsys.cgi?user=$user&ssa_name=$ss&request=show_ssa&can_alter=&check=&sort=by_phylo&show_clusters=1' target='_blank'>$label{$ss}</a>");
554    else {push @row, [" &nbsp; ", "td colspan=2"]}    push @row, ($sscount->{$ss}->{"Annotated"} or 0), scalar(keys %{$sscount->{$ss}->{"Homology"}});
   if ($sscount->{$ss}->{"Homology"}) {push @row, ($ss, $sscount->{$ss}->{"Homology"})}  
   else {push @row, [" &nbsp; ", "td colspan=2"]}  
555    push @$tab, \@row;    push @$tab, \@row;
556   }   }
557   push(@$html,&HTML::make_table($col_hdrs,$tab,"Subsystems in $genome");   my $title="Pegs in " . $fig->genus_species($genome) ." ($genome) that are, or could, be in subsystems";
558     push @$html, "<h2>Pegs In Subsystems</h2><p>These are the numbers of proteins in subsystems or that could be in subsystems",
559      ".\n The scond column is the number of proteins that are actually in subsystems. ",
560      "\nThe third column is the number of proteins that are similar to a protein in that subsystem ",
561      " (with a cutoff of $maxP and only looking through $maxN sims for each protein).\n",
562      "<br>You can change these numbers below, but be careful -- more sims means the searching will take a lot longer and may time out!</p>",
563      &HTML::make_table($col_hdrs,$tab,$title),
564      $cgi->start_form(), $cgi->hidden("request"), $cgi->p,
565      "<table border=0><tr><td>Enter the max number of similarities to look through:</td><td>",
566      $cgi->textfield(-name=>"maxN", -value=>$maxN, -size=>2), "</td></tr>\n<tr><td>Enter the maximum E value:</td><td>",
567      $cgi->textfield(-name=>"maxP", -value=>$maxP, -size=>6), "</td></tr></table>\n", $cgi->p,
568      raelib->scrolling_org_list($cgi, 0, $genome), $cgi->p, $cgi->submit, $cgi->reset, $cgi->end_form;
569    
570  }  }
571    
572    

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3