[Bio] / Sprout / RHLigands.pm Repository:
ViewVC logotype

View of /Sprout/RHLigands.pm

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.4 - (download) (as text) (annotate)
Mon Jan 19 21:56:19 2009 UTC (11 years, 5 months ago) by parrello
Branch: MAIN
CVS Tags: mgrast_dev_08112011, mgrast_dev_08022011, rast_rel_2014_0912, mgrast_dev_04082011, rast_rel_2010_0928, mgrast_version_3_2, mgrast_dev_12152011, mgrast_dev_06072011, rast_rel_2009_0925, rast_rel_2010_0526, rast_rel_2014_0729, rast_rel_2009_05_18, rast_rel_2010_1206, mgrast_release_3_0, mgrast_dev_03252011, rast_rel_2010_0118, rast_rel_2009_02_05, rast_rel_2011_0119, mgrast_release_3_0_4, mgrast_release_3_0_2, mgrast_release_3_0_3, mgrast_release_3_0_1, mgrast_dev_03312011, mgrast_release_3_1_2, mgrast_release_3_1_1, mgrast_release_3_1_0, mgrast_dev_04132011, mgrast_dev_04012011, rast_rel_2009_07_09, rast_rel_2010_0827, myrast_33, rast_rel_2011_0928, mgrast_dev_04052011, rast_rel_2009_03_26, mgrast_dev_10262011, HEAD
Changes since 1.3: +35 -3 lines
Improved search result support.

#!/usr/bin/perl -w

package RHLigands;

    use strict;
    use Tracer;
    use ERDBObject;
    use POSIX;
    use base 'ResultHelper';

=head1 Ligand Result Helper

=head2 Introduction

This result helper allows a search to display data about ligands. Currently,
there is very little data about a ligand in the database. The only
column we support is the ligand ID formatted with the name as a tooltip.

=head2 Public Methods

=head3 new

    my $rhelp = RHLigands->new($shelp);

Construct a new RHLigands object.

=over 4

=item shelp

Parent search helper object for this result helper.



sub new {
    # Get the parameters.
    my ($class, $shelp) = @_;
    # Create and bless the helper object.
    my $retVal = ResultHelper::new($class, $shelp);
    # Bless and return it.
    bless $retVal, $class;
    return $retVal;

=head3 DefaultResultColumns

    my @colNames = $rhelp->DefaultResultColumns();

Return a list of the default columns to be used by searches with this
type of result. Note that the actual default columns are computed by
the search helper. This method is only needed if the search helper doesn't

The columns returned should be in the form of column names, all of which
must be defined by the result helper class.


sub DefaultResultColumns {
    return qw(zincId);

=head3 Permanent

    my $flag = $rhelp->Permanent($colName);

Return TRUE if the specified column should be permanent when used in a
Seed Viewer table, else FALSE.

=over 4

=item colName

Name of the column to check.

=item RETURN

Returns TRUE if the column should be permanent, else FALSE.



sub Permanent {
    # Get the parameters.
    my ($self, $colName) = @_;
    # Declare the return variable.
    my $retVal = ($colName eq 'zincId');
    # Return the result.
    return $retVal;

=head2 Column Methods

=head3 zincId

    my $colDatum = RHLigands::zincId($type => $rhelp, $key);

This method computes the various things we need to know into order to process
the zincId column.

=over 4

=item type

Type of data about the column that is required: C<title> for the column title,
C<download> for the download flag (TRUE if the field should be included in
a standard tab-delimited download file and FALSE otherwise), and so forth.

=item rhelp

Result helper being used to format the search output.

=item key (optional)

The key to be used to compute a run-time value.

=item RETURN

Returns the desired information about the zincId column.



sub zincId {
    # Get the parameters.
    my ($type, $rhelp, $key) = @_;
    # Declare the return variable.
    my $retVal;
    # Process according to the information requested.
    if ($type eq 'title') {
        # Return the title for this column.
        $retVal = 'ZINC ID';
    } elsif ($type eq 'download') {
        # This field should be included in a download.
        $retVal = 'text';
    } elsif ($type eq 'style') {
        # Here the caller wants the style class used to format this column.
        $retVal = 'leftAlign';
    } elsif ($type eq 'value') {
        # Get the ligand record.
        my $record = $rhelp->Record();
        # Extract the ID and name.
        my ($id, $name) = $record->Values(['Ligand(id)', 'Ligand(name)']);
        # Create a tooltip for the ligand name.
        $retVal = CGI::a({ href => "http://blaster.docking.org/zinc/srchdbk.pl?zinc=$id;go=Query",
                            title => $name }, $id);
    } elsif ($type eq 'runTimeValue') {
        # Runtime support is not needed for this column.
    } elsif ($type eq 'valueFromKey') {
        # We can't do a tooltip on this one, it would be too expensive.
        $retVal = CGI::a({ href => "http://blaster.docking.org/zinc/srchdbk.pl?zinc=$key;go=Query" },
    return $retVal;


MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3