comparison emboss_format_corrector.py @ 10:d49956b87f7e draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/emboss_5 commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
author iuc
date Wed, 08 Feb 2017 12:42:22 -0500
parents
children ce385837c160
comparison
equal deleted inserted replaced
9:511429456d3c 10:d49956b87f7e
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