comparison emboss_format_corrector.py @ 10:9b98d3d903c6 draft

planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/emboss_5 commit fc158bfe5f5927dc199321a2cf43310373cbc8ba
author devteam
date Fri, 12 Aug 2016 19:17:10 -0400
parents
children 0e2484b6829b
comparison
equal deleted inserted replaced
9:18a63c800a4d 10:9b98d3d903c6
1 #EMBOSS format corrector
2
3 import operator
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 #lets sort it ourselves....
10 items = sorted(items, key=operator.itemgetter(0))
11 #items is now sorted...
12
13 #normal filetype correction
14 data_count=1
15 for name, data in items:
16 outputType = param_dict.get( 'out_format'+str(data_count), None )
17 #print "data_count",data_count, "name", name, "outputType", outputType
18 if outputType !=None:
19 if outputType == 'ncbi':
20 outputType = "fasta"
21 elif outputType == 'excel':
22 outputType = "tabular"
23 elif outputType == 'text':
24 outputType = "txt"
25 data = app.datatypes_registry.change_datatype(data, outputType)
26 app.model.context.add( data )
27 app.model.context.flush()
28 data_count+=1
29
30 #html filetype correction
31 data_count=1
32 for name, data in items:
33 wants_plot = param_dict.get( 'html_out'+str(data_count), None )
34 ext = "html"
35 if wants_plot == "yes":
36 data = app.datatypes_registry.change_datatype(data, ext)
37 app.model.context.add( data )
38 app.model.context.flush()
39 data_count+=1
40
41 #png file correction
42 data_count=1
43 for name, data in items:
44 wants_plot = param_dict.get( 'plot'+str(data_count), None )
45 ext = "png"
46 if wants_plot == "yes":
47 data = app.datatypes_registry.change_datatype(data, ext)
48 app.model.context.add( data )
49 app.model.context.flush()
50 data_count+=1