Mercurial > repos > devteam > intersect
annotate operation_filter.py @ 6:69c10b56f46d draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/intersect commit d7b1a60c0aecc46b7f625c3e32f882562b512fd9
author | devteam |
---|---|
date | Mon, 13 Jun 2022 16:23:33 +0000 |
parents | 33b3f3688db4 |
children |
rev | line source |
---|---|
0 | 1 # runs after the job (and after the default post-filter) |
5
33b3f3688db4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/intersect commit cae3e05d02e60f595bb8b6d77a84f030e9bd1689
devteam
parents:
3
diff
changeset
|
2 from galaxy.jobs.handler import JOB_ERROR |
0 | 3 from galaxy.tools.parameters import DataToolParameter |
4 | |
5 # Older py compatibility | |
6 try: | |
7 set() | |
8 except: | |
9 from sets import Set as set | |
10 | |
11 | |
12 def validate_input( trans, error_map, param_values, page_param_map ): | |
13 dbkeys = set() | |
14 data_param_names = set() | |
15 data_params = 0 | |
5
33b3f3688db4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/intersect commit cae3e05d02e60f595bb8b6d77a84f030e9bd1689
devteam
parents:
3
diff
changeset
|
16 for name, param in page_param_map.items(): |
0 | 17 if isinstance( param, DataToolParameter ): |
18 # for each dataset parameter | |
3
5f72be09cfd3
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/intersect commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
0
diff
changeset
|
19 if param_values.get(name, None) is not None: |
0 | 20 dbkeys.add( param_values[name].dbkey ) |
21 data_params += 1 | |
22 # check meta data | |
23 try: | |
24 param = param_values[name] | |
25 if isinstance( param.datatype, trans.app.datatypes_registry.get_datatype_by_extension( 'gff' ).__class__ ): | |
26 # TODO: currently cannot validate GFF inputs b/c they are not derived from interval. | |
27 pass | |
3
5f72be09cfd3
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/intersect commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
0
diff
changeset
|
28 else: # Validate interval datatype. |
5f72be09cfd3
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/intersect commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
0
diff
changeset
|
29 int( param.metadata.startCol ) |
5f72be09cfd3
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/intersect commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
0
diff
changeset
|
30 int( param.metadata.endCol ) |
5f72be09cfd3
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/intersect commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
0
diff
changeset
|
31 int( param.metadata.chromCol ) |
0 | 32 if param.metadata.strandCol is not None: |
3
5f72be09cfd3
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/intersect commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
0
diff
changeset
|
33 int( param.metadata.strandCol ) |
0 | 34 except: |
35 error_msg = "The attributes of this dataset are not properly set. " + \ | |
3
5f72be09cfd3
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/intersect commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
0
diff
changeset
|
36 "Click the pencil icon in the history item to set the chrom, start, end and strand columns." |
0 | 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" | |
46 | |
3
5f72be09cfd3
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/intersect commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
0
diff
changeset
|
47 |
0 | 48 def exec_after_merge(app, inp_data, out_data, param_dict, tool=None, stdout=None, stderr=None): |
49 # strip strand column if clusters were merged | |
3
5f72be09cfd3
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/intersect commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
0
diff
changeset
|
50 for data in out_data.values(): |
5f72be09cfd3
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/intersect commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
0
diff
changeset
|
51 if param_dict['returntype'] is True: |
0 | 52 data.metadata.chromCol = 1 |
53 data.metadata.startCol = 2 | |
54 data.metadata.endCol = 3 | |
55 # merge always clobbers strand | |
56 data.metadata.strandCol = None | |
3
5f72be09cfd3
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/intersect commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
0
diff
changeset
|
57 |
0 | 58 |
59 def exec_after_cluster(app, inp_data, out_data, param_dict, tool=None, stdout=None, stderr=None): | |
60 # strip strand column if clusters were merged | |
61 if param_dict["returntype"] == '1': | |
3
5f72be09cfd3
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/intersect commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
0
diff
changeset
|
62 for data in out_data.values(): |
0 | 63 data.metadata.strandCol = None |