Mercurial > repos > devteam > basecoverage
annotate operation_filter.py @ 6:4d584cf5ced5 draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/basecoverage commit 200bd4645dd768eb6ee1aab7d181b76d34d13d4c
author | devteam |
---|---|
date | Mon, 13 Jun 2022 16:26:51 +0000 |
parents | 37652c34b3bf |
children |
rev | line source |
---|---|
0 | 1 # runs after the job (and after the default post-filter) |
2 from galaxy.tools.parameters import DataToolParameter | |
3 | |
4 | |
6
4d584cf5ced5
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/basecoverage commit 200bd4645dd768eb6ee1aab7d181b76d34d13d4c
devteam
parents:
5
diff
changeset
|
5 def validate_input(trans, error_map, param_values, page_param_map): |
0 | 6 dbkeys = set() |
7 data_param_names = set() | |
8 data_params = 0 | |
5
37652c34b3bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/basecoverage commit cae3e05d02e60f595bb8b6d77a84f030e9bd1689
devteam
parents:
3
diff
changeset
|
9 for name, param in page_param_map.items(): |
6
4d584cf5ced5
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/basecoverage commit 200bd4645dd768eb6ee1aab7d181b76d34d13d4c
devteam
parents:
5
diff
changeset
|
10 if isinstance(param, DataToolParameter): |
0 | 11 # for each dataset parameter |
3
c929b6540d07
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
0
diff
changeset
|
12 if param_values.get(name, None) is not None: |
6
4d584cf5ced5
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/basecoverage commit 200bd4645dd768eb6ee1aab7d181b76d34d13d4c
devteam
parents:
5
diff
changeset
|
13 dbkeys.add(param_values[name].dbkey) |
0 | 14 data_params += 1 |
15 # check meta data | |
16 try: | |
17 param = param_values[name] | |
6
4d584cf5ced5
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/basecoverage commit 200bd4645dd768eb6ee1aab7d181b76d34d13d4c
devteam
parents:
5
diff
changeset
|
18 if isinstance(param.datatype, trans.app.datatypes_registry.get_datatype_by_extension('gff').__class__): |
0 | 19 # TODO: currently cannot validate GFF inputs b/c they are not derived from interval. |
20 pass | |
3
c929b6540d07
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
0
diff
changeset
|
21 else: # Validate interval datatype. |
6
4d584cf5ced5
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/basecoverage commit 200bd4645dd768eb6ee1aab7d181b76d34d13d4c
devteam
parents:
5
diff
changeset
|
22 int(param.metadata.startCol) |
4d584cf5ced5
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/basecoverage commit 200bd4645dd768eb6ee1aab7d181b76d34d13d4c
devteam
parents:
5
diff
changeset
|
23 int(param.metadata.endCol) |
4d584cf5ced5
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/basecoverage commit 200bd4645dd768eb6ee1aab7d181b76d34d13d4c
devteam
parents:
5
diff
changeset
|
24 int(param.metadata.chromCol) |
0 | 25 if param.metadata.strandCol is not None: |
6
4d584cf5ced5
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/basecoverage commit 200bd4645dd768eb6ee1aab7d181b76d34d13d4c
devteam
parents:
5
diff
changeset
|
26 int(param.metadata.strandCol) |
4d584cf5ced5
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/basecoverage commit 200bd4645dd768eb6ee1aab7d181b76d34d13d4c
devteam
parents:
5
diff
changeset
|
27 except Exception: |
0 | 28 error_msg = "The attributes of this dataset are not properly set. " + \ |
3
c929b6540d07
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
0
diff
changeset
|
29 "Click the pencil icon in the history item to set the chrom, start, end and strand columns." |
0 | 30 error_map[name] = error_msg |
6
4d584cf5ced5
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/basecoverage commit 200bd4645dd768eb6ee1aab7d181b76d34d13d4c
devteam
parents:
5
diff
changeset
|
31 data_param_names.add(name) |
4d584cf5ced5
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/gops/basecoverage commit 200bd4645dd768eb6ee1aab7d181b76d34d13d4c
devteam
parents:
5
diff
changeset
|
32 if len(dbkeys) > 1: |
0 | 33 for name in data_param_names: |
34 error_map[name] = "All datasets must belong to same genomic build, " \ | |
35 "this dataset is linked to build '%s'" % param_values[name].dbkey | |
36 if data_params != len(data_param_names): | |
37 for name in data_param_names: | |
38 error_map[name] = "A dataset of the appropriate type is required" | |
39 | |
3
c929b6540d07
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
0
diff
changeset
|
40 |
0 | 41 def exec_after_merge(app, inp_data, out_data, param_dict, tool=None, stdout=None, stderr=None): |
42 # strip strand column if clusters were merged | |
3
c929b6540d07
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
0
diff
changeset
|
43 for data in out_data.values(): |
c929b6540d07
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
0
diff
changeset
|
44 if param_dict['returntype'] is True: |
0 | 45 data.metadata.chromCol = 1 |
46 data.metadata.startCol = 2 | |
47 data.metadata.endCol = 3 | |
48 # merge always clobbers strand | |
49 data.metadata.strandCol = None | |
3
c929b6540d07
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
0
diff
changeset
|
50 |
0 | 51 |
52 def exec_after_cluster(app, inp_data, out_data, param_dict, tool=None, stdout=None, stderr=None): | |
53 # strip strand column if clusters were merged | |
54 if param_dict["returntype"] == '1': | |
3
c929b6540d07
planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents:
0
diff
changeset
|
55 for data in out_data.values(): |
0 | 56 data.metadata.strandCol = None |