Mercurial > repos > pieterlukasse > prims_metabolomics
annotate primsfilters.py @ 28:b1015b9241cd
Added option for using retentionMean (micro minutes) for the time dimension
author | pieter.lukasse@wur.nl |
---|---|
date | Fri, 09 May 2014 17:07:58 +0200 |
parents | cd4f13119afa |
children |
rev | line source |
---|---|
19 | 1 import logging |
2 log = logging.getLogger( __name__ ) | |
3 | |
4 | |
5 def restrict_prims_metabolomics( context, tool ): | |
6 """ | |
7 This tool filter will hide prims_metabolomics tools for non-metabolomics users. | |
8 This can be enabled by adding the following to the | |
9 ``app:main`` section of ``universe_wsgi.ini``:: | |
10 | |
11 tool_filters = primsfilters:restrict_prims_metabolomics | |
12 | |
13 and by adding this file to the folder: | |
14 | |
15 <galaxy-dist>/lib/galaxy/tools/filters | |
16 | |
17 This is optional and can be used in case some control is desired on whom | |
18 gets to see the prims_metabolomics tools. When not using this file and the | |
19 settings mentioned above, all prims_metabolomics tools will be visible to | |
20 all users. | |
21 """ | |
22 # for debugging: import pydevd;pydevd.settrace("L0136815.wurnet.nl") | |
23 user = context.trans.user | |
22
cd4f13119afa
Small fix in filters part and improvement in query_metexp time logging
pieter.lukasse@wur.nl
parents:
19
diff
changeset
|
24 metabolomics_tools = [ "msclust2", "combine_output", "create_poly_model", "lookup_library", |
cd4f13119afa
Small fix in filters part and improvement in query_metexp time logging
pieter.lukasse@wur.nl
parents:
19
diff
changeset
|
25 "NDIStext2tabular", "rankfilterGCMS_tabular", "filter_on_rank", |
cd4f13119afa
Small fix in filters part and improvement in query_metexp time logging
pieter.lukasse@wur.nl
parents:
19
diff
changeset
|
26 "export_to_metexp_tabular", "query_metexp" ] |
19 | 27 found_match = False |
28 # iterate over the tool (partial)ids and look for a match (this is compatible with tool shed given ids): | |
29 for partial_id in metabolomics_tools: | |
30 if tool.id.find("/"+ partial_id + "/") >= 0: | |
31 found_match = True | |
32 break | |
33 # the second part of this if is compatible with the ids when NOT using tool shed: | |
34 if found_match or tool.id in metabolomics_tools: | |
35 # logging.warn( 'FILTER MATCHED: %s' %(tool.name)) | |
36 | |
37 for user_role in user.roles: | |
38 if user_role.role.name == "PRIMS_METABOLOMICS": | |
39 return True | |
40 # not found to have the role, return false: | |
41 return False | |
42 else: | |
43 # return true for any other tool | |
44 return True |