2424CWL_VERSIONS = ['draft-2' , 'draft-3.dev1' , 'draft-3.dev2' , 'draft-3.dev3' ,
2525 'draft-3.dev4' , 'draft-3.dev5' , 'draft-3' , 'draft-4.dev1' ,
2626 'draft-4.dev2' , 'draft-4.dev3' , 'v1.0.dev4' , 'v1.0' , None ]
27+ DEF_VERSION = 'v1.0'
2728CWL_TYPE = ['null' , 'boolean' , 'int' , 'long' , 'float' , 'double' , 'string' , 'File' ,
2829 'Directory' , None ]
2930
@@ -37,6 +38,8 @@ class CommandLineTool(object):
3738 Contain all informations to describe a CWL command line tool.
3839 '''
3940
41+ __CLASS__ = 'CommandLineTool'
42+
4043 def __init__ (self , tool_id = None , base_command = None , label = None , doc = None ,
4144 cwl_version = None , stdin = None , stderr = None , stdout = None ):
4245 '''
@@ -63,22 +66,22 @@ def __init__(self, tool_id=None, base_command=None, label=None, doc=None,
6366 and requirements (:class:`cwlgen.Requirement` objects)
6467 are stored in lists which are initialized empty.
6568 '''
66- self .id = tool_id
67- self .baseCommand = base_command
68- self .label = label
69- self .doc = doc
7069 if cwl_version not in CWL_VERSIONS :
7170 LOGGER .warning ("CWL version is not recognized as a valid version." )
72- cwl_version = None
71+ cwl_version = DEF_VERSION
7372 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 = []
7777 self .inputs = [] # List of [CommandInputParameter] objects
7878 self .outputs = [] # List of [CommandOutputParameter] objects
79+ self .baseCommand = base_command
7980 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
8285 self .successCodes = []
8386 self .temporaryFailCodes = []
8487 self .permanentFailCodes = []
@@ -88,7 +91,7 @@ def export(self, outfile=None):
8891 Export the tool in CWL either on STDOUT or in outfile.
8992 '''
9093 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__
9295 # Add Inputs
9396 if self .inputs :
9497 cwl_tool ['inputs' ] = {}
@@ -209,6 +212,7 @@ def get_dict(self):
209212 :rtype: DICT
210213 '''
211214 dict_in = Parameter .get_dict (self )
215+ del dict_in ['id' ]
212216 if self .inputBinding :
213217 dict_in ['inputBinding' ] = self .inputBinding .get_dict ()
214218 return dict_in
@@ -253,6 +257,7 @@ def get_dict(self):
253257 :rtype: DICT
254258 '''
255259 dict_out = Parameter .get_dict (self )
260+ del dict_out ['id' ]
256261 if self .outputBinding :
257262 dict_out ['outputBinding' ] = self .outputBinding .get_dict ()
258263 return dict_out
0 commit comments