Mercurial > repos > fgiacomoni > golm_ws_lib_search
comparison lib/golm_ws_api.pm @ 2:11779b6402bc draft
planemo upload for repository https://github.com/workflow4metabolomics/tool-bank-golm-lib_search.git commit a2892b221abe5a68ef271266a36b66894fcf9bde
author | fgiacomoni |
---|---|
date | Wed, 22 Feb 2017 07:37:36 -0500 |
parents | e3d43b8c987b |
children |
comparison
equal
deleted
inserted
replaced
1:4dc76dcbd1e7 | 2:11779b6402bc |
---|---|
198 my $status = $som->result->{Status} ; | 198 my $status = $som->result->{Status} ; |
199 | 199 |
200 ## Limitate number of hits returned according to user's $maxHit | 200 ## Limitate number of hits returned according to user's $maxHit |
201 ## and filter hits on specific values with thresholds | 201 ## and filter hits on specific values with thresholds |
202 my @results = @$results ; | 202 my @results = @$results ; |
203 | 203 |
204 ### Return all hits | 204 ### Return all hits |
205 my $oapi = lib::golm_ws_api->new() ; | 205 my $oapi = lib::golm_ws_api->new() ; |
206 if ($maxHits == 100 && $status eq 'success') { | 206 if ($maxHits == 100 && $status eq 'success') { |
207 | 207 |
208 my $filtered_res = $oapi->filter_scores_golm_results(\@results,$JaccardDistanceThreshold,$s12GowerLegendreDistanceThreshold, | 208 my $filtered_res = $oapi->filter_scores_golm_results(\@results,$JaccardDistanceThreshold,$s12GowerLegendreDistanceThreshold, |
233 } | 233 } |
234 else { carp "The spectrum for query is empty, Golm soap will stop.\n" ; } | 234 else { carp "The spectrum for query is empty, Golm soap will stop.\n" ; } |
235 } | 235 } |
236 else { carp "The spectrum for query is undef, Golm soap will stop.\n" ; } | 236 else { carp "The spectrum for query is undef, Golm soap will stop.\n" ; } |
237 | 237 |
238 return \@filtered_limited_res ; | 238 # return \@filtered_limited_res ; |
239 } | 239 } |
240 ### END of SUB | 240 ### END of SUB |
241 | 241 |
242 | 242 |
243 | 243 |
259 $DotproductDistanceThreshold,$HammingDistanceThreshold,$EuclideanDistanceThreshold) = @_ ; | 259 $DotproductDistanceThreshold,$HammingDistanceThreshold,$EuclideanDistanceThreshold) = @_ ; |
260 | 260 |
261 my @results = @$results ; | 261 my @results = @$results ; |
262 my @filtered_res = () ; | 262 my @filtered_res = () ; |
263 | 263 |
264 ## Adjust threshold | |
265 $JaccardDistanceThreshold = sprintf("%.6f", $JaccardDistanceThreshold) ; | |
266 $s12GowerLegendreDistanceThreshold = sprintf("%.6f", $s12GowerLegendreDistanceThreshold) ; | |
267 $DotproductDistanceThreshold = sprintf("%.6f", $DotproductDistanceThreshold) ; | |
268 # $HammingDistanceThreshold = sprintf("%.6f", $HammingDistanceThreshold); | |
269 $EuclideanDistanceThreshold = sprintf("%.6f", $EuclideanDistanceThreshold); | |
270 | |
264 foreach my $res (@results){ | 271 foreach my $res (@results){ |
272 | |
273 $res->{'JaccardDistance'} = sprintf("%.6f", $res->{'JaccardDistance'}) ; | |
274 $res->{'s12GowerLegendreDistance'} = sprintf("%.6f", $res->{'s12GowerLegendreDistance'}) ; | |
275 $res->{'DotproductDistance'} = sprintf("%.6f", $res->{'DotproductDistance'}) ; | |
276 # $res->{'HammingDistance'} = sprintf("%.6f", $res->{'HammingDistance'}) ; | |
277 $res->{'EuclideanDistance'} = sprintf("%.6f", $res->{'EuclideanDistance'}) ; | |
265 | 278 |
266 if ($res->{'JaccardDistance'} <= $JaccardDistanceThreshold && $res->{'s12GowerLegendreDistance'} <= $s12GowerLegendreDistanceThreshold | 279 if ($res->{'JaccardDistance'} <= $JaccardDistanceThreshold && $res->{'s12GowerLegendreDistance'} <= $s12GowerLegendreDistanceThreshold |
267 && $res->{'DotproductDistance' } <= $DotproductDistanceThreshold && $res->{'HammingDistance'} <= $HammingDistanceThreshold && | 280 && $res->{'DotproductDistance'} <= $DotproductDistanceThreshold && $res->{'HammingDistance'} <= $HammingDistanceThreshold && |
268 $res->{'EuclideanDistance' } <= $EuclideanDistanceThreshold) { | 281 $res->{'EuclideanDistance'} <= $EuclideanDistanceThreshold) { |
269 | 282 |
270 push (@filtered_res , $res) ; | 283 push (@filtered_res , $res) ; |
271 } | 284 } |
272 } | 285 } |
273 | 286 |
274 my $oapi = lib::golm_ws_api->new() ; | 287 my $oapi = lib::golm_ws_api->new() ; |