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

Diff of /FigWebServices/sigs.cgi

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

revision 1.8, Mon Feb 14 16:17:19 2005 UTC revision 1.9, Fri Sep 9 13:28:58 2005 UTC
# Line 1  Line 1 
1  use FIG;  use FIG;
2  my $fig = new FIG;  use SproutFIG;
3    use InterfaceRoutines;
4    
5  use HTML;  use HTML;
6  use CGI;  use CGI;
# Line 31  Line 32 
32    
33  my $html = [];  my $html = [];
34    
35    my($fig_or_sprout);
36    if ($cgi->param('SPROUT')) {
37        $is_sprout = 1;
38        $fig_or_sprout = new SproutFIG($FIG_Config::sproutDB, $FIG_Config::sproutData);
39        unshift @$html, "<TITLE>The NMPDR Signature Genes Page</TITLE>\n";
40    } else {
41        $is_sprout = 0;
42        $fig_or_sprout = new FIG;
43        unshift @$html, "<TITLE>The SEED Signature Genes Page</TITLE>\n";
44    }
45    
46  my @tmp = grep { $_ =~ /^\d+\.\d+$/ } $cgi->param;  my @tmp = grep { $_ =~ /^\d+\.\d+$/ } $cgi->param;
47  my @set1 = grep { $cgi->param($_) eq "set1" } @tmp;  my @set1 = grep { $cgi->param($_) eq "set1" } @tmp;
48  my @set2 = grep { $cgi->param($_) eq "set2" } @tmp;  my @set2 = grep { $cgi->param($_) eq "set2" } @tmp;
# Line 43  Line 55 
55      $col_hdrs = ["Given","Set 1","","Set 2","genome","Genus/Species"];      $col_hdrs = ["Given","Set 1","","Set 2","genome","Genus/Species"];
56      $tab = [];      $tab = [];
57    
58      @orgs = $fig->genomes("complete");      @orgs = $fig_or_sprout->genomes("complete");
59    
60      foreach $org (@orgs)      foreach $org (@orgs)
61      {      {
62          $full{$org} = $fig->genus_species($org);          $full{$org} = $fig_or_sprout->genus_species($org);
63      }      }
64      @orgs = sort { $full{$a} cmp $full{$b} } @orgs;      @orgs = sort { $full{$a} cmp $full{$b} } @orgs;
65    
# Line 99  Line 111 
111              foreach $_ (@hits)              foreach $_ (@hits)
112              {              {
113                  my($peg,$score) = @$_;                  my($peg,$score) = @$_;
114                  push(@$tab,[&HTML::fid_link($cgi,$peg,"local"),$score,scalar $fig->function_of($peg,$cgi->param('user'))]);                  push(@$tab,[&HTML::fid_link($cgi,$peg,"local"),$score,&InterfaceRoutines::function_ofS($fig_or_sprout,$peg,$cgi->param('user'))]);
115              }              }
116              push(@$html,&HTML::make_table($col_hdrs,$tab,$title));              push(@$html,&HTML::make_table($col_hdrs,$tab,$title));
117          }          }
# Line 109  Line 121 
121              my $minN = $cgi->param('minN');              my $minN = $cgi->param('minN');
122              $minN = $minN ? $minN : @set1;              $minN = $minN ? $minN : @set1;
123              @hits = &common_genes(\@set1,$given,$sim_cutoff,$minN);              @hits = &common_genes(\@set1,$given,$sim_cutoff,$minN);
124              $col_hdrs = ["",&FIG::abbrev($fig->genus_species($given)),"Score","Function"];              $col_hdrs = ["",&FIG::abbrev($fig_or_sprout->genus_species($given)),"Score","Function"];
125              for ($i=0; ($i < @set1); $i++)              for ($i=0; ($i < @set1); $i++)
126              {              {
127                  $which_col{$set1[$i]} = $i+4;                  $which_col{$set1[$i]} = $i+4;
128                  push(@$col_hdrs,&FIG::abbrev($fig->genus_species($set1[$i])));                  push(@$col_hdrs,&FIG::abbrev($fig_or_sprout->genus_species($set1[$i])));
129              }              }
130    
131              $tab      = [];              $tab      = [];
# Line 122  Line 134 
134              for ($j=0; ($j < @hits); $j++)              for ($j=0; ($j < @hits); $j++)
135              {              {
136                  my($peg,$score,$hits) = @{$hits[$j]};                  my($peg,$score,$hits) = @{$hits[$j]};
137                  my $func = scalar $fig->function_of($peg,$cgi->param('user'));                  my $func = &InterfaceRoutines::function_ofS($fig_or_sprout,$peg,$cgi->param('user'));
138                  my $row = [$j+1,&HTML::fid_link($cgi,$peg,"local"),$score,$func];                  my $row = [$j+1,&HTML::fid_link($cgi,$peg,"local"),$score,$func];
139                  for ($i=0; ($i < @set1); $i++)                  for ($i=0; ($i < @set1); $i++)
140                  {                  {
# Line 157  Line 169 
169          $set1{$given} = 0;          $set1{$given} = 0;
170      }      }
171    
172      foreach $peg ($fig->all_features($given,"peg"))      foreach $peg ($fig_or_sprout->all_features($given,"peg"))
173      {      {
174          undef %hits_set1;          undef %hits_set1;
175          foreach $sim ($fig->sims($peg, 1000, $sim_cutoff, "fig"))          foreach $sim ($fig_or_sprout->sims($peg, 1000, $sim_cutoff, "fig"))
176          {          {
177              $id2          = $sim->id2;              $id2          = $sim->id2;
178              if ($id2 =~ /^fig\|(\d+\.\d+)/)              if ($id2 =~ /^fig\|(\d+\.\d+)/)
# Line 178  Line 190 
190          $sc = keys(%hits_set1);          $sc = keys(%hits_set1);
191          if ($sc >= $minN)          if ($sc >= $minN)
192          {          {
193              push(@hits,[$peg,$sc,[map { [$hits_set1{$_},scalar $fig->function_of($hits_set1{$_})] } keys(%hits_set1)]]);              push(@hits,[$peg,$sc,[map { [$hits_set1{$_},&InterfaceRoutines::function_ofS($fig_or_sprout,$hits_set1{$_})] } keys(%hits_set1)]]);
194          }          }
195      }      }
196      return @hits;      return @hits;
# Line 192  Line 204 
204    
205      my(%hits_set1,%hits_set2,@hits,$sim,$id2,$peg);      my(%hits_set1,%hits_set2,@hits,$sim,$id2,$peg);
206    
207      foreach $peg ($fig->all_features($given,"peg"))      foreach $peg ($fig_or_sprout->all_features($given,"peg"))
208      {      {
209          undef %hits_set1; undef %hits_set2;          undef %hits_set1; undef %hits_set2;
210          $hits_set1{&FIG::genome_of($peg)} = 1;          $hits_set1{&FIG::genome_of($peg)} = 1;
211    
212          foreach $sim ($fig->sims($peg, 1000, $sim_cutoff, "fig"))          foreach $sim ($fig_or_sprout->sims($peg, 1000, $sim_cutoff, "fig"))
213          {          {
214              $id2          = $sim->id2;              $id2          = $sim->id2;
215              if ($id2 =~ /^fig\|(\d+\.\d+)/)              if ($id2 =~ /^fig\|(\d+\.\d+)/)

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3