changeset 19:c068ed713eb9

fixes on <when> tags
author pieter.lukasse@wur.nl
date Fri, 31 Jan 2014 12:21:51 +0100
parents 278680d76d71
children 24fb75fedee0
files msclust.xml primsfilters.py
diffstat 2 files changed, 50 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/msclust.xml	Tue Jan 28 16:22:15 2014 +0100
+++ b/msclust.xml	Fri Jan 31 12:21:51 2014 +0100
@@ -80,6 +80,10 @@
 			<when value="valueRange">
 				<param name="rangeUpperLimit" type="integer" size="10" value="0" label="Range upper limit" help="values up to this limit will be considered 'generated' values"  />
 			</when>
+			<when value="metot">
+     		</when>
+     		<when value="none">
+     		</when>
 		</conditional>		    
 	 	<conditional name="potDensFuncType">
 		    <param name="type" type="select" size="30" label="Select PD function type =====================================================">
@@ -111,10 +115,12 @@
 		    <when value="original">
 		    <!-- nothing -->
 			</when>
+		    <!-- one idea would be to have clustering specific tolerance values, not reusing the centrotype selection ones
 		    <when value="originalNewTol">
 		      <param name="clust_scan_toler" type="float" size="10" value="10" label="Peak Width, in scans"  />
 		      <param name="clust_scan_slope" type="float" size="10" value="2" label="Peak Width margin softness"  />
 		    </when>
+		    -->
 		    <when value="fuzzyCMeans">
 				<param name="fcmMembershipWeightingExponent" type="float" size="10" value="2.0" label="Membership Weighting Exponent" help="Influences cluster center repositioning in the iterations 1.1 (exploratory) to around 3.0 (conservative)" />
 				<param name="fcmStopCriterion" type="float" size="10" value="0.05" label="Stop Criterion" help="When convergence is 'reached' (e.g. 0.05 means memberships only changed with 5% in last iteration)" />
@@ -169,6 +175,8 @@
      			<param name="micMembershipThreshold" optional="true" type="float" size="10" label="MIC membership threshold" help="Minimum membership a peak should have to be counted in the MIC sum. E.g. 0.8 " />
      			
      		</when>
+     		<when value="No">
+			</when>
      	</conditional>	
 
      	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/primsfilters.py	Fri Jan 31 12:21:51 2014 +0100
@@ -0,0 +1,42 @@
+import logging
+log = logging.getLogger( __name__ )
+
+
+def restrict_prims_metabolomics( context, tool ):
+    """
+    This tool filter will hide prims_metabolomics tools for non-metabolomics users. 
+    This can be enabled by adding the following to the
+     ``app:main`` section of ``universe_wsgi.ini``::
+
+        tool_filters = primsfilters:restrict_prims_metabolomics
+        
+    and by adding this file to the folder:
+    
+        <galaxy-dist>/lib/galaxy/tools/filters
+        
+    This is optional and can be used in case some control is desired on whom 
+    gets to see the prims_metabolomics tools. When not using this file and the 
+    settings mentioned above, all prims_metabolomics tools will be visible to 
+    all users.  
+    """
+    # for debugging: import pydevd;pydevd.settrace("L0136815.wurnet.nl")
+    user = context.trans.user
+    metabolomics_tools = [ "msclust2", "combine_output", "create_poly_model", "lookup_library", "NDIStext2tabular", "rankfilterGCMS_tabular", "filter_on_rank" ]
+    found_match = False
+    # iterate over the tool (partial)ids and look for a match (this is compatible with tool shed given ids):
+    for partial_id in metabolomics_tools:
+        if tool.id.find("/"+ partial_id + "/") >= 0:
+            found_match = True
+            break
+    # the second part of this if is compatible with the ids when NOT using tool shed:    
+    if found_match or tool.id in metabolomics_tools: 
+        # logging.warn( 'FILTER MATCHED: %s' %(tool.name))        
+    
+        for user_role in user.roles:
+            if user_role.role.name == "PRIMS_METABOLOMICS":
+                return True
+        # not found to have the role, return false:
+        return False
+    else:
+        # return true for any other tool
+        return True
\ No newline at end of file