[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.14, Mon Aug 8 18:43:08 2005 UTC revision 1.15, Mon Oct 3 22:50:46 2005 UTC
# Line 187  Line 187 
187    
188  # 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.
189    
190   my $focus=$cgi->param('focus') or 'fig'; # these are the things that we are interested in   my $focus=$cgi->param('focus') or 'all'; # these are the things that we are interested in
191     undef $focus if ($focus eq "all");
192    
193   my @cols;   my @cols;
194   if ($cgi->param("allfams")) {@cols=grep {$cgi->param($_)} $cgi->param("allfams")}   if ($cgi->param("allfams")) {@cols=grep {$cgi->param($_)} $cgi->param("allfams")}
# Line 220  Line 221 
221    my @fams=grep {!/$col/} sort {scalar(keys %{$fams->{$b}}) <=> scalar(keys %{$fams->{$a}})} keys %$fams;    my @fams=grep {!/$col/} sort {scalar(keys %{$fams->{$b}}) <=> scalar(keys %{$fams->{$a}})} keys %$fams;
222    unshift @fams, $col;    unshift @fams, $col;
223    
224    my $tab=[[["Number of proteins in family", "th colspan=3"], map {scalar(keys %{$fams->{$_}})} @fams]];    my $tab=[[["Number of proteins in family", "th colspan=4"], map {scalar(keys %{$fams->{$_}})} @fams]];
225    
226    my @fids;    my @fids;
227    if ($cgi->param('sort') eq "genome")    if ($cgi->param('sort') eq "genome")
228    {    {
229     @fids=sort {$fig->genome_of($a) <=> $fig->genome_of($b)} keys %$count_of;     @fids=sort {$fig->genome_of($a) <=> $fig->genome_of($b)} keys %$count_of;
230    }    }
231      elsif ($cgi->param('sort') eq "cid")
232      {
233       @fids=sort {$fig->prot_to_cid($a) <=> $fig->prot_to_cid($b)} keys %$count_of;
234      }
235    else    else
236    {    {
237     @fids=sort {scalar(keys %{$count_of->{$b}}) <=> scalar(keys %{$count_of->{$a}})} keys %$count_of;     @fids=sort {scalar(keys %{$count_of->{$b}}) <=> scalar(keys %{$count_of->{$a}})} keys %$count_of;
# Line 235  Line 240 
240    my $rowcount;    my $rowcount;
241    foreach my $fid (@fids)    foreach my $fid (@fids)
242    {    {
243     my @row=(++$rowcount, $fid, scalar(keys %{$count_of->{$fid}}));     my @row=(++$rowcount, $fig->prot_to_cid($fid), $fid, scalar(keys %{$count_of->{$fid}}));
244    
245     foreach my $fam (@fams) {     foreach my $fam (@fams) {
246      $count_of->{$fid}->{$fam} ? push @row, ["Y", "td style='background-color: lightgrey; text-align: center'"] : push @row, " &nbsp ";      $count_of->{$fid}->{$fam} ? push @row, ["Y", "td style='background-color: lightgrey; text-align: center'"] : push @row, " &nbsp ";
# Line 243  Line 248 
248     push @$tab, \@row;     push @$tab, \@row;
249    }    }
250    
251    push @$html,  $cgi->start_form(), "Limit the display to proteins from ", &choose_focus($cgi);    push @$html,  $cgi->start_form(), $cgi->p("Limit the display to proteins from ", &choose_focus($cgi), "\n"), $cgi->p("Sort the order by ", &choose_sort($cgi),"\n");
252    if ($reverse) {    if ($reverse) {
253     push @$html, $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.");     push @$html, $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.");
254    } else {    } else {
# Line 254  Line 259 
259      $cgi->hidden(-name=>"family", -value=>@cols), $cgi->hidden("prot"), $cgi->hidden(-name=>"user"),      $cgi->hidden(-name=>"family", -value=>@cols), $cgi->hidden("prot"), $cgi->hidden(-name=>"user"),
260      $cgi->submit(-name=>'analyse_family', -value=>"Show Proteins that are in family"),      $cgi->submit(-name=>'analyse_family', -value=>"Show Proteins that are in family"),
261      $cgi->submit(-name=>'reverse_analyse_family', -value=>"Show Proteins that are NOT in family"),      $cgi->submit(-name=>'reverse_analyse_family', -value=>"Show Proteins that are NOT in family"),
262      &HTML::make_table(["Count", "Protein ID", "Number of fams protein is in", @fams], $tab,' &nbsp; ');      &HTML::make_table(["Count", "Unique ID", "Protein ID", "Number of fams protein is in", @fams], $tab,' &nbsp; ');
263   }   }
264  }  }
265    
# Line 286  Line 291 
291  sub choose_focus {  sub choose_focus {
292   my ($cgi)=@_;   my ($cgi)=@_;
293   my %choices=(   my %choices=(
294      "all"         => "All",
295    "fig"         => "FIGfams",    "fig"         => "FIGfams",
296    "tigr"        => "TIGRfams",    "tigr"        => "TIGRfams",
297    "pfam"        => "PFAM",    "pfam"        => "PFAM",
# Line 296  Line 302 
302    "cog"         => "COG",    "cog"         => "COG",
303   );   );
304    
305   my $default = $cgi->param("focus"); unless ($default) {$default="fig"}   my $default = $cgi->param("focus"); unless ($default) {$default="all"}
306    
307   return $cgi->popup_menu(   return $cgi->popup_menu(
308    -name     => "focus",    -name     => "focus",
309    -values   => [keys %choices],    -values   => [sort {$choices{$a} cmp $choices{$b}} keys %choices],
310      -labels   => \%choices,
311      -default  => $default,
312     );
313    }
314    
315    sub choose_sort {
316     my ($cgi)=@_;
317     my %choices=(
318      "none"        => "Number of Proteins",
319      "genome"      => "Genome",
320      "cid"         => "Unique ID",
321     );
322    
323     my $default = $cgi->param("sort"); unless ($default) {$default="none"}
324    
325     return $cgi->popup_menu(
326      -name     => "sort",
327      -values   => [sort {$choices{$a} cmp $choices{$b}} keys %choices],
328    -labels   => \%choices,    -labels   => \%choices,
329    -default  => $default,    -default  => $default,
330   );   );

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3