Mercurial > repos > devteam > emboss_5
annotate emboss_5/emboss_format_corrector.py @ 7:55075056bd56
Fix for emboss_format_corrector.py. Datatypes should be changed before the job is run.
author | Daniel Blankenberg <dan@bx.psu.edu> |
---|---|
date | Fri, 11 Oct 2013 14:03:31 -0400 |
parents | d3a9c3114f2c |
children |
rev | line source |
---|---|
0 | 1 #EMBOSS format corrector |
2 | |
3 import operator | |
4 | |
5 #Properly set file formats before job run | |
7
55075056bd56
Fix for emboss_format_corrector.py. Datatypes should be changed before the job is run.
Daniel Blankenberg <dan@bx.psu.edu>
parents:
0
diff
changeset
|
6 def exec_before_job( app, inp_data=None, out_data=None, tool=None, param_dict=None ): |
0 | 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 |