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

Diff of /FigWebServices/pir.cgi

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

revision 1.4, Tue Feb 8 00:42:36 2005 UTC revision 1.5, Fri Feb 11 23:53:37 2005 UTC
# Line 54  Line 54 
54    
55    
56    
57    if ($cgi->param('tabulate')) {
58  if ($cgi->param('pirsf')) {   $html=&table_annotations($html);
59    }
60    elsif ($cgi->param('pirsf')) {
61   # we want to display one of the correspondances   # we want to display one of the correspondances
62   my $col_hdrs = ["PIR Superfamily<br><small>Link goes to PIR<small>", "Genome", "PEG", "FIG Function", "FIG Spreadsheet"];   my $selfurl=$cgi->url;
63     push @$html, $cgi->p;
64     if ($cgi->param('ssonly')) {push @$html, "<a href=\"$selfurl?pirsf=" . $cgi->param("pirsf") . "&user=" . $cgi->param('user') . "\">Show All Matches</a>\n"}
65     else {push @$html, "<a href=\"$selfurl?pirsf=" . $cgi->param("pirsf") . "&ssonly='1'&user=" . $cgi->param('user') . "\">Show only matches with a subsystem</a>\n"}
66    
67     my $col_hdrs = ["PIR Superfamily<br><small>Link goes to PIR<small>", "Genome", "PEG", "FIG Function", "FIG Subsystem"];
68   my $tab = [];   my $tab = [];
69   foreach my $peg (@{$pegbypir->{$cgi->param('pirsf')}}) {   foreach my $peg (@{$pegbypir->{$cgi->param('pirsf')}}) {
70    my @sslinks;    my @sslinks;
# Line 73  Line 80 
80   }   }
81   push(@$html,&HTML::make_table($col_hdrs,$tab,"Correspondance between SEED and PIR"));   push(@$html,&HTML::make_table($col_hdrs,$tab,"Correspondance between SEED and PIR"));
82  }  }
   
83  else {  else {
84   unshift @$html, "<TITLE>The SEED - PIR comparison page</TITLE>\n";   unshift @$html, "<TITLE>The SEED - PIR comparison page</TITLE>\n";
85   &show_initial($fig,$cgi,$html);   &show_initial($fig,$cgi,$html);
# Line 191  Line 197 
197   }   }
198   return $pir, $functions;   return $pir, $functions;
199  }  }
200    
201    
202    =head1 count_annotations
203    
204    Count the number of annotations per subsystem. This is to make the pir_comp.html table automatic
205    
206    returns a reference to a hash, with two keys: {'function'} is a reference to a hash of all functions
207    {'subsystems'} is a reference to a hash of all subsystems
208    
209    =cut
210    
211    sub count_annotations {
212     unless (-e "$FIG_Config::data/Global/pirsfcorrespondance.txt") {
213      print STDERR "Can't find the correspondance file pirsfcorrespondance.txt so we are going to make it\n";
214      raelib->pirsfcorrespondance("$FIG_Config::data/Global/pirsfinfo.dat", "$FIG_Config::data/Global/pirsfcorrespondance.txt");
215     }
216     open (IN, "$FIG_Config::data/Global/pirsfcorrespondance.txt") || die "Can't open $FIG_Config::data/Global/pirsfcorrespondance.txt";
217     my $pir;
218     my $current;
219     while (<IN>) {
220      chomp;
221      if (/^>/) {$current=$_; next}
222      else {
223       my ($pid, $fid)=split /\t/;
224       $pir->{'function'}->{$current}->{$fig->function_of($fid)}++;
225       foreach my $subsys ($fig->subsystems_for_peg($fid)) {$pir->{'subsystems'}->{$current}->{$$subsys[0]}++}
226      }
227     }
228     return $pir;
229    }
230    
231    
232    =head1 table_annotations
233    
234    Return a table sorted by the number of annotations, and list a bunch of stuff
235    
236    =cut
237    
238    sub table_annotations {
239     my ($html)=@_;
240     my $pir=&count_annotations();
241     my $tab=[];
242     foreach my $sf (sort {scalar keys %{$pir->{'function'}->{$b}} <=> scalar keys %{$pir->{'function'}->{$a}}} keys %{$pir->{'function'}}) {
243      $sf =~ /(PIRSF\d+)/;
244      push @$tab,
245       (
246       (scalar keys %{$pir->{'function'}->{$sf}}),
247       "<a href=\"http://seed-linux-2.uchicago.edu/FIG/pir.cgi?pirsf=$1&ssonly='1'&user=''>$1</a>",
248       $sf,
249       join "; ", keys %{$pir->{'subsystems'}->{$sf}},
250       );
251     }
252    
253     my $col_hdrs = ["Number of SEED annotations in a Superfamily", "PIRSF<br><small>(Link goes to SEED/PIR comparison)</small>",
254                     "Superfamily name", "Subsystems in superfamily"];
255     push(@$html,&HTML::make_table($col_hdrs,$tab,"A comparison of the SEED and PIR superfamilies"));
256     return $html;
257    }

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3