comparison emboss_format_corrector.py @ 17:ce385837c160 draft

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