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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
1 # runs after the job (and after the default post-filter)
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
2 from galaxy.tools.parameters import DataToolParameter
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
3
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
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
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
6 dbkeys = set()
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
7 data_param_names = set()
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
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
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
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
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
14 data_params += 1
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
15 # check meta data
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
16 try:
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
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
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
19 # TODO: currently cannot validate GFF inputs b/c they are not derived from interval.
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
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
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
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
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
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
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
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
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
33 for name in data_param_names:
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
34 error_map[name] = "All datasets must belong to same genomic build, " \
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
35 "this dataset is linked to build '%s'" % param_values[name].dbkey
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
36 if data_params != len(data_param_names):
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
37 for name in data_param_names:
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
38 error_map[name] = "A dataset of the appropriate type is required"
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
39
3
c929b6540d07 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
40
0
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
41 def exec_after_merge(app, inp_data, out_data, param_dict, tool=None, stdout=None, stderr=None):
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
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
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
45 data.metadata.chromCol = 1
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
46 data.metadata.startCol = 2
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
47 data.metadata.endCol = 3
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
48 # merge always clobbers strand
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
49 data.metadata.strandCol = None
3
c929b6540d07 planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
devteam
parents: 0
diff changeset
50
0
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
51
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
52 def exec_after_cluster(app, inp_data, out_data, param_dict, tool=None, stdout=None, stderr=None):
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
53 # strip strand column if clusters were merged
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
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
3755ee8a74d7 Imported from capsule None
devteam
parents:
diff changeset
56 data.metadata.strandCol = None