Mercurial > repos > iuc > dexseq
annotate 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 |
rev | line source |
---|---|
1
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
1 def validate_input( trans, error_map, param_values, page_param_map ): |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
2 """ |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
3 Validates the user input, before execution. |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
4 """ |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
5 factors = param_values['rep_factorName'] |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
6 factor_name_list = [] |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
7 factor_duplication = False |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
8 level_duplication = False |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
9 |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
10 for factor in factors: |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
11 # factor names should be unique |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
12 fn = factor['factorName'] |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
13 if fn in factor_name_list: |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
14 factor_duplication = True |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
15 break |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
16 factor_name_list.append( fn ) |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
17 |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
18 level_name_list = list() |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
19 |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
20 for level in ['factorLevel1', 'factorLevel2']: |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
21 # level names under one factor should be unique |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
22 fl = factor[level] |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
23 if fl in level_name_list: |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
24 level_duplication = True |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
25 level_name_list.append( fl ) |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
26 |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
27 if level_duplication: |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
28 error_map['rep_factorName'] = [ dict() for t in factors ] |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
29 for i in range( len( factors ) ): |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
30 error_map['rep_factorName'][i]['FactorLevel1'] = [ {'factorLevel': 'Factor levels for each factor need to be unique'} for t in [factor['factorLevel1'], factor['factorLevel2']] ] |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
31 break |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
32 |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
33 if factor_duplication: |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
34 error_map['rep_factorName'] = [ dict() for t in factors ] |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
35 for i in range( len( factors ) ): |
f1c406f9554c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dexseq commit 93f63600a8d492e6c9006c1426fbae84de5ca232
iuc
parents:
0
diff
changeset
|
36 error_map['rep_factorName'][i]['factorName'] = 'Factor names need to be unique.' |