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

View of /FigWebServices/SimPieces.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (annotate)
Fri Jan 13 06:58:02 2006 UTC (14 years, 4 months ago) by parrello
Branch: MAIN
CVS Tags: caBIG-05Apr06-00, caBIG-13Feb06-00
Changes since 1.1: +4 -0 lines
Updated to display the block name instead of the ID in the piece list.

#!/usr/bin/perl -w
#
# Copyright (c) 2003-2006 University of Chicago and Fellowship
# for Interpretations of Genomes. All Rights Reserved.
#
# This file is part of the SEED Toolkit.
# 
# The SEED Toolkit is free software. You can redistribute
# it and/or modify it under the terms of the SEED Toolkit
# Public License. 
#
# You should have received a copy of the SEED Toolkit Public License
# along with this program; if not write to the University of Chicago
# at info@ci.uchicago.edu or the Fellowship for Interpretation of
# Genomes at veronika@thefig.info or download a copy from
# http://www.theseed.org/LICENSE.TXT.
#


BEGIN {
    # Print the HTML header.
    print "CONTENT-TYPE: text/html\n\n";
}

=head1 Similarity Block Piece Display

This script processes input from the C<SimBlockForm.cgi> script's web page and
produces a list of similarity block pieces that are within a specified distance
if the specified feature.

For debugging purposes, you can specify the B<Trace> parameter to
set the tracing level. So, for example,

C<< http://myseedurl/CGI/SimPieces.cgi?Trace=3 >>

runs the standard processing script at a trace level of 3. Normally, only the
script itself and B<Tracer> tracing is active; however, you can activate other tracing modules
by appending them to the trace level. Thus,

C<< http://myseedurl/CGI/SimPieces.cgi?Trace=3%20SimBlocks%20DBObject >>

activates tracing for the similarity block module (C<SimBlocks.pm>) and the data
base object (C<DBObject.pm>).

=cut

use strict;
use CGI;
use Tracer;
use PageBuilder;
use SimBlocks;

# Set up this script.
my ($query, $varHash) = ScriptSetup();
# Do this next part safely.
eval {
    # Get the incoming feature ID and the distance.
    my $featureID = $query->param("Feature");
    my $distance = $query->param("Distance");
    $varHash->{distance} = $distance;
    $varHash->{source} = $featureID;
    # Get the similarity block and FIG objects.
    my $fig = FIG->new();
    my $simdb = SimBlocks->new();
    # Get the list of pieces.
    my @pieces = $simdb->GetFeatureBlockPieces($fig, [$featureID], $distance);
    # Now we build the rows into a single string using the SimBlockPiecesFragment
    # template.
    my $template = Tracer::GetFile("Html/SimBlockPiecesFragment.html");
    my $rows = "";
    for my $piece (@pieces) {
        # Get the data for the specified block.
        my $blockObject = $simdb->GetBlock($piece->Contig);
        my ($blockName) = $blockObject->Value('GroupBlock(description)');
        $rows .= PageBuilder::Build($template, 
                                    { blockID => $piece->Contig,
                                      blockName => $blockName,
                                      start => $piece->Left,
                                      end => $piece->Right,
                                      len => $piece->Length },
                                    "Html");
    }
    # Put all this data into the variable hash.
    $varHash->{rows} = $rows;
};
# Check for an error from the EVAL.
if ($@) {
    Trace("Script error: $@") if T(0);
}
ScriptFinish("Html/SimBlockPieces.html", $varHash);


1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3