[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.3, Wed Oct 25 21:06:09 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 13  Line 12 
12  =item id  =item id
13    
14  ID of the desired feature. This can be a FIG ID or an alias. If it is preceded  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. If it is preceded  by C<nmpdr|>, then we will try to force the Sprout protein page.
16  by C<sv|>, then we will try to force the Seed Viewer.  
17    =item sop
18    
19    ID of a procedure in the SEED wiki.
20    
21  =back  =back
22    
# Line 25  Line 27 
27  use CGI;  use CGI;
28  use URI::Escape;  use URI::Escape;
29    
30    my $url;
31    
32  my $cgi = CGI->new();  my $cgi = CGI->new();
33  ETracing($cgi);  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      } else {              $url = "http://www.theseed.org/w/images/2/23/Annotation_sop.pdf";
         # The code will compute a redirection URL and put it in the variable below.  
         my $url;  
         # Check for an NMPDR or SEED viewer ID.  
         if ($pegID =~ /^nmpdr\|(.+)$/) {  
             # Escape the PEG found.  
             my $escapedID = uri_escape($1);  
             # If we have an NMPDR defined, use it.  
             if ($FIG_Config::nmpdr_site_url) {  
                 $url = "$FIG_Config::nmpdr_site_url/FIG/protein.cgi?SPROUT=1;prot=$escapedID";  
43              } else {              } else {
44                  # No NMPDR, so we ask for a protein page.              Confess("Invalid SOP number");
                 $url = "protein.cgi?prot=$escapedID";  
45              }              }
46        } elsif ($genomeID) {
47            # Here we have an organism ID.
48            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 {          } else {
55              # Go to a protein page, but try to decide whether we should be SEED or Sprout.          Confess("Unrecognized identifier.");
             my $mode = $cgi->param('SPROUT');  
             if (! defined $mode) {  
                 $mode = ($FIG_Config::nmpdr_site_url ? 1 : 0);  
             }  
             my $escapedID = uri_escape($pegID);  
             $url = "protein.cgi?prot=$escapedID;SPROUT=$mode";  
56          }          }
57          print $cgi->redirect(-uri => $url);          print $cgi->redirect(-uri => $url);
     }  
58  };  };
59  if ($@) {  if ($@) {
60      # Get the error message.      # Get the error message.

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3