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

Diff of /FigWebServices/link.cgi

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

revision 1.1, Mon Oct 2 03:03:08 2006 UTC revision 1.6, Wed Feb 27 02:05:39 2008 UTC
# Line 2  Line 2 
2    
3  =head1 Protein Page Link  =head1 Protein Page Link
4    
5  This is a simple redirection script that takes a feature name as input and opens  This is a simple redirection script that takes a string as input and opens
6  the appropriate protein page. The feature name can be a FIG feature ID or  the appropriate page.
 an external alias.  
7    
8  This script supports the following CGI query parameters.  This script supports the following CGI query parameters.
9    
# Line 12  Line 11 
11    
12  =item id  =item id
13    
14  ID of the desired feature. This can be a FIG ID or an alias.  ID of the desired feature. This can be a FIG ID or an alias. If it is preceded
15    by C<nmpdr|>, then we will try to force the Sprout protein page.
16    
17  =item Trace  =item sop
18    
19  Trace level and list of trace modules to turn on, space-delimited. The  ID of a procedure in the SEED wiki.
 default is no tracing.  
   
 =item TF  
   
 C<1> to trace to a file, C<0> to trace to the web page itself. The  
 default is C<0>.  
20    
21  =back  =back
22    
# Line 31  Line 25 
25  use strict;  use strict;
26  use Tracer;  use Tracer;
27  use CGI;  use CGI;
 use Sprout;  
28  use URI::Escape;  use URI::Escape;
29    
30  my ($cgi, $varHash) = ScriptSetup();  my $url;
31    
32    my $cgi = CGI->new();
33    ETracing($cgi);
34  eval {  eval {
35      # Get the protein ID.      # Get the possible IDs.
36        my $sopID = $cgi->param('sop');
37        my $genomeID = $cgi->param('genome');
38      my $pegID = $cgi->param('id');      my $pegID = $cgi->param('id');
39      if (! $pegID) {      if ($sopID) {
40          # No protein ID, so we fail.          # This is for the annotation SOP.
41          Confess("No ID specified.");          if ($sopID =~ /SOP010/i) {
42                $url = "http://www.theseed.org/w/images/2/23/Annotation_sop.pdf";
43      } else {      } else {
44          # Escape the incoming ID.              Confess("Invalid SOP number");
         my $protID = uri_escape($pegID);  
         # Determine the correct mode (seed or SPROUT).  
         my $mode = $cgi->param('SPROUT');  
         if (! defined $mode) {  
             $mode = ($FIG_Config::sproutDB ? 1 : 0);  
45          }          }
46          my $url = "protein.cgi?SPROUT=1;prot=$protID;SPROUT=$mode";      } elsif ($genomeID) {
47          # Redirect to the protein page.          # Here we have an organism ID.
48          print $cgi->redirect(-uri => $url);          my $escapedID = uri_escape($genomeID);
49            $url = "$FIG_Config::nmpdr_site_url/FIG/seedviewer.cgi?page=BrowseGenome&organism=$escapedID";
50        } elsif ($pegID) {
51            # Here we have a PEG ID.
52            my $escapedID = uri_escape($1);
53            $url = "$FIG_Config::nmpdr_site_url/FIG/seedviewer.cgi?page=Annotation&feature=$escapedID"
54        } else {
55            Confess("Unrecognized identifier.");
56      }      }
57        print $cgi->redirect(-uri => $url);
58  };  };
59  if ($@) {  if ($@) {
60      # Get the error message.      # Get the error message.
# Line 60  Line 62 
62      Trace("Script Error: $errorMessage") if T(0);      Trace("Script Error: $errorMessage") if T(0);
63      # Display the error message. Note that unlike most situations,      # Display the error message. Note that unlike most situations,
64      # we have to write a content header. This is because we have a      # we have to write a content header. This is because we have a
65      # redirection script ratherh than a standard CGI script.      # redirection script rather than a standard CGI script.
     $varHash->{results} = $cgi->h3("Script Error: $errorMessage");  
66      print "CONTENT-TYPE: text/html\n\n";      print "CONTENT-TYPE: text/html\n\n";
67      ScriptFinish("Simple_tmpl.php", $varHash);      print "<html><body>\n";
68        print $cgi->h3("Error in redirection: $errorMessage") . "\n";
69        print "</body></html>\n\n";
70  }  }
71    
72  1;  1;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.6

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3