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

Annotation of /FigWebServices/SimBlockPattern.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (view) (download)

1 : parrello 1.1 #!/usr/bin/perl -w
2 :    
3 :     BEGIN {
4 :     # Print the HTML header.
5 :     print "CONTENT-TYPE: text/html\n\n";
6 :     }
7 :    
8 :     =head1 Similarity Block Alignment Display
9 :    
10 :     This script generates a table displaying the contents of a similarity block in the
11 :     form of an alignment between the regions in the block. The basic idea is that
12 :     we get all the regions in the specified block and display the ones belonging to
13 :     genomes selected in the scrolling lists for the sets. The individual regions will
14 :     be shown as rows in a table. Each row will be created from a template fragment.
15 :     The base page uses a style sheet that has a special style called C<dna> for the
16 :     DNA display in the table row. The C<em> tag will be applied to the columns that
17 :     vary inside the block so that they are more easily detected. These columns are
18 :     identified by question marks in the block pattern found in the original block
19 :     record.
20 :    
21 :     For debugging purposes, you can specify the B<Trace> parameter to
22 :     set the tracing level. You can also set the B<ShowMode> parameter to
23 :     C<1> to display a table of the parameters passed by the form. So,
24 :     for example,
25 :    
26 :     C<< http://myseedurl/CGI/SimBlockPattern.cgi?Trace=3 >>
27 :    
28 :     runs the standard processing script at a trace level of 3. Normally, only the
29 :     script itself and B<Tracer> tracing is active; however, you can activate other tracing modules
30 :     by appending them to the trace level. Thus,
31 :    
32 :     C<< http://myseedurl/CGI/SimBlockPattern.cgi?Trace=3%20SimBlocks%20DBObject >>
33 :    
34 :     activates tracing for the similarity block module (C<SimBlocks.pm>) and the data
35 :     base object (C<DBObject.pm>).
36 :    
37 :     =cut
38 :    
39 :     use strict;
40 :     use CGI;
41 :     use Tracer;
42 :     use PageBuilder;
43 :     use SimBlocks;
44 :    
45 :     # Get the CGI parameters.
46 :     my $query = new CGI;
47 :     my $traceLevel = $query->param("Trace");
48 :     if (!defined $traceLevel || length $traceLevel == 0) {
49 :     $traceLevel = "0";
50 :     }
51 :     TSetup("$traceLevel Tracer", "QUEUE");
52 :    
53 :     # Our first task is to get the parameters. We need a list of the IDs of the selected
54 :     # genomes. These lists will be found in the "set1Genomes" and "set2Genomes" parameters.
55 :    
56 :     my @genomes = ();
57 :     push @genomes, $query->param("set1Genomes"), $query->param("set2Genomes");
58 :    
59 :     # Next, we need to get the block ID. The block ID is going to be the value of the
60 :     # "set1Blocks", "set2Blocks", or "bothBlocks" parameter, depending on whether the
61 :     # "set1Button", "set2Button", or "bothButton" parameter is present.
62 :     my $blockID;
63 :     for my $setID ('set1', 'both', 'set2') {
64 :     my $thisBlockID = $query->param("${setID}Blocks");
65 :     if ($thisBlockID && $query->param("${setID}Button")) {
66 :     $blockID = $thisBlockID;
67 :     }
68 :     }
69 :     Trace("Block $blockID selected for genomes " . join ", ", @genomes) if T(2);
70 :     # Now we have all the information we need to produce the alignment. We need to
71 :     # create the similarity block object and start the web page.
72 :     my $simBlock = SimBlocks->new();
73 :     my $builder = PageBuilder::new("Html/SimBlockPattern.html", {}, "Html");
74 :     # Protect against errors.
75 :     eval {
76 :     # Next we need the template fragment for the rows.
77 :     my $rowFragment = Tracer::GetFile("Html/SimBlockPatternRow.html");
78 :     # Get the block from the similarity block database and extract its pattern.
79 :     my $blockData = $simBlock->GetEntity('GroupBlock', $blockID);
80 :     my ($pattern) = $blockData->Value('GroupBlock(pattern)');
81 :     # Get the regions for the block.
82 :     my %regions = $simBlock->GetRegions($blockID, \@genomes);
83 :     for my $region (sort keys %regions) {
84 :     my $dna = $regions{$region};
85 :     # Mark the variant columns with EM tags.
86 :     $dna = SimBlocks::TagDNA($pattern, $dna, "<em>", "</em>");
87 :     # Create a table row for this region.
88 :     my $row = PageBuilder::Build($rowFragment, { region => $region,
89 :     dna => $dna }, "Html");
90 :     print $row;
91 :     }
92 :     };
93 :     # Trace any error that occurred.
94 :     if ($@) {
95 :     Trace($@) if T(0);
96 :     }
97 :     # Write out any trace messages.
98 :     my $qtrace = QTrace("html");
99 :     print $qtrace;
100 :     # Finish the web page.
101 :     $builder->Finish();
102 :    
103 :     1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3