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

Diff of /FigWebServices/homologs_in_clusters.cgi

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

revision 1.4, Thu Jun 23 21:24:49 2005 UTC revision 1.14, Wed Oct 15 11:49:20 2008 UTC
# Line 1  Line 1 
1    #
2    # Copyright (c) 2003-2006 University of Chicago and Fellowship
3    # for Interpretations of Genomes. All Rights Reserved.
4    #
5    # This file is part of the SEED Toolkit.
6    #
7    # The SEED Toolkit is free software. You can redistribute
8    # it and/or modify it under the terms of the SEED Toolkit
9    # Public License.
10    #
11    # You should have received a copy of the SEED Toolkit Public License
12    # along with this program; if not write to the University of Chicago
13    # at info@ci.uchicago.edu or the Fellowship for Interpretation of
14    # Genomes at veronika@thefig.info or download a copy from
15    # http://www.theseed.org/LICENSE.TXT.
16    #
17    
18  #### start #####  #### start #####
19  use InterfaceRoutines;  use InterfaceRoutines;
20    
# Line 5  Line 22 
22  use HTML;  use HTML;
23  use strict;  use strict;
24  use CGI;  use CGI;
25  my $cgi = new CGI;  use FIG_CGI;
   
26  use FIG;  use FIG;
27    
28  my $sproutAvail = eval {  my $sproutAvail = eval {
29      require SproutFIG;      require SproutFIG;
30      require PageBuilder;      require PageBuilder;
31  };  };
32    
33  my($fig_or_sprout);  my($fig_or_sprout, $cgi) = FIG_CGI::init();
34  my $is_sprout;  if (ref $fig_or_sprout eq 'SFXlate') {
35        my $prot = $cgi->param('prot');
36        print $cgi->redirect(-uri => "$FIG_Config::cgi_url/wiki/rest.cgi/NmpdrPlugin/SeedViewer?page=Evidence;feature=$prot",
37                             -status => 301);
38    }
39    
40  my $html = [];  my $html = [];
41    
42  if ($cgi->param('SPROUT')) {  unshift @$html, "<TITLE>The Homologs in  Clusters Page</TITLE>\n";
     $is_sprout = 1;  
     $fig_or_sprout = new SproutFIG($FIG_Config::sproutDB, $FIG_Config::sproutData);  
     unshift @$html, "<TITLE>The NMPDR Homologs in Clusters Page</TITLE>\n";  
 } else {  
     $is_sprout = 0;  
     $fig_or_sprout = new FIG;  
     unshift @$html, "<TITLE>The SEED Homologs in  Clusters Page</TITLE>\n";  
 }  
43    
44  if (0)  if (0)
45  {  {
# Line 81  Line 95 
95  }  }
96    
97  &compute_desired_homologs($fig_or_sprout,$cgi,$html,$prot);  &compute_desired_homologs($fig_or_sprout,$cgi,$html,$prot);
98    
99    if (ref $fig_or_sprout eq 'SFXlate')
100    {
101        my $h = { homologs => $html,
102                  title => "NMPDR Homologs in Clusters Page"};
103    
104        print "Content-Type: text/html\n";
105        print "\n";
106        my $templ = "$FIG_Config::template_url/Homologs_tmpl.php";
107        print PageBuilder::Build("$templ", $h,"Html");
108    }
109    else
110    {
111  &HTML::show_page($cgi,$html);  &HTML::show_page($cgi,$html);
112    }
113  exit;  exit;
114    
115  sub compute_desired_homologs {  sub compute_desired_homologs {
# Line 97  Line 125 
125  #   print STDERR &Dumper(\@homologs);  #   print STDERR &Dumper(\@homologs);
126    
127      my $sc;      my $sc;
128      my @tab = map { ($peg,$sc) = @$_; [$sc,      my @tab = map { my($peg,$sc,$sim) = @$_; [$sim,$sc,
129                                         &HTML::fid_link($cgi,$peg),                                         &HTML::fid_link($cgi,$peg),
130                                         $fig_or_sprout->genus_species($fig_or_sprout->genome_of($peg)),                                         $fig_or_sprout->genus_species($fig_or_sprout->genome_of($peg)),
131                                         scalar $fig_or_sprout->function_of($peg,$cgi->param('user')),                                         scalar $fig_or_sprout->function_of($peg,$cgi->param('user')),
132                                         &HTML::set_prot_links($cgi,join( ', ', $fig_or_sprout->feature_aliases($peg) ))                                         &HTML::set_prot_links($cgi,join( ', ', $fig_or_sprout->feature_aliases($peg) ))
133                                        ] } @pinned;                                        ] } @pinned;
134      push(@$html,&HTML::make_table(["Score","PEG","Genome", "Function","Aliases"],\@tab,"PEGs that Might Be in Clusters"));      if (@tab > 0)
135        {
136            push(@$html,&HTML::make_table(["Sim. Sc.","Cluster Size","PEG","Genome", "Function","Aliases"],\@tab,"PEGs that Might Be in Clusters"));
137        }
138        else
139        {
140            push(@$html, $cgi->h1("Sorry, we have no clusters containing homologs of $peg"));
141        }
142  }  }
143    
144  sub relevant_homologs {  sub relevant_homologs {
# Line 128  Line 163 
163          if ((! $seen{$genome2}) && (@coup = $fig_or_sprout->coupled_to($id2)) && (@coup > 0))          if ((! $seen{$genome2}) && (@coup = $fig_or_sprout->coupled_to($id2)) && (@coup > 0))
164          {          {
165              $seen{$genome2} = 1;              $seen{$genome2} = 1;
166              push(@homologs,[$id2,scalar @coup]);              push(@homologs,[$id2,@coup+1,$sim->psc]);
167          }          }
168      }      }
169      return sort { $b->[1] <=> $a->[1] } @homologs;      return sort { $b->[1] <=> $a->[1] } @homologs;
# Line 147  Line 182 
182          my $loc = $fig_or_sprout->feature_location($peg);          my $loc = $fig_or_sprout->feature_location($peg);
183          if ($loc)          if ($loc)
184          {          {
185              my($contig,$beg,$end) = &FIG::boundaries_of($loc);          my($contig,$beg,$end) = $fig_or_sprout->boundaries_of($loc);
186              if ($contig && $beg && $end)              if ($contig && $beg && $end)
187              {              {
188                  $mid = int(($beg + $end) / 2);                  $mid = int(($beg + $end) / 2);

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3