1 | #!/usr/bin/env python |
---|
2 | |
---|
3 | # runs after the job (and after the default post-filter) |
---|
4 | import os |
---|
5 | from galaxy import eggs |
---|
6 | from galaxy import jobs |
---|
7 | from galaxy.tools.parameters import DataToolParameter |
---|
8 | # Older py compatibility |
---|
9 | try: |
---|
10 | set() |
---|
11 | except: |
---|
12 | from sets import Set as set |
---|
13 | |
---|
14 | def validate_input( trans, error_map, param_values, page_param_map ): |
---|
15 | dbkeys = set() |
---|
16 | data_param_names = set() |
---|
17 | data_params = 0 |
---|
18 | for name, param in page_param_map.iteritems(): |
---|
19 | if isinstance( param, DataToolParameter ): |
---|
20 | # for each dataset parameter |
---|
21 | if param_values.get(name, None) != None: |
---|
22 | dbkeys.add( param_values[name].dbkey ) |
---|
23 | data_params += 1 |
---|
24 | # check meta data |
---|
25 | try: |
---|
26 | param = param_values[name] |
---|
27 | startCol = int( param.metadata.startCol ) |
---|
28 | endCol = int( param.metadata.endCol ) |
---|
29 | chromCol = int( param.metadata.chromCol ) |
---|
30 | if param.metadata.strandCol is not None: |
---|
31 | strandCol = int ( param.metadata.strandCol ) |
---|
32 | else: |
---|
33 | strandCol = 0 |
---|
34 | except: |
---|
35 | error_msg = "The attributes of this dataset are not properly set. " + \ |
---|
36 | "Click the pencil icon in the history item to set the chrom, start, end and strand columns." |
---|
37 | error_map[name] = error_msg |
---|
38 | data_param_names.add( name ) |
---|
39 | if len( dbkeys ) > 1: |
---|
40 | for name in data_param_names: |
---|
41 | error_map[name] = "All datasets must belong to same genomic build, " \ |
---|
42 | "this dataset is linked to build '%s'" % param_values[name].dbkey |
---|
43 | if data_params != len(data_param_names): |
---|
44 | for name in data_param_names: |
---|
45 | error_map[name] = "A dataset of the appropriate type is required" |
---|