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

Annotation of /FigWebServices/link.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (view) (download)

1 : parrello 1.1 #!/usr/bin/perl -w
2 :    
3 :     =head1 Protein Page Link
4 :    
5 : parrello 1.5 This is a simple redirection script that takes a string as input and opens
6 :     the appropriate page.
7 : parrello 1.1
8 :     This script supports the following CGI query parameters.
9 :    
10 :     =over 4
11 :    
12 :     =item id
13 :    
14 : parrello 1.2 ID of the desired feature. This can be a FIG ID or an alias. If it is preceded
15 : parrello 1.5 by C<nmpdr|>, then we will try to force the Sprout protein page.
16 :    
17 :     =item sop
18 :    
19 :     ID of a procedure in the SEED wiki.
20 : parrello 1.1
21 :     =back
22 :    
23 :     =cut
24 :    
25 :     use strict;
26 :     use Tracer;
27 :     use CGI;
28 :     use URI::Escape;
29 :    
30 : disz 1.4 my $url;
31 :    
32 : parrello 1.2 my $cgi = CGI->new();
33 :     ETracing($cgi);
34 : parrello 1.1 eval {
35 : parrello 1.6 # Get the possible IDs.
36 : disz 1.4 my $sopID = $cgi->param('sop');
37 : parrello 1.6 my $genomeID = $cgi->param('genome');
38 :     my $pegID = $cgi->param('id');
39 : disz 1.4 if ($sopID) {
40 : parrello 1.6 # This is for the annotation SOP.
41 : parrello 1.5 if ($sopID =~ /SOP010/i) {
42 : parrello 1.6 $url = "http://www.theseed.org/w/images/2/23/Annotation_sop.pdf";
43 : parrello 1.5 } else {
44 : parrello 1.6 Confess("Invalid SOP number");
45 : parrello 1.5 }
46 : parrello 1.6 } 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 : disz 1.4 } else {
55 : parrello 1.6 Confess("Unrecognized identifier.");
56 : disz 1.4 }
57 : parrello 1.6 print $cgi->redirect(-uri => $url);
58 : parrello 1.1 };
59 :     if ($@) {
60 :     # Get the error message.
61 :     my $errorMessage = $@;
62 :     Trace("Script Error: $errorMessage") if T(0);
63 :     # Display the error message. Note that unlike most situations,
64 :     # we have to write a content header. This is because we have a
65 : parrello 1.2 # redirection script rather than a standard CGI script.
66 : parrello 1.1 print "CONTENT-TYPE: text/html\n\n";
67 : parrello 1.2 print "<html><body>\n";
68 :     print $cgi->h3("Error in redirection: $errorMessage") . "\n";
69 :     print "</body></html>\n\n";
70 : parrello 1.1 }
71 :    
72 :     1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3