comparison dexseq_helper.py @ 0:4ca0e679f21e draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 876fc32b23d3b9c378ddbfbbba27d37d22576c85
author iuc
date Thu, 08 Oct 2015 16:52:01 -0400
parents
children f1c406f9554c
comparison
equal deleted inserted replaced
-1:000000000000 0:4ca0e679f21e
1
2 from galaxy.tools.parameters import DataToolParameter
3
4 def validate_input( trans, error_map, param_values, page_param_map ):
5 """
6 Validates the user input, before execution.
7 """
8 factors = param_values['rep_factorName']
9 factor_name_list = []
10 factor_duplication = False
11 level_duplication = False
12
13 for factor in factors:
14 # factor names should be unique
15 fn = factor['factorName']
16 if fn in factor_name_list:
17 factor_duplication = True
18 break
19 factor_name_list.append( fn )
20
21 level_name_list = list()
22 factor_index_list = list()
23
24 for level in ['factorLevel1', 'factorLevel2']:
25 # level names under one factor should be unique
26 fl = factor[level]
27 if fl in level_name_list:
28 level_duplication = True
29 level_name_list.append( fl )
30
31 if level_duplication:
32 error_map['rep_factorName'] = [ dict() for t in factors ]
33 for i in range( len( factors ) ):
34 error_map['rep_factorName'][i]['FactorLevel1'] = [ {'factorLevel': 'Factor levels for each factor need to be unique'} for t in [factor['factorLevel1'], factor['factorLevel2']] ]
35 break
36
37 if factor_duplication:
38 error_map['rep_factorName'] = [ dict() for t in factors ]
39 for i in range( len( factors ) ):
40 error_map['rep_factorName'][i]['factorName'] = 'Factor names need to be unique.'
41