comparison emboss_format_corrector.py @ 0:de3a45e9ccce draft

"planemo upload for repository https://github.com/brinkmanlab/galaxy-tools/tree/master/emboss commit eaefd81cf7afec08ffc570ac53d6718d62743a99"
author brinkmanlab
date Tue, 25 Jan 2022 03:26:28 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:de3a45e9ccce
1 # EMBOSS format corrector
2 import operator
3
4
5 # Properly set file formats before job run
6 def exec_before_job(app, inp_data=None, out_data=None, tool=None, param_dict=None):
7 # why isn't items an ordered list?
8 items = out_data.items()
9 items = sorted(items, key=operator.itemgetter(0))
10
11 # normal filetype correction
12 data_count = 1
13 for name, data in items:
14 outputType = param_dict.get('out_format' + str(data_count), None)
15 if outputType is not None:
16 if outputType == 'ncbi':
17 outputType = "fasta"
18 elif outputType == 'excel':
19 outputType = "tabular"
20 elif outputType == 'text':
21 outputType = "txt"
22 data = app.datatypes_registry.change_datatype(data, outputType)
23 app.model.context.add(data)
24 app.model.context.flush()
25 data_count += 1
26
27 # html filetype correction
28 data_count = 1
29 for name, data in items:
30 wants_plot = param_dict.get('html_out' + str(data_count), None)
31 ext = "html"
32 if wants_plot == "yes":
33 data = app.datatypes_registry.change_datatype(data, ext)
34 app.model.context.add(data)
35 app.model.context.flush()
36 data_count += 1
37
38 # png file correction
39 data_count = 1
40 for name, data in items:
41 wants_plot = param_dict.get('plot' + str(data_count), None)
42 ext = "png"
43 if wants_plot == "yes":
44 data = app.datatypes_registry.change_datatype(data, ext)
45 app.model.context.add(data)
46 app.model.context.flush()
47 data_count += 1