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

Annotation of /FigWebServices/RandomTest.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (view) (download)

1 : parrello 1.1 #!/usr/bin/perl -w
2 :    
3 :     #
4 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
5 :     # for Interpretations of Genomes. All Rights Reserved.
6 :     #
7 :     # This file is part of the SEED Toolkit.
8 :     #
9 :     # The SEED Toolkit is free software. You can redistribute
10 :     # it and/or modify it under the terms of the SEED Toolkit
11 :     # Public License.
12 :     #
13 :     # You should have received a copy of the SEED Toolkit Public License
14 :     # along with this program; if not write to the University of Chicago
15 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
16 :     # Genomes at veronika@thefig.info or download a copy from
17 :     # http://www.theseed.org/LICENSE.TXT.
18 :     #
19 :    
20 :     use strict;
21 :     use Tracer qw(:DEFAULT PrintLine);
22 :     use FIG_CGI;
23 : parrello 1.2 use FIG;
24 : parrello 1.1 use TestUtils;
25 :     use Time::HiRes;
26 :    
27 :     =head1 RandomTest Script
28 :    
29 :     This is a simple script that tests something in the sprout and produces the
30 :     output as an HTML table. It's function, parameters, and purpose will change at
31 :     random intervals.
32 :    
33 :     The following CGI parameters are used.
34 :    
35 :     =over 4
36 :    
37 :     =item genome
38 :    
39 :     ID of a genome to be used in the test
40 :    
41 :     =item fid
42 :    
43 :     ID of a feature to be used in the test
44 :    
45 :     =item ssa
46 :    
47 :     ID of a subsystem to be used in the test
48 :    
49 :     =back
50 :    
51 :     =cut
52 :    
53 :     # Get the CGI query object and the FIG-like object.
54 :     my($fig, $cgi, $user) = FIG_CGI::init(debug_save => 0, debug_load => 0, print_params => 0);
55 :     # Start the output page.
56 :     print CGI::header();
57 :     print CGI::start_html(-title => 'Random Sprout Test',
58 :     -style => { src => "$FIG_Config::cgi_url/Html/css/WikiConsole.css" });
59 :     # Insure we recover from errors.
60 :     eval {
61 :     # Start the page.
62 :     PrintLine(CGI::h1("Random Sprout Test Results"));
63 :     # Get the parameters.
64 :     my $genome = $cgi->param('genome') || 360108.3;
65 :     my $fid = $cgi->param('fid') || 'fig|360108.3.peg.1041';
66 :     my $ssa = $cgi->param('ssa') || "Arginine_Biosynthesis";
67 :     # Declare the result variable.
68 :     my %ret;
69 : parrello 1.2 Tracer::MemTrace("Starting test.") if T(3);
70 : parrello 1.1 my $start = time();
71 :     ## CODE BEING TESTED
72 : parrello 1.2 my $sprout = $fig->{sprout};
73 :     my $fl = $sprout->Loader('Feature', {});
74 :     $fl->ProcessSection($genome);
75 :     $ret{loader} = $fl;
76 : parrello 1.1 ## END OF CODE BEING TESTED
77 :     my $duration = time() - $start;
78 : parrello 1.2 Tracer::MemTrace("Test completed.") if T(3);
79 : parrello 1.1 PrintLine(CGI::p("Execution time was $duration seconds."));
80 :     # Display the results in matrix format.
81 :     print TestUtils::Display(\%ret, 'Matrix');
82 :     };
83 :    
84 :     if ($@) {
85 :     # Here we have a fatal error. Save the message.
86 :     my $errorText = "SCRIPT ERROR: $@";
87 :     # Issue a feed event.
88 :     Warn($errorText);
89 :     # Output the error message.
90 :     PrintLine CGI::pre($errorText);
91 :     }
92 :     # Close the page.
93 :     PrintLine CGI::end_html();
94 :    
95 :    
96 :     1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3