[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.2, Fri Nov 10 22:00:19 2006 UTC revision 1.3, Wed Nov 15 12:10:34 2006 UTC
# Line 33  Line 33 
33    
34  ID of the drug target project to display.  ID of the drug target project to display.
35    
36    =item score
37    
38    Maximum allowable score for a PDB/PEG match to be considered good
39    enough to display. The default is 1e-15.
40    
41  =back  =back
42    
43  =cut  =cut
# Line 53  Line 58 
58    
59  =head3 Form  =head3 Form
60    
61  C<< my $html = $shelp->Include(); >>  C<< my $html = $shelp->Form(); >>
62    
63  Generate the HTML for a form to request a new search.  Generate the HTML for a form to request a new search.
64    
# Line 74  Line 79 
79      # Convert the project list into a drop-down menu.      # Convert the project list into a drop-down menu.
80      my $menu = $cgi->popup_menu(-name => 'project', -values => \@projectNames,      my $menu = $cgi->popup_menu(-name => 'project', -values => \@projectNames,
81                                  -default => $defaultProject);                                  -default => $defaultProject);
82        # Create the drop-down menu for scoring.
83        my $defaultScore = $cgi->param('score') || '1e-15';
84        my $scoreMenu = $cgi->popup_menu(-name => 'score',
85                                         -values => ['1e-30', '1e-15', '1e-10', '1e-5', '1', '10'],
86                                         -default => $defaultScore);
87      # Build a table from the drop-down menu, the special options, and the submit row.      # Build a table from the drop-down menu, the special options, and the submit row.
88      my @rows = ($cgi->Tr($cgi->th('Project'), $cgi->td($menu)),      my @rows = ($cgi->Tr($cgi->th('Project'), $cgi->td($menu)),
89                    $cgi->Tr($cgi->th('Max Score'), $cgi->td($scoreMenu)),
90                 FeatureQuery::SpecialOptions($self),                 FeatureQuery::SpecialOptions($self),
91                 $self->SubmitRow());                  $self->SubmitRow()
92                   );
93      $retVal .= $self->MakeTable(\@rows);      $retVal .= $self->MakeTable(\@rows);
94      # Close the form.      # Close the form.
95      $retVal .= $self->FormEnd();      $retVal .= $self->FormEnd();
# Line 104  Line 116 
116      # Declare the return variable. If it remains undefined, the caller will      # Declare the return variable. If it remains undefined, the caller will
117      # know that an error occurred.      # know that an error occurred.
118      my $retVal;      my $retVal;
119      # Insure a project is selected.      # Insure a project and score are selected.
120      my $project = $cgi->param('project');      my $project = $cgi->param('project');
121        my $score = $cgi->param('score');
122      if (! $project) {      if (! $project) {
123          $self->SetMessage("No project specified.");          $self->SetMessage("No project specified.");
124        } elsif (! $score) {
125            $self->SetMessage("No score specified.");
126      } else {      } else {
127          # Initialize the session file.          # Initialize the session file.
128          $self->OpenSession();          $self->OpenSession();
# Line 116  Line 131 
131          # Get a query that will return the features for the project.          # Get a query that will return the features for the project.
132          my $query= $sprout->Get(['ContainsTopic', 'DrugTopic', 'ContainsAnalysisOf', 'PDB',          my $query= $sprout->Get(['ContainsTopic', 'DrugTopic', 'ContainsAnalysisOf', 'PDB',
133                                   'DescribesProteinForFeature', 'Feature'],                                   'DescribesProteinForFeature', 'Feature'],
134                                  "ContainsTopic(from-link) = ?", [$project]);                                  "ContainsTopic(from-link) = ? AND DescribesProteinForFeature(score) <= ?",
135                                    [$project, $score]);
136          # Create a feature data object to manage our results.          # Create a feature data object to manage our results.
137          my $fd = FeatureData->new($self);          my $fd = FeatureData->new($self);
138          # Loop through the results.          # Loop through the results.
# Line 134  Line 150 
150                  # Get the topic category. This explains why the PDB is interesting.                  # Get the topic category. This explains why the PDB is interesting.
151                  my ($categoryCode) = $record->Value('DrugTopic(category)');                  my ($categoryCode) = $record->Value('DrugTopic(category)');
152                  my $category = $CodeTable{$categoryCode};                  my $category = $CodeTable{$categoryCode};
153                    # Extract the score.
154                    my ($score) = $record->Value('DescribesProteinForFeature(score)');
155                  # Store this feature in the data object.                  # Store this feature in the data object.
156                  $fd->Store($record);                  $fd->Store($record);
157                  # Add the PDB columns.                  # Add the PDB columns.
158                  $fd->AddExtraColumns('Free PDB' => $pdbInfo, 'Reason' => $category);                  $fd->AddExtraColumns('Free PDB' => $pdbInfo, 'Reason' => $category, 'Score' => $score);
159                  # Put it in the results list.                  # Put it in the results list.
160                  $self->PutFeature($fd);                  $self->PutFeature($fd);
161                  $retVal++;                  $retVal++;

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3