@@ -41,7 +41,7 @@ def _load_id(self, tool, id_el):
41
41
:param tool: Tool object from cwlgen
42
42
:type tool: :class:`cwlgen.CommandLineTool`
43
43
:param id_el: Content of id
44
- :type id_el: STRING
44
+ :type id_el: STRING or [STRING]
45
45
"""
46
46
tool .tool_id = id_el
47
47
@@ -122,6 +122,42 @@ def _load_stdout(self, tool, stdout_el):
122
122
"""
123
123
tool .stdout = stdout_el
124
124
125
+ def _load_class(self , tool , class_el ):
126
+ """
127
+ Display message to inform that cwlgen only deal with CommandLineTool for the moment.
128
+
129
+ :param tool: Tool object from cwlgen
130
+ :type tool: :class:`cwlgen.CommandLineTool`
131
+ :param class_el: Content of class
132
+ :type class_el: STRING
133
+ """
134
+ if class_el != 'CommandLineTool' :
135
+ logger .warning ('cwlgen library only handle CommandLineTool for the moment' )
136
+
137
+ def _load_inputs (self , tool , inputs_el ):
138
+ """
139
+ Load the content of inputs into the tool.
140
+
141
+ :param tool: Tool object from cwlgen
142
+ :type tool: :class:`cwlgen.CommandLineTool`
143
+ :param inputs_el: Content of inputs
144
+ :type inputs_el: LIST or DICT
145
+ """
146
+ inp_parser = InputsParser ()
147
+ inp_parser .load_inputs (tool .inputs , inputs_el )
148
+
149
+ def _load_outputs (self , tool , outputs_el ):
150
+ """
151
+ Load the content of inputs into the tool.
152
+
153
+ :param tool: Tool object from cwlgen
154
+ :type tool: :class:`cwlgen.CommandLineTool`
155
+ :param outputs_el: Content of outputs
156
+ :type outputs_el: LIST or DICT
157
+ """
158
+ inp_parser = OutputsParser ()
159
+ inp_parser .load_outputs (tool .outputs , outputs_el )
160
+
125
161
def import_cwl (self , cwl_path ):
126
162
"""
127
163
Load content of cwl into the :class:`cwlgen.CommandLineTool` object.
@@ -140,3 +176,43 @@ def import_cwl(self, cwl_path):
140
176
except AttributeError :
141
177
logger .warning (key + " content is not processed (yet)." )
142
178
return tool
179
+
180
+
181
+ class InputsParser (object ):
182
+ """
183
+ Class to parse content of inputs from an existing CWL Tool.
184
+ """
185
+
186
+ def load_inputs (self , inputs , inputs_el ):
187
+ """
188
+ Load the content of inputs into the inputs list.
189
+
190
+ :param inputs: list to store inputs
191
+ :type inputs: LIST
192
+ :param inputs_el: Content of inputs
193
+ :type inputs_el: LIST or DICT
194
+ """
195
+ # For the moment, only deal with the format exported by cwlgen
196
+ for key , value in inputs_el .items ():
197
+ input_obj = cwlgen .CommandInputParameter (key )
198
+ inputs .append (input_obj )
199
+
200
+
201
+ class OutputsParser (object ):
202
+ """
203
+ Class to parse content of outputs from an existing CWL Tool.
204
+ """
205
+
206
+ def load_outputs (self , outputs , outputs_el ):
207
+ """
208
+ Load the content of outputs into the outputs list.
209
+
210
+ :param outputs: list to store outputs
211
+ :type outputs: LIST
212
+ :param outputs_el: Content of outputs
213
+ :type outputs_el: LIST or DICT
214
+ """
215
+ # For the moment, only deal with the format exported by cwlgen
216
+ for key , value in outputs_el .items ():
217
+ output_obj = cwlgen .CommandOutputParameter (key )
218
+ outputs .append (output_obj )
0 commit comments