34
34
35
35
class CommandLineTool (object ):
36
36
'''
37
- Contain all informations to describe a CWL command line tool
37
+ Contain all informations to describe a CWL command line tool.
38
38
'''
39
39
40
40
def __init__ (self , tool_id = None , base_command = None , label = None , doc = None ,\
41
41
cwl_version = DEF_CWL_VERSION , stdin = None , stderr = None , stdout = None ):
42
42
'''
43
- tool_id: unique identifier for this tool [STRING]
44
-
10000
base_command: command line for the tool [STRING]
45
- label: label of this tool [STRING]
46
- doc: documentation for the tool [STRING]
47
- cwl_version: [STRING]
48
- stdin: path to a file whose contents must be piped into stdin [STRING]
49
- stderr: capture stderr into the file [STRING]
50
- stdout: capture stdout into the file [STRING]
43
+ :param tool_id: unique identifier for this tool.
44
+ :type tool_id: STRING
45
+ :param base_command: command line for the tool.
46
+ :type base_command: STRING
47
+ :param label: label of this tool.
48
+ :type label: STRING
49
+ :param doc: documentation for the tool, usually longer than the label.
50
+ :type doc: STRING
51
+ :param cwl_version: version of the CWL tool.
52
+ :type cwl_version: STRING
53
+ :param stdin: path to a file whose contents must be piped into stdin.
54
+ :type stdin: STRING
55
+ :param stderr: capture stderr into the given file.
56
+ :type stderr: STRING
57
+ :param stdout: capture stdout into the given file.
58
+ :type stdout: STRING
59
+
60
+ Inputs (:class:`cwlgen.CommandInputParameter` objects),
61
+ outputs (:class:`cwlgen.CommandOutputParameter` objects),
62
+ arguments (:class:`cwlgen.CommandLineBinding` objects)
63
+ and requirements (:class:`cwlgen.Requirement` objects)
64
+ are stored in lists which are initialized empty.
51
65
'''
52
66
self .tool_id = tool_id
53
67
self .base_command = base_command
@@ -68,7 +82,7 @@ def __init__(self, tool_id=None, base_command=None, label=None, doc=None,\
68
82
69
83
def export (self , outfile = None ):
70
84
'''
71
- Export the tool in CWL
85
+ Export the tool in CWL either on STDOUT or in outfile
72
86
'''
73
87
cwl_tool = {}
74
88
cwl_tool ['cwlVersion' ] = self .cwl_version
@@ -153,23 +167,32 @@ def get_dict(self):
153
167
154
168
class CommandInputParameter (Parameter ):
155
169
'''
156
- An input parameter for a CommandLineTool
170
+ An input parameter for a :class:`cwlgen. CommandLineTool`.
157
171
'''
158
172
159
173
def __init__ (self , param_id , label = None , secondary_files = None , param_format = None ,\
160
174
streamable = False , doc = None , input_binding = None , default = None , param_type = None ):
161
175
'''
162
- param_id: unique identifier for this parameter [STRING]
163
- label: short, human-readable label [STRING]
164
- secondary_files: If type is a file, describes files that must be included alongside
165
- the primary file(s) [STRING]
166
- param_format: If type is a file, uri to ontology of the format or exact format [STRING]
167
- streamable: If type is a file, true indicates that the file is read or written
168
- sequentially without seeking [BOOLEAN]
169
- doc: documentation [STRING]
170
- input_binding: describes how to handle the input [CommandLineBinding]
171
- default: default value [STRING]
172
- param_type: type of data assigned to the parameter [STRING] corresponding to CWLType
176
+ :param param_id: unique identifier for this parameter.
177
+ :type param_id: STRING
178
+ :param label: short, human-readable label.
179
+ :type label: STRING
180
+ :param secondary_files: If type is a file, describes files that must be
181
+ included alongside the primary file(s).
182
+ :type secondary_files: STRING
183
+ :param param_format: If type is a file, uri to ontology of the format or exact format.
184
+ :type param_format: STRING
185
+ :param streamable: If type is a file, true indicates that the file is read or written
186
+ sequentially without seeking.
187
+ :type streamable: BOOLEAN
188
+ :param doc: documentation.
189
+ :type doc: STRING
190
+ :param input_binding: describes how to handle the input.
191
+ :type input_binding: :class:`cwlgen.CommandLineBinding` object
192
+ :param default: default value.
193
+ :type default: STRING
194
+ :param param_type: type of data assigned to the parameter corresponding to CWLType.
195
+ :type param_type: STRING
173
196
'''
174
197
Parameter .__init__ (self , param_id = param_id , label = label , \
175
198
secondary_files = secondary_files , param_format = param_format ,\
@@ -179,7 +202,7 @@ def __init__(self, param_id, label=None, secondary_files=None, param_format=None
179
202
180
203
def get_dict (self ):
181
204
'''
182
- Transform the object to a [DICT] to write CWL
205
+ Transform the object to a [DICT] to write CWL.
183
206
'''
184
207
dict_in = Parameter .get_dict (self )
185
208
if self .default :
@@ -191,30 +214,38 @@ def get_dict(self):
191
214
192
215
class CommandOutputParameter (Parameter ):
193
216
'''
194
- An output parameter for a CommandLineTool
217
+ An output parameter for a :class:`cwlgen. CommandLineTool`.
195
218
'''
196
219
197
220
def __init__ (self , param_id , label = None , secondary_files = None , param_format = None ,\
198
221
streamable = False , doc = None , output_binding = None , param_type = None ):
199
222
'''
200
- param_id: unique identifier for this parameter [STRING]
201
- label: short, human-readable label [STRING]
202
- secondary_files: If type is a file, describes files that must be included alongside
203
- the primary file(s) [STRING]
204
- param_format: If type is a file, uri to ontology of the format or exact format [STRING]
205
- streamable: If type is a file, true indicates that the file is read or written
206
- sequentially without seeking [BOOLEAN]
207
- doc: documentation [STRING]
208
- output_binding: describes how to handle the input [CommandOutputBinding]
209
- param_type: type of data assigned to the parameter [STRING] corresponding to CWLType
223
+ :param param_id: unique identifier for this parameter.
224
+ :type param_id: STRING
225
+ :param label: short, human-readable label.
226
+ :type label: STRING
227
+ :param secondary_files: If type is a file, describes files that must be
228
+ included alongside the primary file(s).
229
+ :type secondary_files: STRING
230
+ :param param_format: If type is a file, uri to ontology of the format or exact format.
231
+ :type param_format: STRING
232
+ :param streamable: If type is a file, true indicates that the file is read or written
233
+ sequentially without seeking.
234
+ :type streamable: BOOLEAN
235
+ :param doc: documentation.
236
+ :type doc: STRING
237
+ :param output_binding: describes how to handle the output.
238
+ :type output_binding: :class:`cwlgen.CommandOutputBinding` object
239
+ :param param_type: type of data assigned to the parameter corresponding to CWLType.
240
+ :type param_type: STRING
210
241
'''
211
242
Parameter .__init__ (self , param_id , label , secondary_files , param_format , streamable ,\
212
243
doc , param_type )
213
244
self .output_binding = output_binding
214
245
215
246
def get_dict (self ):
216
247
'''
217
- Transform the object to a [DICT] to write CWL
248
+ Transform the object to a [DICT] to write CWL.
218
249
'''
219
250
dict_out = Parameter .get_dict (self )
220
251
if self .output_binding :
@@ -224,19 +255,26 @@ def get_dict(self):
224
255
225
256
class CommandLineBinding (object ):
226
257
'''
227
- Describes how the handle input or argument
258
+ Describes how the handle an input or an argument.
228
259
'''
229
260
230
261
def __init__ (self , load_contents = False , position = None , prefix = None , separate = False ,\
231
262
item_separator = None , value_from = None , shell_quote = False ):
232
263
'''
233
- load_contents: [BOOLEAN]
234
- position: [INT]
235
- prefix: [STRING]
236
- separate: [BOOLEAN]
237
- item_separator: [STRING]
238
- value_from: [STRING]
239
- shell_quote: [BOOLEAN]
264
+ :param load_contents:
265
+ :type load_contents: BOOLEAN
266
+ :param position:
267
+ :type positio: INT
268
+ :param prefix:
269
+ :type prefix: STRING
270
+ :param separate:
271
+ :type separate: BOOLEAN
272
+ :param item_separator:
273
+ :type item_separator: STRING
274
+ :param value_from:
275
+ :type value_from: STRING
276
+ :param shell_quote:
277
+ :type shell_quote: BOOLEAN
240
278
'''
241
279
self .load_contents = load_contents
242
280
self .position = position
@@ -248,7 +286,7 @@ def __init__(self, load_contents=False, position=None, prefix=None, separate=Fal
248
286
249
287
def get_dict (self ):
250
288
'''
251
- Transform the object to a [DICT] to write CWL
289
+ Transform the object to a [DICT] to write CWL.
252
290
'''
253
291
dict_binding = {}
254
292
if self .load_contents :
@@ -271,23 +309,26 @@ def get_dict(self):
271
309
272
310
class CommandOutputBinding (object ):
273
311
'''
274
- Describes how to generate an output parameter based on the files produced
312
+ Describes how to generate an output parameter based on the files produced.
275
313
'''
276
314
277
315
def __init__ (self , glob = False , load_contents = False , output_eval = None ):
278
316
'''
279
- glob: Find corresponding file(s) [STRING]
280
- load_contents: For each file matched, read up to the 1st 64 KiB of text and
281
- place it in the contents field [BOOLEAN]
282
- output_eval: Evaluate an expression to generate the output value [STRING]
317
+ :param glob: Find corresponding file(s).
318
+ :type glob: STRING
319
+ :param load_contents: For each file matched, read up to the 1st 64 KiB of text and
320
+ place it in the contents field.
321
+ :type load_contents: BOOLEAN
322
+ :param output_eval: Evaluate an expression to generate the output value.
323
+ :type output_eval: STRING
283
324
'''
284
325
self .glob = glob
285
326
self .load_contents = load_contents
286
327
self .output_eval = output_eval
287
328
288
329
def get_dict (self ):
289
330
'''
290
- Transform the object to a [DICT] to write CWL
331
+ Transform the object to a [DICT] to write CWL.
291
332
'''
292
333
dict_binding = {}
293
334
if self .glob :
@@ -301,24 +342,26 @@ def get_dict(self):
301
342
302
343
class Requirement (object ):
303
344
'''
304
- Requirement that must be met in order to execute the process
345
+ Requirement that must be met in order to execute the process.
305
346
'''
306
347
307
348
def __init__ (self , req_class ):
308
349
'''
309
- req_class: requirement class [STRING]
350
+ :param req_class: requirement class.
351
+ :type req_class: STRING
310
352
'''
311
353
self .req_class = req_class
312
354
313
355
314
356
class InlineJavascriptReq (Requirement ):
315
357
'''
316
- Workflow platform must support inline Javascript expressions
358
+ Workflow platform must support inline Javascript expressions.
317
359
'''
318
360
319
361
def __init__ (self , expression_lib = None ):
320
362
'''
321
- expression_lib: List of [STRING]
363
+ :param expression_lib: List of Strings
364
+ :type expression_lib: STRING
322
365
'''
323
366
Requirement .__init__ (self , 'InlineJavascriptRequirement' )
324
367
self .expression_lib = expression_lib
@@ -333,12 +376,18 @@ class DockerRequirement(Requirement):
333
376
def __init__ (self , docker_pull = None , docker_load = None , docker_file = None ,\
334
377
docker_import = None , docker_image_id = None , docker_output_dir = None ):
335
378
'''
336
- docker_pull: image to retrive with docker pull [STRING]
337
- docker_load: HTTP URL from which to download Docker image [STRING]
338
- docker_file: supply the contents of a Dockerfile [STRING]
339
- docker_import: HTTP URL to download and gunzip a Docker images [STRING]
340
- docker_image_id: Image id for docker run [STRING]
341
- docker_output_dir: designated output dir inside the Docker container [STRING]
379
+ :param docker_pull: image to retrive with docker pull.
380
+ :type docker_pull: STRING
381
+ :param docker_load: HTTP URL from which to download Docker image.
382
+ :type docker_load: STRING
383
+ :param docker_file: supply the contents of a Dockerfile.
384
+ :type docker_file: STRING
385
+ :param docker_import: HTTP URL to download and gunzip a Docker images.
386
+ :type docker_import: STRING
387
+ :param docker_image_id: Image id for docker run.
388
+ :type docker_image_id: STRING
389
+ :param docker_output_dir: designated output dir inside the Docker container.
390
+ :type docker_output_dir: STRING
342
391
'''
343
392
Requirement .__init__ (self , 'DockerRequirement' )
344
393
self .docker_pull = docker_pull
0 commit comments