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

Annotation of /FigWebServices/SimPieces.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (view) (download)

1 : parrello 1.1 #!/usr/bin/perl -w
2 :     #
3 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
4 :     # for Interpretations of Genomes. All Rights Reserved.
5 :     #
6 :     # This file is part of the SEED Toolkit.
7 : parrello 1.4 #
8 : parrello 1.1 # The SEED Toolkit is free software. You can redistribute
9 :     # it and/or modify it under the terms of the SEED Toolkit
10 : parrello 1.4 # Public License.
11 : parrello 1.1 #
12 :     # You should have received a copy of the SEED Toolkit Public License
13 :     # along with this program; if not write to the University of Chicago
14 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
15 :     # Genomes at veronika@thefig.info or download a copy from
16 :     # http://www.theseed.org/LICENSE.TXT.
17 :     #
18 :    
19 :    
20 :     BEGIN {
21 :     # Print the HTML header.
22 :     print "CONTENT-TYPE: text/html\n\n";
23 :     }
24 :    
25 :     =head1 Similarity Block Piece Display
26 :    
27 :     This script processes input from the C<SimBlockForm.cgi> script's web page and
28 :     produces a list of similarity block pieces that are within a specified distance
29 :     if the specified feature.
30 :    
31 :     For debugging purposes, you can specify the B<Trace> parameter to
32 :     set the tracing level. So, for example,
33 :    
34 : parrello 1.4 http://myseedurl/CGI/SimPieces.cgi?Trace=3
35 : parrello 1.1
36 :     runs the standard processing script at a trace level of 3. Normally, only the
37 :     script itself and B<Tracer> tracing is active; however, you can activate other tracing modules
38 :     by appending them to the trace level. Thus,
39 :    
40 : parrello 1.4 http://myseedurl/CGI/SimPieces.cgi?Trace=3%20SimBlocks%20ERDBObject
41 : parrello 1.1
42 :     activates tracing for the similarity block module (C<SimBlocks.pm>) and the data
43 : parrello 1.3 base object (C<ERDBObject.pm>).
44 : parrello 1.1
45 :     =cut
46 :    
47 :     use strict;
48 :     use CGI;
49 :     use Tracer;
50 :     use PageBuilder;
51 :     use SimBlocks;
52 :    
53 :     # Set up this script.
54 : parrello 1.5 my ($query, $varHash) = Tracer::ScriptSetup();
55 : parrello 1.1 # Do this next part safely.
56 :     eval {
57 :     # Get the incoming feature ID and the distance.
58 :     my $featureID = $query->param("Feature");
59 :     my $distance = $query->param("Distance");
60 :     $varHash->{distance} = $distance;
61 :     $varHash->{source} = $featureID;
62 :     # Get the similarity block and FIG objects.
63 :     my $fig = FIG->new();
64 :     my $simdb = SimBlocks->new();
65 :     # Get the list of pieces.
66 :     my @pieces = $simdb->GetFeatureBlockPieces($fig, [$featureID], $distance);
67 :     # Now we build the rows into a single string using the SimBlockPiecesFragment
68 :     # template.
69 :     my $template = Tracer::GetFile("Html/SimBlockPiecesFragment.html");
70 :     my $rows = "";
71 :     for my $piece (@pieces) {
72 : parrello 1.2 # Get the data for the specified block.
73 :     my $blockObject = $simdb->GetBlock($piece->Contig);
74 :     my ($blockName) = $blockObject->Value('GroupBlock(description)');
75 : parrello 1.4 $rows .= PageBuilder::Build($template,
76 : parrello 1.1 { blockID => $piece->Contig,
77 : parrello 1.2 blockName => $blockName,
78 : parrello 1.1 start => $piece->Left,
79 :     end => $piece->Right,
80 :     len => $piece->Length },
81 :     "Html");
82 :     }
83 :     # Put all this data into the variable hash.
84 :     $varHash->{rows} = $rows;
85 :     };
86 :     # Check for an error from the EVAL.
87 :     if ($@) {
88 :     Trace("Script error: $@") if T(0);
89 :     }
90 : parrello 1.5 Tracer::ScriptFinish("Html/SimBlockPieces.html", $varHash);
91 : parrello 1.1
92 :    
93 : parrello 1.4 1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3