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

Diff of /Sprout/SHDrugSearch.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8, Thu May 17 23:43:57 2007 UTC revision 1.9, Mon Jul 16 20:04:51 2007 UTC
# Line 4  Line 4 
4    
5      use strict;      use strict;
6      use Tracer;      use Tracer;
     use SearchHelper;  
7      use CGI;      use CGI;
8      use HTML;      use HTML;
9      use Sprout;      use Sprout;
10      use FeatureData;      use RHLigands;
11      use FeatureQuery;      use base 'SearchHelper';
   
     our @ISA = qw(SearchHelper);  
12    
13  =head1 Drug Target PDB Docking Results Search Helper  =head1 Drug Target PDB Docking Results Search Helper
14    
# Line 197  Line 194 
194      if (! $pdbID) {      if (! $pdbID) {
195          $self->SetMessage("No PDB specified.");          $self->SetMessage("No PDB specified.");
196      } else {      } else {
197            # Get the ligand result helper.
198            my $rhelp = RHLigands->new();
199            # Set the default output columns.
200            $self->DefaultColumns($rhelp);
201            # Add the extra columns, most of which are taking from DocksWith.
202            $rhelp->AddExtraColumn(energy        => undef, title => 'Total Energy',  style => 'rightAlign', download => 'num');
203            $rhelp->AddExtraColumn(electrostatic => undef, title => 'Electrostatic', style => 'rightAlign', download => 'num');
204            $rhelp->AddExtraColumn(vanderwaals   => undef, title => 'Van der Waals', style => 'rightAlign', download => 'num');
205            $rhelp->AddExtraColumn(tool          => undef, title => 'Tool',          style => 'leftAlign',  download => 'text');
206          # Initialize the session file.          # Initialize the session file.
207          $self->OpenSession();          $self->OpenSession($rhelp);
208          # Initialize the result counter.          # Initialize the result counter.
209          $retVal = 0;          $retVal = 0;
210          $self->PrintLine("Finding docking results for $pdbID.");          $self->PrintLine("Finding docking results for $pdbID.");
# Line 207  Line 213 
213                                  "DocksWith(from-link) = ? ORDER BY DocksWith(total-energy)",                                  "DocksWith(from-link) = ? ORDER BY DocksWith(total-energy)",
214                                  [$pdbID]);                                  [$pdbID]);
215          # Write the column headers.          # Write the column headers.
         $self->WriteColumnHeaders("ZINC ID", "Total Energy", "Electrostatic", "Van der Waals", "Tool");  
216          $self->PrintLine("Processing results.");          $self->PrintLine("Processing results.");
217          # Loop through the results.          # Loop through the results.
218          while (my $record = $query->Fetch()) {          while (my $record = $query->Fetch()) {
219              # Get the data for this row.              # Get the data for this row.
220              my ($id, $name, $total, $electro, $vander, $tool) = $record->Values(['Ligand(id)', 'Ligand(name)',              my ($id, $total, $electro, $vander, $tool) = $record->Values(['Ligand(id)',
221                                                                                   'DocksWith(total-energy)',                                                                                   'DocksWith(total-energy)',
222                                                                                   'DocksWith(electrostatic-energy)',                                                                                   'DocksWith(electrostatic-energy)',
223                                                                                   'DocksWith(vanderwalls-energy)',                                                                                   'DocksWith(vanderwalls-energy)',
224                                                                                   'DocksWith(tool)']);                                                                                   'DocksWith(tool)']);
225              # Format the energy results so they don't look so awful.              # Format the energy results so they don't look so awful.
226              my @data = map { sprintf('%.2f', $_) } ($total, $electro, $vander);              ($total, $electro, $vander) = map { sprintf('%.2f', $_) } ($total, $electro, $vander);
227              # Create a tooltip for the ligand name.              # Put the extra columns.
228              my $linkedID = $cgi->a({ href => "http://blaster.docking.org/zinc/srchdbk.pl?zinc=$id;go=Query",              $rhelp->PutExtraColumns(total => $total, electrostatic => $electro, vanderwaals => $vander,
229                                       title => $name }, $id);                                      tool => $tool);
230              # Finally, we must compute the sort key. We're getting the records in the correct order, so              # Finally, we must compute the sort key. We're getting the records in the correct order, so
231              # the sort key is the ordinal of this record, which we are keeping in $retVal.              # the sort key is the ordinal of this record, which we are keeping in $retVal.
232              my $key = $retVal;              my $key = $retVal;
233              # Write everything to the session file.              # Write everything to the session file.
234              $self->WriteColumnData($retVal, $id, $linkedID, @data, $tool);              $rhelp->PutData($key, $id, $record);
235              # See if we need to update the user.              # See if we need to update the user.
236              $retVal++;              $retVal++;
237              if ($retVal % 1000 == 0) {              if ($retVal % 1000 == 0) {
# Line 241  Line 246 
246      return $retVal;      return $retVal;
247  }  }
248    
 =head3 DefaultFeatureColumns  
   
 C<< my @cols = $shelp->DefaultFeatureColumns(); >>  
   
 This method returns a list of the descriptors for the columns to be  
 displayed by this search, overriding the standard column set.  
   
 =cut  
   
 sub DefaultFeatureColumns {  
     # Get the parameters.  
     my ($self) = @_;  
     # Return the result.  
     return qw(orgName function protlink);  
 }  
   
249  =head3 Description  =head3 Description
250    
251  C<< my $htmlText = $shelp->Description(); >>  C<< my $htmlText = $shelp->Description(); >>
# Line 295  Line 284 
284      return $retVal;      return $retVal;
285  }  }
286    
 =head3 DownloadFormatAvailable  
   
 C<< my $okFlag = $shelp->DownloadFormatAvailable($format); >>  
   
 This method returns TRUE if a specified download format is legal for this type of search  
 and FALSE otherwise. For any feature-based search, there is no need to override this  
 method.  
   
 =over 4  
   
 =item format  
   
 Download format type code.  
   
 =item RETURN  
   
 Returns TRUE if the download format is legal for this search and FALSE otherwise.  
   
 =back  
   
 =cut  
   
 sub DownloadFormatAvailable {  
     # Get the parameters.  
     my ($self, $format) = @_;  
     # Declare the return variable.  
     my $retVal = ($format eq 'tbl');  
     # Return the result.  
     return $retVal;  
 }  
   
 =head3 ColumnTitle  
   
 C<< my $title = $shelp->ColumnTitle($colName); >>  
   
 Return the column heading title to be used for the specified column name.  
 In this case, we just return the column name unmodified.  
   
 =over 4  
   
 =item colName  
   
 Name of the desired column.  
   
 =item RETURN  
   
 Returns the title to be used as the column header for the named column.  
   
 =back  
   
 =cut  
   
 sub ColumnTitle {  
     my ($self, $colName) = @_;  
     return $colName;  
 }  
   
   
287  1;  1;

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3