Mercurial > repos > fgiacomoni > hmdb_ms_search
comparison lib/hmdb.pm @ 22:453fbe98925a draft
" master branch Updating with tag :CI_COMMIT_TAG - - Fxx"
author | fgiacomoni |
---|---|
date | Fri, 20 Nov 2020 17:29:18 +0000 |
parents | 63ba1cb240b7 |
children | 2d8a310e86ce |
comparison
equal
deleted
inserted
replaced
21:63ba1cb240b7 | 22:453fbe98925a |
---|---|
219 ($status_line) = ($status_line =~ /(\d+)/); | 219 ($status_line) = ($status_line =~ /(\d+)/); |
220 | 220 |
221 return (\$status_line) ; | 221 return (\$status_line) ; |
222 } | 222 } |
223 ## END of SUB | 223 ## END of SUB |
224 | |
225 | |
226 =head2 METHOD checkHmdbUrlEntries | |
227 | |
228 ## Description : check a list of HMDB_IDs by testing what is the status of their uri (HTTP 200 or not) | |
229 ## Input : $urlRoot, $entries | |
230 ## Output : $validEntries | |
231 ## Usage : my ( $validEntries ) = checkHmdbUrlEntries ( $entries ) ; | |
232 | |
233 =cut | |
234 ## START of SUB | |
235 sub checkHmdbUrlEntries { | |
236 ## Retrieve Values | |
237 my $self = shift ; | |
238 my ( $urlRoot, $clusters, $maxQuery ) = @_; | |
239 my ( @ValidResults, @validFeature ) = ( (), () ) ; | |
240 | |
241 foreach my $resultsByMass (@{$clusters}) { | |
242 my $currentQuery = 0 ; | |
243 foreach my $feature (@{$resultsByMass}) { | |
244 | |
245 if ($feature->{ENTRY_ENTRY_ID}) { | |
246 | |
247 my $url = $urlRoot.$feature->{ENTRY_ENTRY_ID} ; | |
248 if ( get($url)) { | |
249 $currentQuery ++ ; | |
250 if ($currentQuery > $maxQuery) { | |
251 last ; | |
252 } | |
253 else { | |
254 push (@validFeature, $feature) ; | |
255 # print "Url is valid ($url) - - add to final results\n" ; | |
256 } | |
257 } | |
258 else { | |
259 # print "Url is NOT valid ($url) - - Deleting to final results\n" ; | |
260 next ; | |
261 } | |
262 } | |
263 } # END FOREACH FEATURE | |
264 my @tmp = @validFeature ; | |
265 push (@ValidResults, \@tmp) ; | |
266 @validFeature = () ; | |
267 } # END FOREACH RESULTS | |
268 | |
269 return (\@ValidResults) ; | |
270 } | |
271 ### END of SUB | |
272 | |
224 | 273 |
225 =head2 METHOD testMatchesFromHmdbWithUA | 274 =head2 METHOD testMatchesFromHmdbWithUA |
226 | 275 |
227 ## Description : test a single query with tests parameters on hmdb - get the status of the complete server infra. | 276 ## Description : test a single query with tests parameters on hmdb - get the status of the complete server infra. |
228 ## Input : none | 277 ## Input : none |