#!/usr/bin/perl -w =head1 Protein Page Link This is a simple redirection script that takes a string as input and opens the appropriate page. This script supports the following CGI query parameters. =over 4 =item id ID of the desired feature. This can be a FIG ID or an alias. If it is preceded by C, then we will try to force the Sprout protein page. =item sop ID of a procedure in the SEED wiki. =back =cut use strict; use Tracer; use CGI; use URI::Escape; my $url; my $cgi = CGI->new(); ETracing($cgi); eval { # Get the possible IDs. my $sopID = $cgi->param('sop'); my $genomeID = $cgi->param('genome'); my $pegID = $cgi->param('id'); if ($sopID) { # This is for the annotation SOP. if ($sopID =~ /SOP010/i) { $url = "http://www.theseed.org/w/images/2/23/Annotation_sop.pdf"; } else { Confess("Invalid SOP number"); } } elsif ($genomeID) { # Here we have an organism ID. my $escapedID = uri_escape($genomeID); $url = "$FIG_Config::nmpdr_site_url/FIG/seedviewer.cgi?page=BrowseGenome&organism=$escapedID"; } elsif ($pegID) { # Here we have a PEG ID. my $escapedID = uri_escape($1); $url = "$FIG_Config::nmpdr_site_url/FIG/seedviewer.cgi?page=Annotation&feature=$escapedID" } else { Confess("Unrecognized identifier."); } print $cgi->redirect(-uri => $url); }; if ($@) { # Get the error message. my $errorMessage = $@; Trace("Script Error: $errorMessage") if T(0); # Display the error message. Note that unlike most situations, # we have to write a content header. This is because we have a # redirection script rather than a standard CGI script. print "CONTENT-TYPE: text/html\n\n"; print "\n"; print $cgi->h3("Error in redirection: $errorMessage") . "\n"; print "\n\n"; } 1;