| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package WWW::Search::PharmGKB; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 22446 | use SOAP::Lite; | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 4 |  |  |  |  |  |  | import SOAP::Data 'type'; | 
| 5 |  |  |  |  |  |  | use English; | 
| 6 |  |  |  |  |  |  | use Carp; | 
| 7 |  |  |  |  |  |  | use vars qw($VERSION); | 
| 8 |  |  |  |  |  |  | use Data::Dumper; | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | $VERSION = '2.01'; | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | sub new { | 
| 13 |  |  |  |  |  |  | my $class = shift; | 
| 14 |  |  |  |  |  |  | my $self = bless { | 
| 15 |  |  |  |  |  |  | proxy => 'http://www.pharmgkb.org/services/PharmGKBItem', | 
| 16 |  |  |  |  |  |  | uri => 'PharmGKBItem', | 
| 17 |  |  |  |  |  |  | readable => 1, | 
| 18 |  |  |  |  |  |  | }, | 
| 19 |  |  |  |  |  |  | $class; | 
| 20 |  |  |  |  |  |  | return $self; | 
| 21 |  |  |  |  |  |  | } | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | sub gene_search { | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | my $self = shift; | 
| 26 |  |  |  |  |  |  | my($gene) = @_; | 
| 27 |  |  |  |  |  |  | my $result_obj = {}; | 
| 28 |  |  |  |  |  |  | my $pharm_ids = $self->_search($gene, 'Gene'); | 
| 29 |  |  |  |  |  |  | if($pharm_ids) { | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | foreach my $gene_id(@{$pharm_ids}) { | 
| 32 |  |  |  |  |  |  | my $local_hash = {}; | 
| 33 |  |  |  |  |  |  | my $soap_service = SOAP::Lite | 
| 34 |  |  |  |  |  |  | -> readable ($self->{readable}) | 
| 35 |  |  |  |  |  |  | -> uri($self->{uri}) | 
| 36 |  |  |  |  |  |  | -> proxy($self->{proxy}) | 
| 37 |  |  |  |  |  |  | -> searchGene ($gene_id); | 
| 38 |  |  |  |  |  |  | my $search_result = $soap_service->result; | 
| 39 |  |  |  |  |  |  | $local_hash->{'alternate_names'} = ''; | 
| 40 |  |  |  |  |  |  | $local_hash->{'drugs'} = ''; | 
| 41 |  |  |  |  |  |  | $local_hash->{'diseases'} = ''; | 
| 42 |  |  |  |  |  |  | $local_hash->{'phenotypes'} = ''; | 
| 43 |  |  |  |  |  |  | $local_hash->{'pathways'} = ''; | 
| 44 |  |  |  |  |  |  | $local_hash->{'alternate_symbols'} = ''; | 
| 45 |  |  |  |  |  |  | $local_hash->{'name'} = ''; | 
| 46 |  |  |  |  |  |  | $local_hash->{symbol} = ''; | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | my @pathways = (); | 
| 49 |  |  |  |  |  |  | if($search_result->{'geneRelatedPathways'}) { | 
| 50 |  |  |  |  |  |  | my $pathway_result = $search_result->{'geneRelatedPathways'}; | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | for(my $i = 0; $i | 
| 53 |  |  |  |  |  |  | push(@pathways, {$pathway_result->[$i] => $pathway_result->[$i+1]}); | 
| 54 |  |  |  |  |  |  | } | 
| 55 |  |  |  |  |  |  | } | 
| 56 |  |  |  |  |  |  | $local_hash->{'pathways'} = \@pathways; | 
| 57 |  |  |  |  |  |  | if($search_result->{geneName}) { | 
| 58 |  |  |  |  |  |  | $local_hash->{name} = $search_result->{geneName}; | 
| 59 |  |  |  |  |  |  | } | 
| 60 |  |  |  |  |  |  | if($search_result->{geneSymbol}) { | 
| 61 |  |  |  |  |  |  | $local_hash->{symbol} = $search_result->{geneSymbol}; | 
| 62 |  |  |  |  |  |  | } | 
| 63 |  |  |  |  |  |  | if($search_result->{'geneAlternateNames'}) { | 
| 64 |  |  |  |  |  |  | $local_hash->{'alternate_names'} = $search_result->{'geneAlternateNames'}; | 
| 65 |  |  |  |  |  |  | } | 
| 66 |  |  |  |  |  |  | if($search_result->{'geneRelatedDrugs'}) { | 
| 67 |  |  |  |  |  |  | $local_hash->{'drugs'} = $search_result->{'geneRelatedDrugs'}; | 
| 68 |  |  |  |  |  |  | } | 
| 69 |  |  |  |  |  |  | if($search_result->{'geneRelatedDiseases'}) { | 
| 70 |  |  |  |  |  |  | $local_hash->{'diseases'} = $search_result->{'geneRelatedDiseases'}; | 
| 71 |  |  |  |  |  |  | } | 
| 72 |  |  |  |  |  |  | if($search_result->{'geneAlternateSymbols'}) { | 
| 73 |  |  |  |  |  |  | $local_hash->{'alternate_symbols'} = $search_result->{'geneAlternateSymbols'}; | 
| 74 |  |  |  |  |  |  | } | 
| 75 |  |  |  |  |  |  | if($search_result->{'geneRelatedPhenotypeDatasets'}) { | 
| 76 |  |  |  |  |  |  | $local_hash->{'phenotypes'} = $search_result->{'geneRelatedPhenotypeDatasets'}; | 
| 77 |  |  |  |  |  |  | } | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | $result_obj->{$gene_id} = $local_hash; | 
| 80 |  |  |  |  |  |  | } | 
| 81 |  |  |  |  |  |  | } | 
| 82 |  |  |  |  |  |  | else { | 
| 83 |  |  |  |  |  |  | print "Gene $gene was not found in PharmGKB!\n"; | 
| 84 |  |  |  |  |  |  | } | 
| 85 |  |  |  |  |  |  | return $result_obj; | 
| 86 |  |  |  |  |  |  | } | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | sub disease_search { | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  | my $self = shift; | 
| 91 |  |  |  |  |  |  | my($disease) = @_; | 
| 92 |  |  |  |  |  |  | my $result_obj = {}; | 
| 93 |  |  |  |  |  |  | my $pharm_ids; | 
| 94 |  |  |  |  |  |  | if($disease) { | 
| 95 |  |  |  |  |  |  | $pharm_ids = $self->_search($disease, 'Disease'); | 
| 96 |  |  |  |  |  |  | } | 
| 97 |  |  |  |  |  |  | else { | 
| 98 |  |  |  |  |  |  | print "\'$disease\' is weird. I can't search that\n"; | 
| 99 |  |  |  |  |  |  | return 0; | 
| 100 |  |  |  |  |  |  | } | 
| 101 |  |  |  |  |  |  |  | 
| 102 |  |  |  |  |  |  | if($pharm_ids) { | 
| 103 |  |  |  |  |  |  |  | 
| 104 |  |  |  |  |  |  | foreach my $disease_id(@{$pharm_ids}) { | 
| 105 |  |  |  |  |  |  | my $local_hash = {}; | 
| 106 |  |  |  |  |  |  | my $soap_service = SOAP::Lite | 
| 107 |  |  |  |  |  |  | -> readable (1) | 
| 108 |  |  |  |  |  |  | -> uri($self->{uri}) | 
| 109 |  |  |  |  |  |  | -> proxy($self->{proxy}) | 
| 110 |  |  |  |  |  |  | -> searchDisease ($disease_id); | 
| 111 |  |  |  |  |  |  |  | 
| 112 |  |  |  |  |  |  |  | 
| 113 |  |  |  |  |  |  | my $search_result = $soap_service->result; | 
| 114 |  |  |  |  |  |  | $local_hash->{'names'} = ''; | 
| 115 |  |  |  |  |  |  | $local_hash->{'drugs'} = ''; | 
| 116 |  |  |  |  |  |  | $local_hash->{'genes'} = ''; | 
| 117 |  |  |  |  |  |  | $local_hash->{'phenotypes'} = ''; | 
| 118 |  |  |  |  |  |  | $local_hash->{'pathways'} = ''; | 
| 119 |  |  |  |  |  |  |  | 
| 120 |  |  |  |  |  |  | my @pathways = (); | 
| 121 |  |  |  |  |  |  | if($search_result->{'diseaseRelatedPathways'}) { | 
| 122 |  |  |  |  |  |  | my $pathway_result = $search_result->{'diseaseRelatedPathways'}; | 
| 123 |  |  |  |  |  |  |  | 
| 124 |  |  |  |  |  |  | for(my $i = 0; $i | 
| 125 |  |  |  |  |  |  | push(@pathways, {$pathway_result->[$i] => $pathway_result->[$i+1]}); | 
| 126 |  |  |  |  |  |  | } | 
| 127 |  |  |  |  |  |  | } | 
| 128 |  |  |  |  |  |  | $local_hash->{'pathways'} = \@pathways; | 
| 129 |  |  |  |  |  |  | if($search_result->{'diseaseAlternateNames'}) { | 
| 130 |  |  |  |  |  |  | $local_hash->{'names'} = $search_result->{'diseaseAlternateNames'}; | 
| 131 |  |  |  |  |  |  | } | 
| 132 |  |  |  |  |  |  | if($search_result->{'diseaseRelatedDrugs'}) { | 
| 133 |  |  |  |  |  |  | $local_hash->{'drugs'} = $search_result->{'diseaseRelatedDrugs'}; | 
| 134 |  |  |  |  |  |  | } | 
| 135 |  |  |  |  |  |  | if($search_result->{'diseaseRelatedGenes'}) { | 
| 136 |  |  |  |  |  |  | $local_hash->{'genes'} = $search_result->{'diseaseRelatedGenes'}; | 
| 137 |  |  |  |  |  |  | } | 
| 138 |  |  |  |  |  |  | if($search_result->{'diseaseRelatedPhenotypeDatasets'}) { | 
| 139 |  |  |  |  |  |  | $local_hash->{'phenotypes'} = $search_result->{'diseaseRelatedPhenotypeDatasets'}; | 
| 140 |  |  |  |  |  |  | } | 
| 141 |  |  |  |  |  |  |  | 
| 142 |  |  |  |  |  |  | $result_obj->{$disease_id} = $local_hash; | 
| 143 |  |  |  |  |  |  | } | 
| 144 |  |  |  |  |  |  | } | 
| 145 |  |  |  |  |  |  | else { | 
| 146 |  |  |  |  |  |  | print "Disease $disease was not found in PharmGKB!\n"; | 
| 147 |  |  |  |  |  |  | } | 
| 148 |  |  |  |  |  |  | return $result_obj; | 
| 149 |  |  |  |  |  |  | } | 
| 150 |  |  |  |  |  |  |  | 
| 151 |  |  |  |  |  |  | sub drug_search { | 
| 152 |  |  |  |  |  |  | my $self = shift; | 
| 153 |  |  |  |  |  |  | my($drug) = @_; | 
| 154 |  |  |  |  |  |  | my $result_obj = {}; | 
| 155 |  |  |  |  |  |  | my $pharm_ids; | 
| 156 |  |  |  |  |  |  | if($drug) { | 
| 157 |  |  |  |  |  |  | $pharm_ids = $self->_search($drug, 'Drug'); | 
| 158 |  |  |  |  |  |  | } | 
| 159 |  |  |  |  |  |  | else { | 
| 160 |  |  |  |  |  |  | print "\'$drug\' is weird. I can't search that\n"; | 
| 161 |  |  |  |  |  |  | return 0; | 
| 162 |  |  |  |  |  |  | } | 
| 163 |  |  |  |  |  |  | if($pharm_ids) { | 
| 164 |  |  |  |  |  |  | foreach my $drug_id(@{$pharm_ids}) { | 
| 165 |  |  |  |  |  |  | my $local_hash = {}; | 
| 166 |  |  |  |  |  |  | my $soap_service = SOAP::Lite | 
| 167 |  |  |  |  |  |  | -> readable (1) | 
| 168 |  |  |  |  |  |  | -> uri($self->{uri}) | 
| 169 |  |  |  |  |  |  | -> proxy($self->{proxy}) | 
| 170 |  |  |  |  |  |  | -> searchDrug ($drug_id); | 
| 171 |  |  |  |  |  |  |  | 
| 172 |  |  |  |  |  |  | my $search_result = $soap_service->result; | 
| 173 |  |  |  |  |  |  | $local_hash->{'generic_names'} = ''; | 
| 174 |  |  |  |  |  |  | $local_hash->{'trade_names'} = ''; | 
| 175 |  |  |  |  |  |  | $local_hash->{'category'} = ''; | 
| 176 |  |  |  |  |  |  | $local_hash->{'classification'} = ''; | 
| 177 |  |  |  |  |  |  | $local_hash->{'genes'} = ''; | 
| 178 |  |  |  |  |  |  | $local_hash->{'diseases'} = ''; | 
| 179 |  |  |  |  |  |  | $local_hash->{'phenotypes'} = ''; | 
| 180 |  |  |  |  |  |  | $local_hash->{'pathways'} = ''; | 
| 181 |  |  |  |  |  |  | $local_hash->{'name'} = ''; | 
| 182 |  |  |  |  |  |  | my @pathways = (); | 
| 183 |  |  |  |  |  |  | if($search_result->{'drugRelatedPathways'}) { | 
| 184 |  |  |  |  |  |  | my $pathway_result = $search_result->{'drugRelatedPathways'}; | 
| 185 |  |  |  |  |  |  |  | 
| 186 |  |  |  |  |  |  | for(my $i = 0; $i < scalar(@{$pathway_result}); $i+= 2) { | 
| 187 |  |  |  |  |  |  | push(@pathways, {$pathway_result->[$i] => $pathway_result->[$i+1]}); | 
| 188 |  |  |  |  |  |  | } | 
| 189 |  |  |  |  |  |  | } | 
| 190 |  |  |  |  |  |  | $local_hash->{'pathways'} = \@pathways; | 
| 191 |  |  |  |  |  |  | if($search_result->{'drugName'}) { | 
| 192 |  |  |  |  |  |  | $local_hash->{'name'} = $search_result->{'drugName'}; | 
| 193 |  |  |  |  |  |  | } | 
| 194 |  |  |  |  |  |  | if($search_result->{'drugGenericNames'}) { | 
| 195 |  |  |  |  |  |  | $local_hash->{'generic_names'} = $search_result->{'drugGenericNames'}; | 
| 196 |  |  |  |  |  |  | } | 
| 197 |  |  |  |  |  |  | if($search_result->{'drugTradeNames'}) { | 
| 198 |  |  |  |  |  |  | $local_hash->{'trade_names'} = $search_result->{'drugTradeNames'}; | 
| 199 |  |  |  |  |  |  | } | 
| 200 |  |  |  |  |  |  | if($search_result->{'drugCategory'}) { | 
| 201 |  |  |  |  |  |  | $local_hash->{'category'} = $search_result->{'drugCategory'}; | 
| 202 |  |  |  |  |  |  | } | 
| 203 |  |  |  |  |  |  | if($search_result->{'drugVaClassifications'}){ | 
| 204 |  |  |  |  |  |  | $local_hash->{'classification'} = $search_result->{'drugVaClassifications'}; | 
| 205 |  |  |  |  |  |  | } | 
| 206 |  |  |  |  |  |  | if($search_result->{'drugRelatedGenes'}) { | 
| 207 |  |  |  |  |  |  | $local_hash->{'genes'} = $search_result->{'drugRelatedGenes'}; | 
| 208 |  |  |  |  |  |  | } | 
| 209 |  |  |  |  |  |  | if($search_result->{'drugRelatedDiseases'}) { | 
| 210 |  |  |  |  |  |  | $local_hash->{'diseases'} = $search_result->{'drugRelatedDiseases'}; | 
| 211 |  |  |  |  |  |  | } | 
| 212 |  |  |  |  |  |  | if($search_result->{'drugRelatedPhenotypeDatasets'}) { | 
| 213 |  |  |  |  |  |  | $local_hash->{'phenotypes'} = $search_result->{'drugRelatedPhenotypeDatasets'}; | 
| 214 |  |  |  |  |  |  | } | 
| 215 |  |  |  |  |  |  |  | 
| 216 |  |  |  |  |  |  | $result_obj->{$drug_id} = $local_hash; | 
| 217 |  |  |  |  |  |  | } | 
| 218 |  |  |  |  |  |  | } | 
| 219 |  |  |  |  |  |  | else { | 
| 220 |  |  |  |  |  |  | print "Drug $drug was not found in PharmGKB!\n"; | 
| 221 |  |  |  |  |  |  | } | 
| 222 |  |  |  |  |  |  | return $result_obj; | 
| 223 |  |  |  |  |  |  | } | 
| 224 |  |  |  |  |  |  |  | 
| 225 |  |  |  |  |  |  | sub publication_search { | 
| 226 |  |  |  |  |  |  |  | 
| 227 |  |  |  |  |  |  | my $self = shift; | 
| 228 |  |  |  |  |  |  | my($search_term) = @_; | 
| 229 |  |  |  |  |  |  | my $pharm_ids; | 
| 230 |  |  |  |  |  |  | my $result_obj = {}; | 
| 231 |  |  |  |  |  |  | if($search_term) { | 
| 232 |  |  |  |  |  |  | $pharm_ids = $self->_search($search_term, 'Publication'); | 
| 233 |  |  |  |  |  |  | } | 
| 234 |  |  |  |  |  |  | else { | 
| 235 |  |  |  |  |  |  | print "\'$search_term\' is weird. I can't search that\n"; | 
| 236 |  |  |  |  |  |  | return 0; | 
| 237 |  |  |  |  |  |  | } | 
| 238 |  |  |  |  |  |  | if($pharm_ids) { | 
| 239 |  |  |  |  |  |  | foreach my $id(@{$pharm_ids}) { | 
| 240 |  |  |  |  |  |  | my $local_hash = {}; | 
| 241 |  |  |  |  |  |  | my $soap_service = SOAP::Lite | 
| 242 |  |  |  |  |  |  | -> readable ($self->{readable}) | 
| 243 |  |  |  |  |  |  | -> uri($self->{uri}) | 
| 244 |  |  |  |  |  |  | -> proxy($self->{proxy}) | 
| 245 |  |  |  |  |  |  | -> searchPublication ($id); | 
| 246 |  |  |  |  |  |  |  | 
| 247 |  |  |  |  |  |  | my $search_result = $soap_service->result; | 
| 248 |  |  |  |  |  |  | $local_hash->{'grant_id'} = ''; | 
| 249 |  |  |  |  |  |  | $local_hash->{'journal'} = ''; | 
| 250 |  |  |  |  |  |  | $local_hash->{'title'} = ''; | 
| 251 |  |  |  |  |  |  | $local_hash->{'month'} = ''; | 
| 252 |  |  |  |  |  |  | $local_hash->{'abstract'} = ''; | 
| 253 |  |  |  |  |  |  | $local_hash->{'authors'} = ''; | 
| 254 |  |  |  |  |  |  | $local_hash->{'volume'} = ''; | 
| 255 |  |  |  |  |  |  | $local_hash->{'page'} = ''; | 
| 256 |  |  |  |  |  |  | $local_hash->{'cross_reference'} = ''; | 
| 257 |  |  |  |  |  |  | $local_hash->{'year'} = ''; | 
| 258 |  |  |  |  |  |  | if($search_result) { | 
| 259 |  |  |  |  |  |  | if($search_result->{publicationGrantIds}) { | 
| 260 |  |  |  |  |  |  | $local_hash->{'grants_id'} = $search_result->{publicationGrantIds}; | 
| 261 |  |  |  |  |  |  | } | 
| 262 |  |  |  |  |  |  | if($search_result->{publicationJournal}) { | 
| 263 |  |  |  |  |  |  | $local_hash->{journal} = $search_result->{publicationJournal}; | 
| 264 |  |  |  |  |  |  | } | 
| 265 |  |  |  |  |  |  | if($search_result->{publicationName}) { | 
| 266 |  |  |  |  |  |  | $local_hash->{title} = $search_result->{publicationName}; | 
| 267 |  |  |  |  |  |  | } | 
| 268 |  |  |  |  |  |  | if($search_result->{publicationMonth}) { | 
| 269 |  |  |  |  |  |  | $local_hash->{month} = $search_result->{publicationMonth}; | 
| 270 |  |  |  |  |  |  | } | 
| 271 |  |  |  |  |  |  | if($search_result->{publicationAbstract}) { | 
| 272 |  |  |  |  |  |  | $local_hash->{'abstract'} = $search_result->{publicationAbstract}; | 
| 273 |  |  |  |  |  |  | } | 
| 274 |  |  |  |  |  |  | if($search_result->{publicationAuthors}) { | 
| 275 |  |  |  |  |  |  | $local_hash->{authors} = $search_result->{publicationAuthors}; | 
| 276 |  |  |  |  |  |  | } | 
| 277 |  |  |  |  |  |  | if($search_result->{publicationVolume}) { | 
| 278 |  |  |  |  |  |  | $local_hash->{volume} = $search_result->{publicationVolume}; | 
| 279 |  |  |  |  |  |  | } | 
| 280 |  |  |  |  |  |  | if($search_result->{publicationPage}) { | 
| 281 |  |  |  |  |  |  | $local_hash->{page} = $search_result->{publicationPage}; | 
| 282 |  |  |  |  |  |  | } | 
| 283 |  |  |  |  |  |  | if($search_result->{publicationAnnotationCrossReference}) { | 
| 284 |  |  |  |  |  |  | my $references = $search_result->{publicationAnnotationCrossReference}; | 
| 285 |  |  |  |  |  |  | my @references_array = (); | 
| 286 |  |  |  |  |  |  | for(my $i=0; $i < scalar(@{$references});$i+=2) { | 
| 287 |  |  |  |  |  |  | push(@references_array, {$references->[$i] => $references->[$i+1]}); | 
| 288 |  |  |  |  |  |  | } | 
| 289 |  |  |  |  |  |  | $local_hash->{'cross_reference'} = \@references_array; | 
| 290 |  |  |  |  |  |  | } | 
| 291 |  |  |  |  |  |  | if($search_result->{publicationYear}) { | 
| 292 |  |  |  |  |  |  | $local_hash->{year} = $search_result->{publicationYear}; | 
| 293 |  |  |  |  |  |  | } | 
| 294 |  |  |  |  |  |  | } | 
| 295 |  |  |  |  |  |  | $result_obj->{$id} = $local_hash; | 
| 296 |  |  |  |  |  |  | } | 
| 297 |  |  |  |  |  |  | } | 
| 298 |  |  |  |  |  |  | else { | 
| 299 |  |  |  |  |  |  | print "No results found for $search_term\n"; | 
| 300 |  |  |  |  |  |  | } | 
| 301 |  |  |  |  |  |  | return $result_obj; | 
| 302 |  |  |  |  |  |  | } | 
| 303 |  |  |  |  |  |  |  | 
| 304 |  |  |  |  |  |  |  | 
| 305 |  |  |  |  |  |  | sub _search { | 
| 306 |  |  |  |  |  |  | my $self = shift; | 
| 307 |  |  |  |  |  |  | my($search_term, $key) = @_; | 
| 308 |  |  |  |  |  |  | my @pharm_id = (); | 
| 309 |  |  |  |  |  |  |  | 
| 310 |  |  |  |  |  |  | my $soap_service = SOAP::Lite | 
| 311 |  |  |  |  |  |  | -> readable ($self->{readable}) | 
| 312 |  |  |  |  |  |  | -> uri('SearchService') | 
| 313 |  |  |  |  |  |  | -> proxy('http://www.pharmgkb.org/services/SearchService') | 
| 314 |  |  |  |  |  |  | -> search ($search_term); | 
| 315 |  |  |  |  |  |  | my $search_result = $soap_service->result; | 
| 316 |  |  |  |  |  |  | foreach my $search_obj(@{$search_result}) { | 
| 317 |  |  |  |  |  |  | if($search_obj->[1] =~ m/$key/ig) { | 
| 318 |  |  |  |  |  |  | push(@pharm_id, $search_obj->[0]); | 
| 319 |  |  |  |  |  |  | } | 
| 320 |  |  |  |  |  |  | } | 
| 321 |  |  |  |  |  |  | return \@pharm_id; | 
| 322 |  |  |  |  |  |  |  | 
| 323 |  |  |  |  |  |  | } | 
| 324 |  |  |  |  |  |  |  | 
| 325 |  |  |  |  |  |  | 1; | 
| 326 |  |  |  |  |  |  |  | 
| 327 |  |  |  |  |  |  |  | 
| 328 |  |  |  |  |  |  | =head1 NAME | 
| 329 |  |  |  |  |  |  |  | 
| 330 |  |  |  |  |  |  | WWW::Search::PharmGKB - Search and retrieve information from the PharmGKB database | 
| 331 |  |  |  |  |  |  |  | 
| 332 |  |  |  |  |  |  | =head1 VERSION | 
| 333 |  |  |  |  |  |  |  | 
| 334 |  |  |  |  |  |  | Version 2.00 | 
| 335 |  |  |  |  |  |  |  | 
| 336 |  |  |  |  |  |  | =cut | 
| 337 |  |  |  |  |  |  |  | 
| 338 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 339 |  |  |  |  |  |  |  | 
| 340 |  |  |  |  |  |  | use WWW::Search::PharmGKB; | 
| 341 |  |  |  |  |  |  | use Data::Dumper; | 
| 342 |  |  |  |  |  |  | my $foo = WWW::Search::PharmGKB->new(); | 
| 343 |  |  |  |  |  |  | my $search_result = $foo->gene_search('CYP2D6'); | 
| 344 |  |  |  |  |  |  | print Dumper $search_result; | 
| 345 |  |  |  |  |  |  |  | 
| 346 |  |  |  |  |  |  |  | 
| 347 |  |  |  |  |  |  | =head1 METHODS | 
| 348 |  |  |  |  |  |  |  | 
| 349 |  |  |  |  |  |  | =head2 new | 
| 350 |  |  |  |  |  |  |  | 
| 351 |  |  |  |  |  |  | =head3 Usage: | 
| 352 |  |  |  |  |  |  |  | 
| 353 |  |  |  |  |  |  | $foo = WWW::Search::PharmGKB->new(); | 
| 354 |  |  |  |  |  |  | or | 
| 355 |  |  |  |  |  |  | $foo = new WWW::Search::PharmGKB; | 
| 356 |  |  |  |  |  |  |  | 
| 357 |  |  |  |  |  |  | =head3 Returns: | 
| 358 |  |  |  |  |  |  |  | 
| 359 |  |  |  |  |  |  | Self | 
| 360 |  |  |  |  |  |  |  | 
| 361 |  |  |  |  |  |  | =cut | 
| 362 |  |  |  |  |  |  |  | 
| 363 |  |  |  |  |  |  | =head2 gene_search | 
| 364 |  |  |  |  |  |  |  | 
| 365 |  |  |  |  |  |  | =head3 Usage: | 
| 366 |  |  |  |  |  |  |  | 
| 367 |  |  |  |  |  |  | $foo->gene_search(); | 
| 368 |  |  |  |  |  |  |  | 
| 369 |  |  |  |  |  |  | =head3 Returns: | 
| 370 |  |  |  |  |  |  |  | 
| 371 |  |  |  |  |  |  | A referenced hash. The keys are 'drugs', 'name', 'symbol', 'pathways', | 
| 372 |  |  |  |  |  |  | 'drugs', 'diseases', 'phenotypes', 'alternate_names', 'alternate_symbols' | 
| 373 |  |  |  |  |  |  |  | 
| 374 |  |  |  |  |  |  | =head3 Note: | 
| 375 |  |  |  |  |  |  |  | 
| 376 |  |  |  |  |  |  | all the keys contain referenced arrays as values. In the pathway value, | 
| 377 |  |  |  |  |  |  | the array has  key => value pairs 'pathway' => 'pharmGKB URL' as elements. | 
| 378 |  |  |  |  |  |  | All other keys have referenced array of PharmGKB IDs. | 
| 379 |  |  |  |  |  |  |  | 
| 380 |  |  |  |  |  |  | =cut | 
| 381 |  |  |  |  |  |  |  | 
| 382 |  |  |  |  |  |  | =head2 disease_search | 
| 383 |  |  |  |  |  |  |  | 
| 384 |  |  |  |  |  |  | =head3 Usage: | 
| 385 |  |  |  |  |  |  |  | 
| 386 |  |  |  |  |  |  | $foo->disease_search(); | 
| 387 |  |  |  |  |  |  |  | 
| 388 |  |  |  |  |  |  | =head3 Returns: | 
| 389 |  |  |  |  |  |  |  | 
| 390 |  |  |  |  |  |  | A referenced hash of pharmGKB IDs. Each ID contains 'drugs', 'names', 'pathways', 'drugs', | 
| 391 |  |  |  |  |  |  | 'genes', 'phenotypes'. | 
| 392 |  |  |  |  |  |  |  | 
| 393 |  |  |  |  |  |  | =head3 Note: | 
| 394 |  |  |  |  |  |  |  | 
| 395 |  |  |  |  |  |  | all the keys contain referenced arrays as values. in the pathway value, | 
| 396 |  |  |  |  |  |  | the array has  key => value pairs 'pathway' => 'pharmGKB URL' as elements. | 
| 397 |  |  |  |  |  |  | All other keys have referenced array of PharmGKB IDs. | 
| 398 |  |  |  |  |  |  | =cut | 
| 399 |  |  |  |  |  |  |  | 
| 400 |  |  |  |  |  |  | =head2 drug_search | 
| 401 |  |  |  |  |  |  |  | 
| 402 |  |  |  |  |  |  | =head3 Usage: | 
| 403 |  |  |  |  |  |  |  | 
| 404 |  |  |  |  |  |  | $foo->drug_search(); | 
| 405 |  |  |  |  |  |  |  | 
| 406 |  |  |  |  |  |  | =head3 Returns: | 
| 407 |  |  |  |  |  |  |  | 
| 408 |  |  |  |  |  |  | A referenced hash of pharmGKB IDs. Each ID contains 'diseases', 'generic_names', 'trade_names', | 
| 409 |  |  |  |  |  |  | 'pathways', 'genes', 'phenotypes', 'category', 'classification' | 
| 410 |  |  |  |  |  |  |  | 
| 411 |  |  |  |  |  |  | =head3 Note: | 
| 412 |  |  |  |  |  |  |  | 
| 413 |  |  |  |  |  |  | all the keys contain referenced arrays as values. in the pathway value, | 
| 414 |  |  |  |  |  |  | the array has  key => value pairs 'pathway' => 'pharmGKB URL' as elements. | 
| 415 |  |  |  |  |  |  | All other keys have referenced array of PharmGKB IDs. | 
| 416 |  |  |  |  |  |  | =cut | 
| 417 |  |  |  |  |  |  |  | 
| 418 |  |  |  |  |  |  | =head2 publication_search | 
| 419 |  |  |  |  |  |  |  | 
| 420 |  |  |  |  |  |  | =head3 Usage: | 
| 421 |  |  |  |  |  |  |  | 
| 422 |  |  |  |  |  |  | $foo->publication_search(); | 
| 423 |  |  |  |  |  |  |  | 
| 424 |  |  |  |  |  |  | =head3 Returns: | 
| 425 |  |  |  |  |  |  |  | 
| 426 |  |  |  |  |  |  | A referenced hash of pharmGKB IDs. Each ID contains 'authors', 'page', | 
| 427 |  |  |  |  |  |  | 'volume', 'month', 'grant_id', 'cross_reference', 'title', 'abstract', 'year', | 
| 428 |  |  |  |  |  |  | 'journal'. | 
| 429 |  |  |  |  |  |  |  | 
| 430 |  |  |  |  |  |  | =cut | 
| 431 |  |  |  |  |  |  |  | 
| 432 |  |  |  |  |  |  | =head1 AUTHOR | 
| 433 |  |  |  |  |  |  |  | 
| 434 |  |  |  |  |  |  | Arun Venkataraman, C<<  >> | 
| 435 |  |  |  |  |  |  |  | 
| 436 |  |  |  |  |  |  | =head1 BUGS | 
| 437 |  |  |  |  |  |  |  | 
| 438 |  |  |  |  |  |  | Please report any bugs or feature requests to C, or through | 
| 439 |  |  |  |  |  |  | the web interface at L.  I will be notified, and then you'll | 
| 440 |  |  |  |  |  |  | automatically be notified of progress on your bug as I make changes. | 
| 441 |  |  |  |  |  |  |  | 
| 442 |  |  |  |  |  |  |  | 
| 443 |  |  |  |  |  |  |  | 
| 444 |  |  |  |  |  |  |  | 
| 445 |  |  |  |  |  |  | =head1 SUPPORT | 
| 446 |  |  |  |  |  |  |  | 
| 447 |  |  |  |  |  |  | You can find documentation for this module with the perldoc command. | 
| 448 |  |  |  |  |  |  |  | 
| 449 |  |  |  |  |  |  | perldoc WWW::Search::PharmGKB | 
| 450 |  |  |  |  |  |  |  | 
| 451 |  |  |  |  |  |  | You can also look for information at: | 
| 452 |  |  |  |  |  |  |  | 
| 453 |  |  |  |  |  |  | =over 4 | 
| 454 |  |  |  |  |  |  |  | 
| 455 |  |  |  |  |  |  | =item * RT: CPAN's request tracker | 
| 456 |  |  |  |  |  |  |  | 
| 457 |  |  |  |  |  |  | L | 
| 458 |  |  |  |  |  |  |  | 
| 459 |  |  |  |  |  |  | =item * AnnoCPAN: Annotated CPAN documentation | 
| 460 |  |  |  |  |  |  |  | 
| 461 |  |  |  |  |  |  | L | 
| 462 |  |  |  |  |  |  |  | 
| 463 |  |  |  |  |  |  | =item * CPAN Ratings | 
| 464 |  |  |  |  |  |  |  | 
| 465 |  |  |  |  |  |  | L | 
| 466 |  |  |  |  |  |  |  | 
| 467 |  |  |  |  |  |  | =item * Search CPAN | 
| 468 |  |  |  |  |  |  |  | 
| 469 |  |  |  |  |  |  | L | 
| 470 |  |  |  |  |  |  |  | 
| 471 |  |  |  |  |  |  | =back | 
| 472 |  |  |  |  |  |  |  | 
| 473 |  |  |  |  |  |  | You can contact the author for any issues or suggestions you come accross using this module. | 
| 474 |  |  |  |  |  |  |  | 
| 475 |  |  |  |  |  |  | =head1 ACKNOWLEDGEMENTS | 
| 476 |  |  |  |  |  |  |  | 
| 477 |  |  |  |  |  |  | This module is based on the perl client written by Andrew MacBride (andrew@helix.stanford.edu) for PharmGKB's web services. | 
| 478 |  |  |  |  |  |  |  | 
| 479 |  |  |  |  |  |  | =head1 COPYRIGHT & LICENSE | 
| 480 |  |  |  |  |  |  |  | 
| 481 |  |  |  |  |  |  | Copyright 2010 Arun Venkataraman C, all rights reserved. | 
| 482 |  |  |  |  |  |  |  | 
| 483 |  |  |  |  |  |  | This program is free software; you can redistribute it and/or modify it | 
| 484 |  |  |  |  |  |  | under the same terms as Perl itself. | 
| 485 |  |  |  |  |  |  |  | 
| 486 |  |  |  |  |  |  |  | 
| 487 |  |  |  |  |  |  | =cut |