[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.6, Mon Dec 11 19:50:05 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
44    
45  # Table of drug topic category codes.  # Table of drug topic category codes.
46  my %CodeTable = (  my %CodeTable = (
47                   'ES'   => 'essential',                   'ES'   => 'Essential',
48                   'ES-X' => 'essential, determined by experiment',                   'ES-X' => 'Essential',
49                   'ES-L' => 'essential, from the literature',                   'ES-L' => 'Essential',
50                   'KA-T' => 'known Antibiotic target',                   'KA-T' => 'Antibiotic Target',
51                   'KA-I' => 'known Antibiotic Inhibitor',                   'KA-I' => 'Antibiotic Inhibitor',
52                   'VA'   => 'virulence associated',                   'VA'   => 'Virulence Associated',
53                   'VA-K' => 'known virulence associated',                   'VA-K' => 'Virulence Associated',
54                   'VA-P' => 'putative virulence assocated'                   'VA-P' => 'Virulence Assocated',
55                     'TX-K' => 'Toxin',
56                     'TX-B' => 'Toxin',
57                     'SA-A' => 'Surface Associated',
58                     'SA-P' => 'Surface Associated',
59                     'SA-S' => 'Surface Associated',
60                     'SA'   => 'Surface Associated',
61                     'SE-P' => 'Secreted Protein',
62                     'SE'   => 'Secreted Protein',
63                  );                  );
64    
65    =head3 GetCategory
66    
67    C<< my $description = SHDrugSearch::GetCategory($code); >>
68    
69    Return the description of the specified category code.
70    
71    =over 4
72    
73    =item code
74    
75    Category code to convert.
76    
77    =item RETURN
78    
79    Returns the description of the specified category code, as taken from the C<CodeTable> hash.
80    
81    =back
82    
83    =cut
84    
85    sub GetCategory {
86        # Get the parameters.
87        my ($code) = @_;
88        # Convert to upper case.
89        my $catCode = uc $code;
90        # Trim spaces.
91        $catCode =~ s/\s+//g;
92        # Extract it from the hash table.
93        my $retVal = $CodeTable{$catCode};
94        # Check for a not-found condition.
95        if (! $retVal) {
96            $retVal = "Unknown Code $catCode";
97        }
98        # Return the result.
99        return $retVal;
100    }
101    
102  =head2 Virtual Methods  =head2 Virtual Methods
103    
104  =head3 Form  =head3 Form
105    
106  C<< my $html = $shelp->Include(); >>  C<< my $html = $shelp->Form(); >>
107    
108  Generate the HTML for a form to request a new search.  Generate the HTML for a form to request a new search.
109    
# Line 74  Line 124 
124      # Convert the project list into a drop-down menu.      # Convert the project list into a drop-down menu.
125      my $menu = $cgi->popup_menu(-name => 'project', -values => \@projectNames,      my $menu = $cgi->popup_menu(-name => 'project', -values => \@projectNames,
126                                  -default => $defaultProject);                                  -default => $defaultProject);
127        # Create the drop-down menu for scoring.
128        my $defaultScore = $cgi->param('score') || '1e-15';
129        my $scoreMenu = $cgi->popup_menu(-name => 'score',
130                                         -values => ['1e-30', '1e-15', '1e-10', '1e-5', '1', '10'],
131                                         -default => $defaultScore);
132      # 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.
133      my @rows = ($cgi->Tr($cgi->th('Project'), $cgi->td($menu)),      my @rows = ($cgi->Tr($cgi->th('Project'), $cgi->td($menu)),
134                    $cgi->Tr($cgi->th('Max Score'), $cgi->td($scoreMenu)),
135                 FeatureQuery::SpecialOptions($self),                 FeatureQuery::SpecialOptions($self),
136                 $self->SubmitRow());                  $self->SubmitRow()
137                   );
138      $retVal .= $self->MakeTable(\@rows);      $retVal .= $self->MakeTable(\@rows);
139      # Close the form.      # Close the form.
140      $retVal .= $self->FormEnd();      $retVal .= $self->FormEnd();
# Line 104  Line 161 
161      # Declare the return variable. If it remains undefined, the caller will      # Declare the return variable. If it remains undefined, the caller will
162      # know that an error occurred.      # know that an error occurred.
163      my $retVal;      my $retVal;
164      # Insure a project is selected.      # Insure a project and score are selected.
165      my $project = $cgi->param('project');      my $project = $cgi->param('project');
166        my $score = $cgi->param('score');
167      if (! $project) {      if (! $project) {
168          $self->SetMessage("No project specified.");          $self->SetMessage("No project specified.");
169        } elsif (! $score) {
170            $self->SetMessage("No score specified.");
171      } else {      } else {
172          # Initialize the session file.          # Initialize the session file.
173          $self->OpenSession();          $self->OpenSession();
# Line 116  Line 176 
176          # Get a query that will return the features for the project.          # Get a query that will return the features for the project.
177          my $query= $sprout->Get(['ContainsTopic', 'DrugTopic', 'ContainsAnalysisOf', 'PDB',          my $query= $sprout->Get(['ContainsTopic', 'DrugTopic', 'ContainsAnalysisOf', 'PDB',
178                                   'DescribesProteinForFeature', 'Feature'],                                   'DescribesProteinForFeature', 'Feature'],
179                                  "ContainsTopic(from-link) = ?", [$project]);                                  "ContainsTopic(from-link) = ? AND DescribesProteinForFeature(score) <= ?",
180                                    [$project, $score]);
181          # Create a feature data object to manage our results.          # Create a feature data object to manage our results.
182          my $fd = FeatureData->new($self);          my $fd = FeatureData->new($self);
183          # Loop through the results.          # Loop through the results.
# Line 134  Line 195 
195                  # Get the topic category. This explains why the PDB is interesting.                  # Get the topic category. This explains why the PDB is interesting.
196                  my ($categoryCode) = $record->Value('DrugTopic(category)');                  my ($categoryCode) = $record->Value('DrugTopic(category)');
197                  my $category = $CodeTable{$categoryCode};                  my $category = $CodeTable{$categoryCode};
198                    # Extract the score.
199                    my ($score) = $record->Value('DescribesProteinForFeature(score)');
200                  # Store this feature in the data object.                  # Store this feature in the data object.
201                  $fd->Store($record);                  $fd->Store($record);
202                  # Add the PDB columns.                  # Add the PDB columns.
203                  $fd->AddExtraColumns('Free PDB' => $pdbInfo, 'Reason' => $category);                  $fd->AddExtraColumns('Free PDB' => $pdbInfo, 'Reason' => $category, 'Score' => $score);
204                  # Put it in the results list.                  # Put it in the results list.
205                  $self->PutFeature($fd);                  $self->PutFeature($fd);
206                  $retVal++;                  $retVal++;
# Line 183  Line 246 
246      # Get the parameters.      # Get the parameters.
247      my ($self) = @_;      my ($self) = @_;
248      # Return the result.      # Return the result.
249      return "Show the PDB and feature relationships for a specified drug target analysis project.";      return "Show the PDB and gene relationships for a specified drug target analysis project.";
250  }  }
251    
252  1;  1;

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3