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

Diff of /FigWebServices/proteinfamilies.cgi

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

revision 1.10, Thu Jul 14 20:40:22 2005 UTC revision 1.11, Fri Jul 29 06:29:25 2005 UTC
# Line 15  Line 15 
15  use HTML;  use HTML;
16  use raelib;  use raelib;
17  use CGI;  use CGI;
18    use CGI::Carp qw(fatalsToBrowser);
19  my $cgi=new CGI;  my $cgi=new CGI;
20  use LWP::Simple qw(!head); # see the caveat in perldoc LWP about importing two head methods.  use LWP::Simple qw(!head); # see the caveat in perldoc LWP about importing two head methods.
21    
# Line 63  Line 64 
64   $cgi->param(-name=>'family', -value=>\@needed);   $cgi->param(-name=>'family', -value=>\@needed);
65   &show_family($fig,$cgi,$html);   &show_family($fig,$cgi,$html);
66  }  }
67  elsif ($cgi->param("Combine Families With And"))  elsif ($cgi->param('analyse_family')) {
68  {   &analyse_family($fig,$cgi,$html);
  &combine_families($fig,$cgi,$html);  
 }  
 elsif ($cgi->param('proteins_between_two'))  
 {  
  &proteins_between_two($fig, $cgi, $html);  
 }  
 elsif ($cgi->param('Compare FIG Functions'))  
 {  
  my @needed=grep {$cgi->param($_)} $cgi->param("allfams");  
  $cgi->param(-name=>'family', -value=>\@needed);  
  &compare_functions($fig,$cgi,$html);  
 }  
 elsif ($cgi->param('Suggest')) {  
  &suggest_proteins($fig,$cgi,$html);  
 }  
 elsif ($cgi->param('extend_family')) {  
  &extend_family($fig,$cgi,$html);  
69  }  }
70  elsif ($cgi->param('reverse_analyse_family')) {  elsif ($cgi->param('reverse_analyse_family')) {
71   &reverse_analyse_family($fig,$cgi,$html);   &reverse_analyse_family($fig,$cgi,$html);
72  }  }
 elsif ($cgi->param('analyse_family')) {  
  &analyse_family($fig,$cgi,$html);  
 }  
73  elsif ($cgi->param('family'))  elsif ($cgi->param('family'))
74  {  {
75   &show_family($fig,$cgi,$html);   &show_family($fig,$cgi,$html);
# Line 121  Line 102 
102   return $html;   return $html;
103  }  }
104    
 sub show_protein {  
  my ($fig,$cgi,$html)=@_;  
  foreach my $peg ($cgi->param('prot')) {  
   my @families=$fig->families_for_protein($peg);  
   unless (@families)  
   {  
    push @$html, "<h2 style='color: red'>Sorry, $peg is not in any protein families</h2>";  
    return;  
   }  
   
   my $tab=[];  
   my $self=$cgi->url;  
   foreach my $fam (@families) {  
    push @$tab, ["<a href='$self?family=$fam'>$fam</a>", $fig->family_function($fam), $fig->sz_family($fam), $cgi->checkbox(-name=>$fam, -label=>'')];  
   }  
   
   my $col_hdrs=['Family ID', 'Family Function', 'Number of Unique Proteins in Family', 'Choose Family'];  
   push @$html, "<h2>Families for $peg</h2>\n",  
   $cgi->start_form,  
   "<p>$peg is in the following ", scalar(@families), " families. Please choose one or more families using the checkboxes</p>\n",  
   &HTML::make_table($col_hdrs, $tab, "Families for $peg"),  "\n",  
   $cgi->submit('Show Proteins In Each Family'),  
   $cgi->submit(-name=>'analyse_family', -value=>"Show Proteins that are in family"),  
   $cgi->submit(-name=>'reverse_analyse_family', -value=>"Show Proteins that are NOT in family"),  
   $cgi->hidden(-name=>'prot'),$cgi->hidden(-name=>"allfams", -value=>\@families), "\n",  
   $cgi->reset, $cgi->end_form;  
  }  
 }  
   
 # this was deleted from above  
 #$cgi->submit(-name=>"Suggest", -value=>"Suggest Additional families for this protein"),  
   #$cgi->submit(-name=>'proteins_between_two', -value=>"Compare two or more families for missing"), "<br>\n",  
   #$cgi->submit("Combine Families With And"), $cgi->submit("Compare FIG Functions"),  
