[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.10, Mon Aug 20 23:23:21 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 Tracer;
12        use base 'SearchHelper';
     our @ISA = qw(SearchHelper);  
13    
14  =head1 Drug Target PDB Docking Results Search Helper  =head1 Drug Target PDB Docking Results Search Helper
15    
# Line 197  Line 195 
195      if (! $pdbID) {      if (! $pdbID) {
196          $self->SetMessage("No PDB specified.");          $self->SetMessage("No PDB specified.");
197      } else {      } else {
198            # Get the ligand result helper.
199            my $rhelp = RHLigands->new($self);
200            # Set the default output columns.
201            $self->DefaultColumns($rhelp);
202            # Add the extra columns, most of which are taking from DocksWith.
203            $rhelp->AddExtraColumn(energy        => undef, title => 'Total Energy',  style => 'rightAlign', download => 'num');
204            $rhelp->AddExtraColumn(electrostatic => undef, title => 'Electrostatic', style => 'rightAlign', download => 'num');
205            $rhelp->AddExtraColumn(vanderwaals   => undef, title => 'Van der Waals', style => 'rightAlign', download => 'num');
206            $rhelp->AddExtraColumn(tool          => undef, title => 'Tool',          style => 'leftAlign',  download => 'text');
207          # Initialize the session file.          # Initialize the session file.
208          $self->OpenSession();          $self->OpenSession($rhelp);
209          # Initialize the result counter.          # Initialize the result counter.
210          $retVal = 0;          $retVal = 0;
211          $self->PrintLine("Finding docking results for $pdbID.");          $self->PrintLine("Finding docking results for $pdbID.");
# Line 207  Line 214 
214                                  "DocksWith(from-link) = ? ORDER BY DocksWith(total-energy)",                                  "DocksWith(from-link) = ? ORDER BY DocksWith(total-energy)",
215                                  [$pdbID]);                                  [$pdbID]);
216          # Write the column headers.          # Write the column headers.
         $self->WriteColumnHeaders("ZINC ID", "Total Energy", "Electrostatic", "Van der Waals", "Tool");  
217          $self->PrintLine("Processing results.");          $self->PrintLine("Processing results.");
218          # Loop through the results.          # Loop through the results.
219          while (my $record = $query->Fetch()) {          while (my $record = $query->Fetch()) {
220              # Get the data for this row.              # Get the data for this row.
221              my ($id, $name, $total, $electro, $vander, $tool) = $record->Values(['Ligand(id)', 'Ligand(name)',              my ($id, $total, $electro, $vander, $tool) = $record->Values(['Ligand(id)',
222                                                                                   'DocksWith(total-energy)',                                                                                   'DocksWith(total-energy)',
223                                                                                   'DocksWith(electrostatic-energy)',                                                                                   'DocksWith(electrostatic-energy)',
224                                                                                   'DocksWith(vanderwalls-energy)',                                                                                   'DocksWith(vanderwalls-energy)',
225                                                                                   'DocksWith(tool)']);                                                                                   'DocksWith(tool)']);
226              # Format the energy results so they don't look so awful.              # Format the energy results so they don't look so awful.
227              my @data = map { sprintf('%.2f', $_) } ($total, $electro, $vander);              ($total, $electro, $vander) = map { sprintf('%.2f', $_) } ($total, $electro, $vander);
228              # Create a tooltip for the ligand name.              # Put the extra columns.
229              my $linkedID = $cgi->a({ href => "http://blaster.docking.org/zinc/srchdbk.pl?zinc=$id;go=Query",              $rhelp->PutExtraColumns(energy => $total, electrostatic => $electro, vanderwaals => $vander,
230                                       title => $name }, $id);                                      tool => $tool);
231              # 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
232              # 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.
233              my $key = $retVal;              my $key = $retVal;
234              # Write everything to the session file.              # Write everything to the session file.
235              $self->WriteColumnData($retVal, $id, $linkedID, @data, $tool);              $rhelp->PutData($key, $id, $record);
236              # See if we need to update the user.              # See if we need to update the user.
237              $retVal++;              $retVal++;
238              if ($retVal % 1000 == 0) {              if ($retVal % 1000 == 0) {
# Line 241  Line 247 
247      return $retVal;      return $retVal;
248  }  }
249    
 =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);  
 }  
   
250  =head3 Description  =head3 Description
251    
252  C<< my $htmlText = $shelp->Description(); >>  C<< my $htmlText = $shelp->Description(); >>
# Line 295  Line 285 
285      return $retVal;      return $retVal;
286  }  }
287    
 =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;  
 }  
   
   
288  1;  1;

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3