root/galaxy-central/tools/emboss_5/emboss_format_corrector.py

リビジョン 2, 1.9 KB (コミッタ: hatakeyama, 14 年 前)

import galaxy-central

行番号 
1#EMBOSS format corrector
2
3import operator
4#from galaxy import datatypes
5
6#Properly set file formats after job run
7def exec_after_process( app, inp_data, out_data, param_dict,tool, stdout, stderr):
8#Properly set file formats before job run
9#def exec_before_job(trans, inp_data, out_data, param_dict,tool):
10    #why isn't items an ordered list?
11    items = out_data.items()
12    #lets sort it ourselves....
13    items = sorted(items, key=operator.itemgetter(0))
14    #items is now sorted...
15   
16    #normal filetype correction
17    data_count=1
18    for name, data in items:
19        outputType = param_dict.get( 'out_format'+str(data_count), None )
20        #print "data_count",data_count, "name", name, "outputType", outputType
21        if outputType !=None:
22            if outputType == 'ncbi':
23                outputType = "fasta"
24            elif outputType == 'excel':
25                outputType = "tabular"
26            elif outputType == 'text':
27                outputType = "txt"
28            data = app.datatypes_registry.change_datatype(data, outputType)
29            app.model.context.add( data )
30            app.model.context.flush()
31        data_count+=1
32   
33    #html filetype correction
34    data_count=1
35    for name, data in items:
36        wants_plot = param_dict.get( 'html_out'+str(data_count), None )
37        ext = "html"
38        if wants_plot == "yes":
39            data = app.datatypes_registry.change_datatype(data, ext)
40            app.model.context.add( data )
41            app.model.context.flush()
42        data_count+=1
43   
44    #png file correction
45    data_count=1
46    for name, data in items:
47        wants_plot = param_dict.get( 'plot'+str(data_count), None )
48        ext = "png"
49        if wants_plot == "yes":
50            data = app.datatypes_registry.change_datatype(data, ext)
51            app.model.context.add( data )
52            app.model.context.flush()
53        data_count+=1
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。