24
24
CWL_VERSIONS = ['draft-2' , 'draft-3.dev1' , 'draft-3.dev2' , 'draft-3.dev3' ,
25
25
'draft-3.dev4' , 'draft-3.dev5' , 'draft-3' , 'draft-4.dev1' ,
26
26
'draft-4.dev2' , 'draft-4.dev3' , 'v1.0.dev4' , 'v1.0' , None ]
27
+ DEF_VERSION = 'v1.0'
27
28
CWL_TYPE = ['null' , 'boolean' , 'int' , 'long' , 'float' , 'double' , 'string' , 'File' ,
28
29
'Directory' , None ]
29
30
@@ -37,6 +38,8 @@ class CommandLineTool(object):
37
38
Contain all informations to describe a CWL command line tool.
38
39
'''
39
40
41
+ __CLASS__ = 'CommandLineTool'
42
+
40
43
def __init__ (self , tool_id = None , base_command = None , label = None , doc = None ,
41
44
cwl_version = None , stdin = None , stderr = None , stdout = None ):
42
45
'''
@@ -63,22 +66,22 @@ def __init__(self, tool_id=None, base_command=None, label=None, doc=None,
63
66
and requirements (:class:`cwlgen.Requirement` objects)
64
67
are stored in lists which are initialized empty.
65
68
'''
66
- self .id = tool_id
67
- self .baseCommand = base_command
68
- self .label = label
69
- self .doc = doc
70
69
if cwl_version not in CWL_VERSIONS :
71
70
LOGGER .warning ("CWL version is not recognized as a valid version." )
72
- cwl_version = None
71
+ cwl_version = DEF_VERSION
73
72
self .cwlVersion = cwl_version
74
- self .stdin = stdin
75
- self .stderr = stderr
76
- self .stdout = stdout
73
+ self .id = tool_id
74
+ self .label = label
75
+ self .requirements = [] # List of Several object inhereting from [Requirement]
76
+ self .hints = []
77
77
self .inputs = [] # List of [CommandInputParameter] objects
78
78
self .outputs = [] # List of [CommandOutputParameter] objects
79
+ self .baseCommand = base_command
79
80
self .arguments = [] # List of [CommandLineBinding] objects
80
- self .requirements = [] # List of Several object inhereting from [Requirement]
81
- self .hints = []
81
+ self .doc = doc
82
+ self .stdin = stdin
83
+ self .stderr = stderr
84
+ self .stdout = stdout
82
85
self .successCodes = []
83
86
self .temporaryFailCodes = []
84
87
self .permanentFailCodes = []
@@ -88,7 +91,7 @@ def export(self, outfile=None):
88
91
Export the tool in CWL either on STDOUT or in outfile.
89
92
'''
90
93
cwl_tool = {k : v for k , v in vars (self ).items () if v is not None and v != []}
91
- cwl_tool ['class' ] = 'CommandLineTool'
94
+ cwl_tool ['class' ] = self . __CLASS__
92
95
# Add Inputs
93
96
if self .inputs :
94
97
cwl_tool ['inputs' ] = {}
@@ -209,6 +212,7 @@ def get_dict(self):
209
212
:rtype: DICT
210
213
'''
211
214
dict_in = Parameter .get_dict (self )
215
+ del dict_in ['id' ]
212
216
if self .inputBinding :
213
217
dict_in ['inputBinding' ] = self .inputBinding .get_dict ()
214
218
return dict_in
@@ -253,6 +257,7 @@ def get_dict(self):
253
257
:rtype: DICT
254
258
'''
255
259
dict_out = Parameter .get_dict (self )
260
+ del dict_out ['id' ]
256
261
if self .outputBinding :
257
262
dict_out ['outputBinding' ] = self .outputBinding .get_dict ()
258
263
return dict_out
0 commit comments