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