diff 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
line wrap: on
line diff
--- a/lib/golm_ws_api.pm	Mon Dec 05 08:41:00 2016 -0500
+++ b/lib/golm_ws_api.pm	Wed Feb 22 07:37:36 2017 -0500
@@ -200,7 +200,7 @@
             ## Limitate number of hits returned according to user's $maxHit
             ## and filter hits on specific values with thresholds
             my @results = @$results ;
-            
+
             ### Return all hits
             my $oapi = lib::golm_ws_api->new() ;
             if ($maxHits == 100 && $status eq 'success') {
@@ -235,7 +235,7 @@
     }
     else { carp "The spectrum for query is undef, Golm soap will stop.\n" ; }
 	
-	return \@filtered_limited_res ;
+#	return \@filtered_limited_res ;
 }
 ### END of SUB
 
@@ -261,12 +261,25 @@
 	my @results = @$results ;
 	my @filtered_res = () ;
 	
+	## Adjust threshold
+	$JaccardDistanceThreshold = sprintf("%.6f", $JaccardDistanceThreshold) ;
+	$s12GowerLegendreDistanceThreshold = sprintf("%.6f", $s12GowerLegendreDistanceThreshold) ;
+	$DotproductDistanceThreshold = sprintf("%.6f", $DotproductDistanceThreshold) ;
+#	$HammingDistanceThreshold = sprintf("%.6f", $HammingDistanceThreshold);
+	$EuclideanDistanceThreshold =  sprintf("%.6f", $EuclideanDistanceThreshold);
+	
 	foreach my $res (@results){
+		
+			$res->{'JaccardDistance'} = sprintf("%.6f", $res->{'JaccardDistance'}) ;
+			$res->{'s12GowerLegendreDistance'} = sprintf("%.6f", $res->{'s12GowerLegendreDistance'}) ;
+			$res->{'DotproductDistance'} = sprintf("%.6f", $res->{'DotproductDistance'}) ;
+#			$res->{'HammingDistance'} = sprintf("%.6f", $res->{'HammingDistance'}) ;
+			$res->{'EuclideanDistance'} = sprintf("%.6f", $res->{'EuclideanDistance'}) ;
 
 			if ($res->{'JaccardDistance'} <= $JaccardDistanceThreshold && $res->{'s12GowerLegendreDistance'} <= $s12GowerLegendreDistanceThreshold
-				&& $res->{'DotproductDistance' } <= $DotproductDistanceThreshold && $res->{'HammingDistance'} <= $HammingDistanceThreshold && 
-				$res->{'EuclideanDistance' } <= $EuclideanDistanceThreshold) {
-					
+				&& $res->{'DotproductDistance'} <= $DotproductDistanceThreshold && $res->{'HammingDistance'} <= $HammingDistanceThreshold && 
+				$res->{'EuclideanDistance'} <= $EuclideanDistanceThreshold) {
+
 				push (@filtered_res , $res) ;
 			}
 	}