105    
106  sub show_family {  sub show_family {
107   my ($fig,$cgi,$html)=@_;   my ($fig,$cgi,$html)=@_;
# Line 183  Line 131 
131   }   }
132  }  }
133    
134  sub combine_families {  sub show_protein {
  my ($fig,$cgi,$html)=@_;  
  # first find all the families and all the cids in those families  
  my $cids; my @families; my $allprots;  
  foreach my $f (grep {$cgi->param($_)} $cgi->param("allfams"))  
  {  
   push @families, $f;  
   foreach my $e ($fig->ids_in_family($f)) {$cids->{$e}->{$f}=1; $allprots++}  
  }  
   
  # now figure out those cids that are in all families  
  # we are going to do this with a boolean switch rather than just counting occurences  
  my @wanted;  
  foreach my $cid (keys %$cids) {  
   my $keep=1;  
   foreach my $f (@families) {undef $keep unless ($cids->{$cid}->{$f})}  
   push @wanted, $cid if ($keep);  
  }  
   
  my $tab=[];  
  my $col_hdrs=['Cluster ID', 'Polypeptides with same amino acid sequence'];  
  foreach my $cid (sort {$a <=> $b} @wanted) {  
   my @pegs=$fig->cid_to_prots($cid);  
   foreach my $p (@pegs) {  
    foreach my $k (keys %proteinbase) {  
     if ($p =~ /^$k/) {$p =~ s/^(.*?)\|//; $p = "<a href='$proteinbase{$k}$p'>$1|$p</a>"}  
    }  
   }  
   push @$tab, [$cid, (join ", ", (@pegs))];  
  }  
   
   
  push @$html, "<h2>Proteins in ", (join ", ", (@families)), " families</h2>\n",  
  "<h3>Summary</h3>\n<p>There were $allprots proteins in the ", scalar(@families), " families that you selected.\n<br>",  
  "Out of a those proteins, there were ", scalar(keys %$cids),  
  " unique proteins, and ", scalar(@wanted), " proteins are present in the ",  
  scalar(@families), " families.</p>\n",  
  "Each of the sequences with a given ID have the same amino acid sequence, and hence are the same polypeptide, even though they may come from different organisms.</p>",  
  "<p>The links will take you to the respective databases for each of the other protein families.\n</p>",  
  $cgi->start_form,  
  &HTML::make_table($col_hdrs, $tab, "Proteins in " . (join ", ", (@families)) . " families"),  
  $cgi->end_form;  
 }  
   
 sub compare_functions {  
  my ($fig,$cgi,$html)=@_;  
  foreach my $fam ($cgi->param('family')) {  
   my @cids=sort {$a <=> $b} $fig->ids_in_family($fam);  
   my $tab=[];  
   my $col_hdrs=['FIG ID', 'Genome', 'Assigned Function'];  
   foreach my $cid (@cids) {  
    foreach my $peg (grep {/^fig/} $fig->cid_to_prots($cid)) {  
     my $p=$peg;  
     $p =~ s/fig\|//;  
     $p = "<a href='$proteinbase{'fig'}$p'>$peg</a>";  
     push @$tab, [$p, ($fig->genus_species($fig->genome_of($peg))), scalar($fig->function_of($peg))];  
    }  
   }  
   
   push @$html, "<h2>Functions in $fam Family</h2>\n",  
   "<p>The family $fam has the function ", $fig->family_function($fam), ".\n",  
   "The functions shown here are the functions of just the proteins in the SEED database from this family</p>",  
   $cgi->start_form,  
   &HTML::make_table($col_hdrs, $tab, "Proteins in " . $fig->family_function($fam) . " ($fam)"),  
   $cgi->hidden(-name=>'prot'), $cgi->hidden(-name=>'family', -value=>"$fam"), $cgi->submit("Compare FIG Functions"),  
   $cgi->end_form;  
  }  
 }  
   
 sub suggest_proteins {  
  my ($fig,$cgi,$html)=@_;  
  my $prot=$cgi->param('prot');  
  my @families=$fig->families_for_protein($prot);  
  my $knownfamily;  
  map {$knownfamily->{$_}=1} @families;  
   
  print STDERR "Looking through ", scalar(@families), " families\n";  
  my $famcount=1;my $time=time;  
  my $content;  
  my $row;  
  foreach my $fam (@families) {  
   print STDERR "$famcount in ", time-$time, "\n"; $time=time; $famcount++;  
   
   push @$row, [$fam, 'td style="background-color: grey'];  
   
   my @newprots=$fig->proteins_in_family($fam);  
   push @$row, scalar(@newprots);  
   
   print STDERR "$fam has ", scalar(@newprots), "\n";  
   foreach my $p (@newprots) {  
    my @newfamilies=$fig->families_for_protein($p);  
    foreach my $nf (@newfamilies) {  
     next if ($knownfamily->{$nf});  
     push @{$content->{$nf}}, $p;  
    }  
   }  
  }  
   
  my $tab=[];  
  @$tab=map {[$_, $fig->family_function($_), scalar(@{$content->{$_}})]} keys %$content;  
  my $col_hdrs=["Family ID", "Family function", "Number of proteins in family"];  
   
  push @$html, $cgi->p("$prot is in families ", join ",", @families),  
  $cgi->p("These are the other families that $prot should also appear in:"),  
  &HTML::make_table($col_hdrs, $tab, "Other Families"), "\n";  
 }  
   
   
 sub proteins_between_two {  
135   my ($fig,$cgi,$html)=@_;   my ($fig,$cgi,$html)=@_;
136   # first find all the families and all the cids in those families   foreach my $peg ($cgi->param('prot')) {
137   my $cids; my @families; my $allprots;    my @families=$fig->families_for_protein($peg);
138   foreach my $f (grep {$cgi->param($_)} $cgi->param("allfams"))    unless (@families)
139   {   {
140    push @families, $f;     push @$html, "<h2 style='color: red'>Sorry, $peg is not in any protein families</h2>";
141    foreach my $e ($fig->ids_in_family($f)) {$cids->{$e}->{$f}=1; $allprots++}     return;
  }  
   
  # now figure out those cids that are in all families  
  # we are going to do this with a boolean switch rather than just counting occurences  
  my @wanted; my @missing;  
  foreach my $cid (keys %$cids) {  
   my $keep=1;  
   foreach my $f (@families) {  
    unless ($cids->{$cid}->{$f}) {  
     undef $keep;  
     push @missing, $cid;  
    }  
   }  
   push @wanted, $cid if ($keep);  
142   }   }
143    
  # make some HTML header  
  push @$html, "<h2>Comparison of different protein families</h2><ul>\n";  
  foreach my $f (sort @families) {push @$html, "<li>", $fig->family_function($f), " ($f) </li>\n"}  
  push @$html, "</ul><p>These are the proteins that are unique to one or other of these families:</p>";  
   
  foreach my $f (sort @families) {  
   
144    my $tab=[];    my $tab=[];
145    foreach my $p (sort {$a <=> $b} @missing) {    my $self=$cgi->url;
146     next unless ($cids->{$p}->{$f});    foreach my $fam (@families) {
147     push @$tab, [$p, (join ", ", $fig->cid_to_prots($p))];     my %idcount;
148    }     my $noprots=scalar(map {$idcount{$_}=1} $fig->ids_in_family($fam));
149       #push @$tab, ["<a href='$self?family=$fam'>$fam</a>", $fig->family_function($fam), $fig->sz_family($fam), $cgi->checkbox(-name=>$fam, -label=>'')];
150    my $list;     push @$tab, ["<a href='$self?family=$fam'>$fam</a>", $fig->family_function($fam), $noprots, $cgi->checkbox(-name=>$fam, -label=>'')];
   foreach my $x (@families) {next if ($f eq $x); $list .= "<li>". $fig->family_function($x). " ($x)</li>\n"}  
   push @$html, $cgi->p, "<div style='font-weight: bolder'>Proteins that are in <br><center style='font-weight: bigger'>",  
   $fig->family_function($f), " ($f)</center><br>\nthat are not in <ul>$list</ul>\n</div>\n",  
   &HTML::make_table(["Cluster ID", "Other Proteins"], $tab, " &nbsp; ");  
  }  
 }  
   
   
 sub extend_family {  
  my ($fig,$cgi,$html)=@_;  
 # here are the questions:  
 # 1. Given a column in a spreadsheet:  
 # 2. Here are the proteins in that column  
 # 3. For each protein, here are the families that they are in. How many families are unique and how many families is every protein in?  
 #       if we start with a column of 10 proteins, and nine of them are all in the same families and one is not, we want to exclude the one and keep the nine.  
 #       so we recommend that a protein be removed from a family.  
 # 4. For each of the families that are good, which proteins are there in some/most of the families that are not in the column that we are looking at  
 # 5. For each of the families that are good, which proteins are only in one of those families and not in any others?  
   
 # Note that column == family, But start with fig and then  allow a replace ID feature like before.  
   
  #my $focus=$cgi->param('focus') or "fig"; # these are the things that we are interested in  
  my $focus='fig';  
  push @$html, "<h2>Testing: Limited to fig</h2>\n";  
  foreach my $col (grep {$cgi->param($_)} $cgi->param("allfams"))  
  {  
   # $col is the column in the spreadsheet. This is really a family, but to visualize and code this I am doing it in a FIG-centric way  
   my %proteins_in_col;  
   map {$proteins_in_col{$_}=1} $fig->ids_in_family($col);  
   
   # @proteins are the proteins in that column, although these are cids and not fids at the moment  
   my $familycount;  
   foreach my $prot (keys %proteins_in_col) {  
    foreach my $fam ($fig->in_family($prot)) {  
     $familycount->{$fam}++;  
    }  
151    }    }
152    
153    my $tab=[];    my $col_hdrs=['Family ID', 'Family Function', 'Number of IDs in Family', 'Choose Family'];
154    foreach my $f (sort {$familycount->{$b} <=> $familycount->{$a}} keys %$familycount) {    push @$html, "<h2>Families for $peg</h2>\n",
155     next if ($f eq $col);    $cgi->start_form,
156     # It seems that $sz_family is not right    "<p>$peg is in the following ", scalar(@families), " families. Please choose one or more families using the checkboxes</p>\n",
157     my @all=$fig->ids_in_family($f);    &HTML::make_table($col_hdrs, $tab, "Families for $peg"),  "\n",
158     #my @allmissing=grep {!$proteins_in_col{$_}} ($fig->ids_in_family($f)); # note this is done in two separate lines so I can get the value of @allmissing    $cgi->submit('Show Proteins In Each Family'),
159     my @allmissing=grep {!$proteins_in_col{$_}} @all;    $cgi->submit(-name=>'analyse_family', -value=>"Show Proteins that are in family"),
160     print STDERR "ALL: ", scalar(@all), " ALLMISSING: ", scalar(@allmissing), " IN COL: ", scalar(keys %proteins_in_col), "\n";    $cgi->submit(-name=>'reverse_analyse_family', -value=>"Show Proteins that are NOT in family"),
161     my @missing=    $cgi->hidden(-name=>'prot'),$cgi->hidden(-name=>"allfams", -value=>\@families), "\n",
162          map {"<a href=\'/FIG/protein.cgi?user=$user&prot=$_'>$_</a>"}    $cgi->reset, $cgi->end_form;
         grep {/^$focus/}  
         map {$fig->cid_to_prots($_)} @allmissing;  
         #grep {!$proteins_in_col{$_}}  
         #($fig->ids_in_family($f));  
   
    my $prots_by_fam=join ", ", @missing;  
    push @$tab, [$f, scalar(@all), $fig->family_function($f), $familycount->{$f}, scalar(@allmissing), scalar(@missing), $prots_by_fam];  
   }  
   
   my $col_hdrs=["Family ID", "Size of Family", "Family Function",  
                 "Number of cids in $col that are also in the family in column 1",  
                 "Number of cids in the family in column 1 that are not in $col",  
                 "Number of proteins in the family in column 1 that are not in $col and begin with $focus",  
                 "Proteins that are in the family in column 1 that are not in $col"];  
   push @$html, $cgi->p, "<h3>Your chosen family was $col that has the function ", $fig->family_function($col), " and has ",  
   $fig->sz_family($col), " proteins</h3>",  
   $cgi->p("\nThese are the proteins that should also be in $col. Or maybe not.\n"), &HTML::make_table($col_hdrs, $tab, ' &nbsp; ');  
163   }   }
164  }  }
165    
166    
   
