[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.7, Fri May 11 06:30:48 2007 UTC revision 1.8, Thu May 17 23:43:57 2007 UTC
# Line 152  Line 152 
152      # See if there's already a PDB selected.      # See if there's already a PDB selected.
153      my $defaultPDB = $cgi->param('PDB');      my $defaultPDB = $cgi->param('PDB');
154      # Create the PDB selection strings.      # Create the PDB selection strings.
155      my @pdbStrings = map { "$_->[0], $_->[1] docking results" } @pdbData;      my %pdbStrings = map { $_->[0] => "$_->[0], $_->[1] docking results" } @pdbData;
156        my @pdbNames = map { $_->[0] } @pdbData;
157      # Compute the number of rows to display in the selection list.      # Compute the number of rows to display in the selection list.
158      my $rowCount = (scalar(@pdbStrings) < 20 ? scalar(@pdbStrings) : 20);      my $rowCount = (scalar(@pdbNames) < 20 ? scalar(@pdbNames) : 20);
159      # Convert the PDB list into a selection list.      # Convert the PDB list into a selection list.
160      my $menu = $cgi->popup_menu(-name => 'PDB', -values => \@pdbStrings,      my $menu = $cgi->popup_menu(-name => 'PDB', -values => \@pdbNames,
161                                    -labels => \%pdbStrings,
162                                  -default => $defaultPDB, -rows => $rowCount);                                  -default => $defaultPDB, -rows => $rowCount);
163      # Build a table from the PDB list and the submit row.      # Build a table from the PDB list and the submit row.
164      my @rows = ($cgi->Tr($cgi->th('Project'), $cgi->td($menu)),      my @rows = ($cgi->Tr($cgi->th('Project'), $cgi->td($menu)),
# Line 199  Line 201 
201          $self->OpenSession();          $self->OpenSession();
202          # Initialize the result counter.          # Initialize the result counter.
203          $retVal = 0;          $retVal = 0;
204          PrintLine("Finding docking results for $pdbID.");          $self->PrintLine("Finding docking results for $pdbID.");
205          # Get a query that will return the docking results for this PDB.          # Get a query that will return the docking results for this PDB.
206          my $query= $sprout->Get(['DocksWith', 'Ligand'],          my $query= $sprout->Get(['DocksWith', 'Ligand'],
207                                  "DocksWith(from-link) = ?",                                  "DocksWith(from-link) = ? ORDER BY DocksWith(total-energy)",
208                                  [$pdbID]);                                  [$pdbID]);
209          # Write the column headers.          # Write the column headers.
210          $self->WriteColumnHeaders("ZINC ID", "Ligand", "Total Energy", "Electrostatic", "Van der Waals", "Tool");          $self->WriteColumnHeaders("ZINC ID", "Total Energy", "Electrostatic", "Van der Waals", "Tool");
211          PrintLine("Processing results.");          $self->PrintLine("Processing results.");
         my $rowCount = 0;  
212          # Loop through the results.          # Loop through the results.
213          while (my $record = $query->Fetch()) {          while (my $record = $query->Fetch()) {
214              # Get the data for this row.              # Get the data for this row.
215              my @data = $record->Values(['Ligand(id)', 'Ligand(name)', 'DocksWith(electrostatic-energy)',              my ($id, $name, $total, $electro, $vander, $tool) = $record->Values(['Ligand(id)', 'Ligand(name)',
216                                          'DocksWidth(vanderwaals-energy)', 'DocksWith(tool)']);                                                                                   'DocksWith(total-energy)',
217              # Write it to the session file.                                                                                   'DocksWith(electrostatic-energy)',
218              $self->WriteColumnData(@data);                                                                                   'DocksWith(vanderwalls-energy)',
219                                                                                     'DocksWith(tool)']);
220                # Format the energy results so they don't look so awful.
221                my @data = map { sprintf('%.2f', $_) } ($total, $electro, $vander);
222                # Create a tooltip for the ligand name.
223                my $linkedID = $cgi->a({ href => "http://blaster.docking.org/zinc/srchdbk.pl?zinc=$id;go=Query",
224                                         title => $name }, $id);
225                # Finally, we must compute the sort key. We're getting the records in the correct order, so
226                # the sort key is the ordinal of this record, which we are keeping in $retVal.
227                my $key = $retVal;
228                # Write everything to the session file.
229                $self->WriteColumnData($retVal, $id, $linkedID, @data, $tool);
230              # See if we need to update the user.              # See if we need to update the user.
231              $rowCount++;              $retVal++;
232              if ($rowCount % 1000 == 0) {              if ($retVal % 1000 == 0) {
233                  PrintLine("$rowCount ligands processed.");                  $self->PrintLine("$retVal ligands processed.");
234              }              }
235          }          }
236            Trace("$retVal rows processed.") if T(3);
237          # Close the session file.          # Close the session file.
238          $self->CloseSession();          $self->CloseSession();
239      }      }
# Line 258  Line 271 
271      # Get the parameters.      # Get the parameters.
272      my ($self) = @_;      my ($self) = @_;
273      # Return the result.      # Return the result.
274      return "Show the PDB and gene relationships for a specified drug target analysis project.";      return "Show the docking results for a specific PDB.";
275  }  }
276    
277  =head3 SearchTitle  =head3 SearchTitle
# Line 313  Line 326 
326      return $retVal;      return $retVal;
327  }  }
328    
329    =head3 ColumnTitle
330    
331    C<< my $title = $shelp->ColumnTitle($colName); >>
332    
333    Return the column heading title to be used for the specified column name.
334    In this case, we just return the column name unmodified.
335    
336    =over 4
337    
338    =item colName
339    
340    Name of the desired column.
341    
342    =item RETURN
343    
344    Returns the title to be used as the column header for the named column.
345    
346    =back
347    
348    =cut
349    
350    sub ColumnTitle {
351        my ($self, $colName) = @_;
352        return $colName;
353    }
354    
355    
356  1;  1;

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3