File: WorkflowDemo2.py

package info (click to toggle)
mobyle 1.5.5%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 8,288 kB
  • sloc: python: 22,709; makefile: 35; sh: 33; ansic: 10; xml: 6
file content (63 lines) | stat: -rw-r--r-- 1,766 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
########################################################################################
#                                                                                      #
#   Author: Herve Menager,                                                             #
#   Organization:'Biological Software and Databases' Group, Institut Pasteur, Paris.   #  
#   Distributed under GPLv2 Licence. Please refer to the COPYING.LIB document.         #
#                                                                                      #
########################################################################################
from Mobyle.Workflow import Workflow, Task, Link, Parameter, Type, Datatype, Biotype, Parser, InputValue  #@UnusedImport

print __file__

if __name__ == "__main__":
    
    wf = Workflow()
    wf.name = 'toto'
    wf.version = '1.1'
    wf.title = 'test workflow'
    wf.description = 'this workflow is a test one'
    t1 = Task()
    t1.id = 1
    t1.service = 'clustalw-multialign'
    t1.suspend = False
    t1.description = "Run a clustalw"

    iv = InputValue()
    iv.name = 'infile'
    iv.value = """>A
TTTT

>B
TATA
"""
    iv2 = InputValue()
    iv2.name = 'outputformat'
    iv2.value = 'PHYLIP'

    t1.input_values = [iv,iv2]
    
    t2 = Task()
    t2.id = 2
    t2.service = 'protdist'
    t2.suspend = True
    t2.description = "Run a protdist"
    
    l = Link()
    l.from_task = t1.id
    l.to_task = t2.id
    l.from_parameter = "aligfile"
    l.to_parameter = "infile"
    
    wf.tasks = [t1, t2]
    wf.links = [l]

    mp = Parser()
    
    print mp.tostring(wf)
    
    wffile = open( '/tmp/workflow2.xml', 'w' )
    wffile.write( mp.tostring(wf)) 
    wffile.close()


    print mp.parse('/tmp/workflow2.xml')