167  sub analyse_family {  sub analyse_family {
168   my ($fig,$cgi,$html)=@_;   my ($fig,$cgi,$html)=@_;
169  # here are the questions:  # here are the questions:
# Line 412  Line 177 
177    
178  # Note that column == family, But start with fig and then  allow a replace ID feature like before.  # Note that column == family, But start with fig and then  allow a replace ID feature like before.
179    
180   #my $focus=$cgi->param('focus') or "fig"; # these are the things that we are interested in   my $focus=$cgi->param('focus') or "fig"; # these are the things that we are interested in
  my $focus='fig';  
  push @$html, "<h2>Testing: Limited to fig</h2>\n";  
181   foreach my $col (grep {$cgi->param($_)} $cgi->param("allfams"))   foreach my $col (grep {$cgi->param($_)} $cgi->param("allfams"))
182   {   {
183    # $col is the column in the spreadsheet. This is really a family, but to visualize and code this I am doing it in a FIG-centric way    # $col is the column in the spreadsheet. This is really a family, but to visualize and code this I am doing it in a FIG-centric way
# Line 432  Line 195 
195    my $count_of;    my $count_of;
196    my $fams;    my $fams;
197    foreach my $f (sort {$familycount->{$b} <=> $familycount->{$a}} keys %$familycount) {    foreach my $f (sort {$familycount->{$b} <=> $familycount->{$a}} keys %$familycount) {
    next if ($f eq $col);  
198     # It seems that $sz_family is not right     # It seems that $sz_family is not right
199     map {$fams->{$f}++; $count_of->{$_}->{$f}++}     map {$fams->{$f}->{$_}++; $count_of->{$_}->{$f}++}
200          grep {/^$focus/}          grep {/^$focus/}
201          map {$fig->cid_to_prots($_)}          map {$fig->cid_to_prots($_)}
202          grep {$proteins_in_col{$_}}          grep {$proteins_in_col{$_}}
203          ($fig->ids_in_family($f));          ($fig->ids_in_family($f));
204    }    }
   my $tab=[];  
205    
206    # create a list of families that we know about    # create a list of families that we know about
207      my @fams=grep {!/$col/} sort {scalar(keys %{$fams->{$b}}) <=> scalar(keys %{$fams->{$a}})} keys %$fams;
208      unshift @fams, $col;
209    
210      my $tab=[[["Number of proteins in family", "th colspan=3"], map {scalar(keys %{$fams->{$_}})} @fams]];
211    
212    foreach my $fid (sort {scalar(keys %{$count_of->{$b}}) <=> scalar(keys %{$count_of->{$a}})} keys %$count_of) {    my @fids;
213     my @row=($fid, scalar(keys %{$count_of->{$fid}}));    if ($cgi->param('sort') eq "genome")
214     print STDERR "Added $fid\n";    {
215     foreach my $fam (sort {$fams->{$b} <=> $fams->{$a}} keys %$fams) {     @fids=sort {$fig->genome_of($a) <=> $fig->genome_of($b)} keys %$count_of;
     $count_of->{$fid}->{$fam} ? push @row, [$count_of->{$fid}->{$fam}, "td style='background-color: grey'"] : push @row, " &nbsp ";  
216     }     }
217     push @$tab, \@row;    else
218      {
219       @fids=sort {scalar(keys %{$count_of->{$b}}) <=> scalar(keys %{$count_of->{$a}})} keys %$count_of;
220    }    }
221    
222    push @$html, "<h3>Proteins that ARE from ", $fig->family_function($col), " ($col) </h3>\n",    my $rowcount;
223    &HTML::make_table(["Protein ID", "Number of fams protein is in", (keys %$fams)], $tab,' &nbsp; ');    foreach my $fid (@fids)
224      {
225       my @row=(++$rowcount, $fid, scalar(keys %{$count_of->{$fid}}));
226    
227       foreach my $fam (@fams) {
228        $count_of->{$fid}->{$fam} ? push @row, ["Y", "td style='background-color: lightgrey; text-align: center'"] : push @row, " &nbsp ";
229   }   }
230       push @$tab, \@row;
231  }  }
232    
233      my @hidden=map {$cgi->hidden(-name=>$_)} grep {$cgi->param($_)} $cgi->param("allfams");
234      push @$html,
235        $cgi->start_form(), "Limit the display to proteins from ", &choose_focus($cgi),
236        $cgi->p("These are proteins that ARE in ", $fig->family_function($col), " ($col) and are in other families that have proteins in this family."),
237        $cgi->hidden(-name=>"allfams"), $cgi->hidden("prot"), @hidden, $cgi->hidden(-name=>"user"),
238        $cgi->submit(-name=>'analyse_family', -value=>"Show Proteins that are in family"),
239        $cgi->submit(-name=>'reverse_analyse_family', -value=>"Show Proteins that are NOT in family"),
240        &HTML::make_table(["Count", "Protein ID", "Number of fams protein is in", @fams], $tab,' &nbsp; ');
241     }
242    }
243    
244    
245  sub reverse_analyse_family {  sub reverse_analyse_family {
# Line 473  Line 255 
255    
256  # Note that column == family, But start with fig and then  allow a replace ID feature like before.  # Note that column == family, But start with fig and then  allow a replace ID feature like before.
257    
258   #my $focus=$cgi->param('focus') or "fig"; # these are the things that we are interested in   my $focus=$cgi->param('focus'); # these are the things that we are interested in
259   my $focus='fig';   unless ($focus) {$focus="fig"}
  push @$html, "<h2>Testing: Limited to fig</h2>\n";  
260   foreach my $col (grep {$cgi->param($_)} $cgi->param("allfams"))   foreach my $col (grep {$cgi->param($_)} $cgi->param("allfams"))
261   {   {
262    # $col is the column in the spreadsheet. This is really a family, but to visualize and code this I am doing it in a FIG-centric way    # $col is the column in the spreadsheet. This is really a family, but to visualize and code this I am doing it in a FIG-centric way
# Line 493  Line 274 
274    my $count_of;    my $count_of;
275    my $fams;    my $fams;
276    foreach my $f (sort {$familycount->{$b} <=> $familycount->{$a}} keys %$familycount) {    foreach my $f (sort {$familycount->{$b} <=> $familycount->{$a}} keys %$familycount) {
    next if ($f eq $col);  
277     # It seems that $sz_family is not right     # It seems that $sz_family is not right
278     map {$fams->{$f}++; $count_of->{$_}->{$f}++}     map {$fams->{$f}->{$_}++; $count_of->{$_}->{$f}++}
279          grep {/^$focus/}          grep {/^$focus/}
280          map {$fig->cid_to_prots($_)}          map {$fig->cid_to_prots($_)}
281          grep {!$proteins_in_col{$_}}          grep {!$proteins_in_col{$_}}
282          ($fig->ids_in_family($f));          ($fig->ids_in_family($f));
283    }    }
   my $tab=[];  
284    
285    # create a list of families that we know about    # create a list of families that we know about
286      my @fams=grep {!/$col/} sort {scalar(keys %{$fams->{$b}}) <=> scalar(keys %{$fams->{$a}})} keys %$fams;
287      unshift @fams, $col;
288    
289      my $tab=[[["Number of proteins in family", "th colspan=3"], map {scalar(keys %{$fams->{$_}})} @fams]];
290    
291      my @fids;
292      if ($cgi->param('sort') eq "genome")
293      {
294       @fids=sort {$fig->genome_of($a) <=> $fig->genome_of($b)} keys %$count_of;
295      }
296      else
297      {
298       @fids=sort {scalar(keys %{$count_of->{$b}}) <=> scalar(keys %{$count_of->{$a}})} keys %$count_of;
299      }
300    
301      my $rowcount;
302      foreach my $fid (@fids)
303      {
304       my @row=(++$rowcount, $fid, scalar(keys %{$count_of->{$fid}}));
305    
306    foreach my $fid (sort {scalar(keys %{$count_of->{$b}}) <=> scalar(keys %{$count_of->{$a}})} keys %$count_of) {     foreach my $fam (@fams) {
307     my @row=($fid, scalar(keys %{$count_of->{$fid}}));      $count_of->{$fid}->{$fam} ? push @row, ["Y", "td style='background-color: lightgrey; text-align: center'"] : push @row, " &nbsp ";
    print STDERR "Added $fid\n";  
    foreach my $fam (sort {$fams->{$b} <=> $fams->{$a}} keys %$fams) {  
     $count_of->{$fid}->{$fam} ? push @row, [$count_of->{$fid}->{$fam}, "td style='background-color: grey'"] : push @row, " &nbsp ";  
308     }     }
309     push @$tab, \@row;     push @$tab, \@row;
310    }    }
311    
312    push @$html, "<h3>Proteins that ARE NOT from ", $fig->family_function($col), " ($col) </h3>\n",    my @hidden=map {$cgi->hidden(-name=>$_)} grep {$cgi->param($_)} $cgi->param("allfams");
313    &HTML::make_table(["Protein ID", "Number of fams protein is in", (keys %$fams)], $tab,' &nbsp; ');    push @$html,
314        $cgi->start_form(), "Limit the display to proteins from ", &choose_focus($cgi),
315        $cgi->p("These are proteins that ARE NOT in ", $fig->family_function($col), " ($col) but are in other families that have proteins in this family."),
316        $cgi->hidden(-name=>"allfams"), $cgi->hidden("prot"), @hidden, $cgi->hidden(-name=>"user"),
317        $cgi->submit(-name=>'analyse_family', -value=>"Show Proteins that are in family"),
318        $cgi->submit(-name=>'reverse_analyse_family', -value=>"Show Proteins that are NOT in family"),
319        &HTML::make_table(["Count", "Protein ID", "Number of fams protein is in", @fams], $tab,' &nbsp; ');
320   }   }
321  }  }
322    
323    
324    sub choose_focus {
325     my ($cgi)=@_;
326     my %choices=(
327      "fig"         => "FIGfams",
328      "tigr"        => "TIGRfams",
329      "pfam"        => "PFAM",
330      "sp"          => "SwissProt",
331      "kegg"        => "KEGG",
332      "pir"         => "PIR SuperFams",
333      "mcl"         => "MCL",
334      "cog"         => "COG",
335     );
336    
337     my $default = $cgi->param("focus"); unless ($default) {$default="fig"}
338    
339     return $cgi->popup_menu(
340      -name     => "focus",
341      -values   => [keys %choices],
342      -labels   => \%choices,
343      -default  => $default,
344     );
345    }
346    
347    

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3