Mercurial > repos > iuc > dexseq
diff dexseq_helper.py @ 1:f1c406f9554c draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
author | iuc |
---|---|
date | Sun, 29 Jan 2017 06:59:35 -0500 |
parents | 4ca0e679f21e |
children | 62adf13b86ea |
line wrap: on
line diff
--- a/dexseq_helper.py Thu Oct 08 16:52:01 2015 -0400 +++ b/dexseq_helper.py Sun Jan 29 06:59:35 2017 -0500 @@ -1,41 +1,36 @@ - -from galaxy.tools.parameters import DataToolParameter - -def validate_input( trans, error_map, param_values, page_param_map ): - """ - Validates the user input, before execution. - """ - factors = param_values['rep_factorName'] - factor_name_list = [] - factor_duplication = False - level_duplication = False - - for factor in factors: - # factor names should be unique - fn = factor['factorName'] - if fn in factor_name_list: - factor_duplication = True - break - factor_name_list.append( fn ) - - level_name_list = list() - factor_index_list = list() - - for level in ['factorLevel1', 'factorLevel2']: - # level names under one factor should be unique - fl = factor[level] - if fl in level_name_list: - level_duplication = True - level_name_list.append( fl ) - - if level_duplication: - error_map['rep_factorName'] = [ dict() for t in factors ] - for i in range( len( factors ) ): - error_map['rep_factorName'][i]['FactorLevel1'] = [ {'factorLevel': 'Factor levels for each factor need to be unique'} for t in [factor['factorLevel1'], factor['factorLevel2']] ] - break - - if factor_duplication: - error_map['rep_factorName'] = [ dict() for t in factors ] - for i in range( len( factors ) ): - error_map['rep_factorName'][i]['factorName'] = 'Factor names need to be unique.' - +def validate_input( trans, error_map, param_values, page_param_map ): + """ + Validates the user input, before execution. + """ + factors = param_values['rep_factorName'] + factor_name_list = [] + factor_duplication = False + level_duplication = False + + for factor in factors: + # factor names should be unique + fn = factor['factorName'] + if fn in factor_name_list: + factor_duplication = True + break + factor_name_list.append( fn ) + + level_name_list = list() + + for level in ['factorLevel1', 'factorLevel2']: + # level names under one factor should be unique + fl = factor[level] + if fl in level_name_list: + level_duplication = True + level_name_list.append( fl ) + + if level_duplication: + error_map['rep_factorName'] = [ dict() for t in factors ] + for i in range( len( factors ) ): + error_map['rep_factorName'][i]['FactorLevel1'] = [ {'factorLevel': 'Factor levels for each factor need to be unique'} for t in [factor['factorLevel1'], factor['factorLevel2']] ] + break + + if factor_duplication: + error_map['rep_factorName'] = [ dict() for t in factors ] + for i in range( len( factors ) ): + error_map['rep_factorName'][i]['factorName'] = 'Factor names need to be unique.'