RAPPEL : Opération de maintenance > ForgeMIA indisponible le 20 Janvier entre 7h et 12h

jflow_core_workflow.html 45.1 KB
Newer Older
1
2
<!DOCTYPE html>
<html lang="en">
Jerome Mariette's avatar
Jerome Mariette committed
3
4
5
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
6

Jerome Mariette's avatar
Jerome Mariette committed
7
8
9
10
11
12
13
14
15
    <title>Jflow</title>

    <!-- Bootstrap core CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <!-- Bootstrap theme -->
    <link href="css/bootstrap-theme.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="css/theme.css" rel="stylesheet">
16

Philippe Bardou's avatar
Philippe Bardou committed
17
18
19
	<!--  Highlight code -->
	<link href="css/tomorrow-night-eighties.css" rel="stylesheet">

Jerome Mariette's avatar
Jerome Mariette committed
20
21
22
23
24
25
    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
26

Jerome Mariette's avatar
Jerome Mariette committed
27
28
29
30
31
32
33
34
35
36
37
38
  <body role="document">
  
    <!-- Fixed navbar -->
    <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
Jerome Mariette's avatar
Jerome Mariette committed
39
          <a class="navbar-brand" href="./index.html">Jflow</a>
Jerome Mariette's avatar
Jerome Mariette committed
40
41
42
        </div>
        <div class="navbar-collapse collapse">
          <ul class="nav navbar-nav">
Jerome Mariette's avatar
Jerome Mariette committed
43
44
45
            <li><a href="./index.html">About</a></li>
            <li><a href="./jflow_install.html">Install</a></li>
            <li><a href="./jflow_quickstart.html">Quick start</a></li>
Philippe Bardou's avatar
Philippe Bardou committed
46
47
            <li class="dropdown active">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown">Documentation<span class="caret"></span></a>
Jerome Mariette's avatar
Jerome Mariette committed
48
              <ul class="dropdown-menu" role="menu">
Jerome Mariette's avatar
Jerome Mariette committed
49
50
51
52
53
54
                <li class="active"><a href="./jflow_core_workflow.html">Add a workflow</a></li>
                <li><a href="./jflow_core_component.html">Add a component</a></li>
                <li><a href="./jflow_plugin.html">Plugin insertion</a></li>
                <li><a href="./jflow_type.html">Add a data type</a></li>
                <li><a href="./jflow_format.html">Add a file format</a></li>
                <li><a href="./jflow_advanced_configuration.html">Advanced configuration</a></li>
Jerome Mariette's avatar
Jerome Mariette committed
55
56
              </ul>
            </li>
Jerome Mariette's avatar
Jerome Mariette committed
57
			<li><a href="./example1.html">Example</a></li>
Jerome Mariette's avatar
Jerome Mariette committed
58
59
60
61
62
			<li><a href="mailto:support.genopole@toulouse.inra.fr">Contact</a></li>
          </ul>
        </div><!--/.nav-collapse -->
      </div>
    </div>
63

Jerome Mariette's avatar
Jerome Mariette committed
64
    <div class="container">
Philippe Bardou's avatar
Philippe Bardou committed
65
      <div class="row">
Philippe Bardou's avatar
Philippe Bardou committed
66
67
68
        <!--Nav Bar -->
	    <nav class="col-xs-3 bs-docs-sidebar">
	        <ul id="sidebar" class="nav nav-stacked fixed">
Jerome Mariette's avatar
Jerome Mariette committed
69
70
		        <li><a href="#what" class="active">What is a workflow</a></li>
		        <li><a href="#workflow-architecture">Where to add a new workflow</a></li>
71
		        <li><a href="#workflow" >The Workflow class</a></li>
Philippe Bardou's avatar
Philippe Bardou committed
72
73
		       	<li><a href="#define_parameters">Define parameters</a>
			       	<ul class="nav nav-stacked">
74
			       		<li><a href="#parameters">Parameters</a></li>
Jerome Mariette's avatar
Jerome Mariette committed
75
			       		<li><a href="#input_parameters">Inputs</a></li>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
76
			       		<li><a href="#multiple_parameters">Multiple parameters</a></li>
Ibouniyamine Nabihoudine's avatar
Ibouniyamine Nabihoudine committed
77
			       		<li><a href="#exclusion_rules">Exclusion rules</a></li>
Philippe Bardou's avatar
Philippe Bardou committed
78
79
80
	                </ul>
                </li>
				<li><a href="#process">Process</a></li>
Jerome Mariette's avatar
Jerome Mariette committed
81
82
83
84
				<li><a href="#other_methods">Other methods</a>
				  	<ul class="nav nav-stacked">
				        <li><a href="#pre_process">Pre process</a></li>
						<li><a href="#post_process">Post process</a></li>
Jerome Mariette's avatar
Jerome Mariette committed
85
86
87
						<li><a href="#set_to_address">Set to address</a></li>
						<li><a href="#set_subject">Set subject</a></li>
						<li><a href="#set_message">Set message</a></li>
Jerome Mariette's avatar
Jerome Mariette committed
88
						<li><a href="#get_resource">Get resource</a></li>
Jerome Mariette's avatar
Jerome Mariette committed
89
90
					</ul>
				</li>
91
92
93
94
95
96
97
				<li><a href="#your-rules">Custom rules</a>
					<ul class="nav nav-stacked">
						<li><a href="#simple-rules">Simple rules</a></li>
						<li><a href="#link-rules">Link rules</a></li>
                        <li><a href="#conditional-link-rules">Conditional link rules</a></li>
					</ul>
				</li>
Philippe Bardou's avatar
Philippe Bardou committed
98
99
100
	        </ul>
   	    </nav>
   	 
Jerome Mariette's avatar
Jerome Mariette committed
101
        <div class="col-xs-12 col-sm-9">
Jerome Mariette's avatar
Jerome Mariette committed
102
103
104
105
106
107
108
109
        
           	<section id="what" class="group">
		    	<h1 class="page-header">What is a workflow</h1>
	    		<p>A workflow is a collection of <a href="./jflow-core-component.html">components</a>. In jflow, it is represented by a Python class
	    			inerhiting from <code>jflow.workflow.Workflow</code>. It lists all the inputs and parameters that should be requested to 
	    			the final user and build the execution process by adding components and linking them to each others.</p>
	    	</section>
        
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
110
        	<section id="workflow-architecture" class="group">
Philippe Bardou's avatar
Philippe Bardou committed
111
		    	<h1 class="page-header">Where to add a new workflow</h1>
112
113
		    	<p>New wokflow must be added as a new python package in the <code>workflows</code> package. The implementation of
		    	a workflows must be written in the package <code>__init__.py</code> file. The developper can also create: </p>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
114
		    	<ul>
115
116
117
		    		<li>a <code>components</code> package, where all the workflow specific components can be stored,</li>
		    		<li>a <code>lib</code> package to import specific libraries within its workflow,</li>
		    		<li>a <code>bin</code> folder with the binaries used in the workflow.</li>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
118
119
		    	</ul>
		    	
Philippe Bardou's avatar
Philippe Bardou committed
120
		    	<pre class="pre-hl "><code class="ini">jflow/
Philippe Bardou's avatar
Philippe Bardou committed
121
122
123
124
├── bin/
├── docs/
├── src/
├── workflows/
Philippe Bardou's avatar
Philippe Bardou committed
125
126
127
128
129
│   ├── myworkflow/       [ the new workflow package ]
│   │   ├── components/   [ specific components ]
│   │   ├── lib/          [ specific libraries ]
│   │   ├── bin/          [ specific binairies ]
│   │   └── __init__.py   [ the workflow implementation ]
Philippe Bardou's avatar
Philippe Bardou committed
130
131
132
133
134
135
136
│   ├── components/
│   ├── extparsers/
│   ├── __init__.py
│   ├── formats.py
│   └── types.py
├── applications.properties
└── README</code></pre>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
137
138
		    </section>   
     
Philippe Bardou's avatar
Philippe Bardou committed
139
        	<section id="workflow" class="group">
140
141
		    	<h1 class="page-header">The Workflow class</h1>
		    	<p>In jflow, a workflow is a class defined in the <code>__init__.py</code> file. In order to add a new workflow, the developper has to: </p>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
142
		    	
Philippe Bardou's avatar
Philippe Bardou committed
143
		    	<ul>
Jerome Mariette's avatar
Jerome Mariette committed
144
			    	<li>implement a class inheriting from the <code>jflow.workflow.Workflow</code> class,</li>
Ibouniyamine Nabihoudine's avatar
Ibouniyamine Nabihoudine committed
145
					<li>overload the <code>get_description()</code> method to provide to the final user a description of the workflow,</li>
146
147
148
					<li>overload the <code>define_parameters()</code> method to add the workflow inputs and parameters,</li>
					<li>overload the <code>process()</code> method by adding components and setting their arguments,</li>
					<li>link the components inputs and outputs.</li>
Philippe Bardou's avatar
Philippe Bardou committed
149
				</ul>
150
				<p>The class skeleton is given by</p>
Philippe Bardou's avatar
Philippe Bardou committed
151
			    <div>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
152
			    	<pre class="pre-hl "><code class="python">from jflow.workflow import Workflow
Jerome Mariette's avatar
Jerome Mariette committed
153

154
class MyWorkflow (Workflow):
Philippe Bardou's avatar
Philippe Bardou committed
155
156

    def get_description(self):
157
        return "a description"
Philippe Bardou's avatar
Philippe Bardou committed
158
159

    def define_parameters(self, function="process"):
160
        # define the parameters
Philippe Bardou's avatar
Philippe Bardou committed
161
162

    def process(self):
163
        # add and link the components</code></pre>
Philippe Bardou's avatar
Philippe Bardou committed
164
			    </div>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
165
			    
Jerome Mariette's avatar
Jerome Mariette committed
166
167
			</section>

Philippe Bardou's avatar
Philippe Bardou committed
168
			<section id="define_parameters" class="group">
Philippe Bardou's avatar
Philippe Bardou committed
169
		    	<h1 class="page-header">Define parameters</h1>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
170
				<p>
Jerome Mariette's avatar
Jerome Mariette committed
171
					The <code>define_parameters()</code> method is used to add workflow parameters and inputs. To do so, several methods are available. 
Ibouniyamine Nabihoudine's avatar
Ibouniyamine Nabihoudine committed
172
					Once defined, the new parameters are available as object attibuts, thus they are accessible through <code>self.parameter_name</code>.
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
173
				</p>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
174
				<p>
175
					Several types of parameters can be added, all described in the following sections. All have two required positional 
Jerome Mariette's avatar
Jerome Mariette committed
176
177
					arguments: <code>name</code> and <code>help</code>. The other arguments are optional and can be given to the method by using their 
					keywords.
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
178
				</p>
Philippe Bardou's avatar
Philippe Bardou committed
179
180
181
182
				<div class="alert alert-info" role="alert">
					<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
					The operator <code>is</code> is not supported to evaluate a parameter, the operator <code>==</code> must be prefered.
				</div>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
183
				
184
185
				<div id="parameters" class="subgroup">
					<h2>Parameters</h2>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
186
					
Jerome Mariette's avatar
Jerome Mariette committed
187
					<p>Parameters can be added to handle a single element or a list of elements. Thus, the <code>add_parameter()</code> method can be used to force 
Jerome Mariette's avatar
Jerome Mariette committed
188
189
					the final user to provide one and only one value, where the <code>add_parameter_list()</code> method allows the final user to give as many values he 
					wants.</p>
190
191
					
					<h3>add_parameter()</h3>
Jerome Mariette's avatar
Jerome Mariette committed
192
						<h4>Example</h4>
193
						<p>
Jerome Mariette's avatar
Jerome Mariette committed
194
							In the following example, a parameter named <code>sequencer</code> 
195
196
197
							is added to the workflow. It has a list of choices and the default value is "HiSeq2000".
						</p>
				    	<div>
Jerome Mariette's avatar
Jerome Mariette committed
198
199
200
201
				    		<pre class="pre-hl "><code class="python">self.add_parameter("sequencer",
    		   "The sequencer type.", 
    		   choices = ["HiSeq2000", "ILLUMINA","SLX","SOLEXA","454","UNKNOWN"], 
    		   default="HiSeq2000")</code></pre>
202
203
204
				    	</div>
						
						<h4>Options</h4>					
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
205
			    	
Jerome Mariette's avatar
Jerome Mariette committed
206
			    			<p>There are two positional arguments: <code>name</code> and <code>help</code>. All other options are keyword options</p>
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
					    	
							<div class="table-responsive">
								<table class="table table-bordered table-striped">
									<thead>
										<tr>
											<th>Name</th>
											<th>Type</th>
											<th>Required</th>
											<th>Default value</th>
											<th>Description</th>
										</tr>
									</thead>
									<tbody>
										<tr>
											<td>name</td>
Ibouniyamine Nabihoudine's avatar
Ibouniyamine Nabihoudine committed
222
											<td>string</td>
223
224
											<td>true</td>
											<td>None</td>
Jerome Mariette's avatar
Jerome Mariette committed
225
226
											<td>The name of the parameter. The parameter value is accessible 
												within the workflow object through the attribute named <code>self.parameter_name</code>.</td>
227
228
229
230
										</tr>
										
										<tr>
											<td>help</td>
Ibouniyamine Nabihoudine's avatar
Ibouniyamine Nabihoudine committed
231
											<td>string</td>
232
233
											<td>true</td>
											<td>None</td>
Jerome Mariette's avatar
Jerome Mariette committed
234
											<td>The parameter help message.</td>
235
										</tr>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
236
									
237
238
239
240
241
										<tr>
											<td>default</td>
											<td>-</td>
											<td>false</td>
											<td>None</td>
Ibouniyamine Nabihoudine's avatar
Ibouniyamine Nabihoudine committed
242
											<td>The default parameter value. It's type depends on the parameter type.</td>
243
244
245
246
										</tr>
										
										<tr>
											<td>type</td>
Ibouniyamine Nabihoudine's avatar
Ibouniyamine Nabihoudine committed
247
											<td>string</td>
248
249
											<td>false</td>
											<td>"str"</td>
Jerome Mariette's avatar
Jerome Mariette committed
250
251
252
											<td>The parameter type. The value provided by the final user will be casted and checked against this type. 
											All built-in Python types are available "int", "str", "float", "bool", "date", ... To create customized types, 
											refere to the <a href="./jflow-type.html">Add a data type</a> documentation.</td>
253
254
255
256
257
258
										</tr>
										
										<tr>
											<td>choices</td>
											<td>list</td>
											<td>false</td>
Jerome Mariette's avatar
Jerome Mariette committed
259
260
											<td>[]</td>
											<td>A list of the allowed values.</td>
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
										</tr>
										
										<tr>
											<td>required</td>
											<td>boolean</td>
											<td>false</td>
											<td>false</td>
											<td>Wether or not the parameter can be ommitted.</td>
										</tr>
										
										<tr>
											<td>flag</td>
											<td>string</td>
											<td>false</td>
											<td>None</td>
Jerome Mariette's avatar
Jerome Mariette committed
276
											<td>The command line flag (if the value is None, the flag will be <code>--name</code>).</td>
277
278
279
280
281
282
283
										</tr>
										
										<tr>
											<td>group</td>
											<td>string</td>
											<td>false</td>
											<td>"default"</td>
Jerome Mariette's avatar
Jerome Mariette committed
284
											<td>The value is used to group a list of parameters in sections. The group is used in both command line and GUI.</td>
285
286
287
288
289
290
291
										</tr>
										
										<tr>
											<td>display_name</td>
											<td>string</td>
											<td>false</td>
											<td>None</td>
Jerome Mariette's avatar
Jerome Mariette committed
292
											<td>The parameter name that should be displayed on the final form.</td>
293
294
295
296
297
298
299
										</tr>
										
										<tr>
											<td>add_to</td>
											<td>string</td>
											<td>false</td>
											<td>None</td>
Jerome Mariette's avatar
Jerome Mariette committed
300
301
											<td>If this parameter is part of a multiple parameter, <code>add_to</code> allows to define to which "parent" parameter it should be
											linked to.</td>
302
										</tr>
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324

										<tr>
											<td>rules</td>
											<td>string</td>
											<td>false</td>
											<td>None</td>
											<td>Define custom rules on the parameter. Rules are separated by a ";"<br/>
												Available rules:<br/>
												<ul>
													<li><strong>Exclude:</strong> exclude parameters. If one is given, the other must be not given.<br/>
													<em>Syntax: Exclude=param1,param2,...</em></li>
													<li><strong>ExcludeIf:</strong> exclude parameters if condition is raised. If the parameter has one certain value, the other must be not given.<br/>
													<em>Syntax: ExcludeIf?[value1,value2]=param1,param2,...</em> (value1 OR value2)</li>
													<li><strong>ToBeRequired:</strong> require other parameters if parameter is given.<br/>
													<em>Syntax: ToBeRequired=param1,param2,...</em></li>
													<li><strong>ToBeRequiredIf:</strong> require other parameters if parameter is given and has a certain value.<br/>
													<em>Syntax: ToBeRequiredIf?[value1,value2]=param1,param2,...</em> (value1 OR value2)</li>
													<li><strong>ActivateIf:</strong> only if the parameter has a certain value, other parameters should be given.<br/>
													<em>Syntax: ActivateIf?[value1,value2]=param1,param2,...</em> (value1 OR value2)</li>
												</ul>
											</td>
										</tr>
325
326
327
328
		
									</tbody>
								</table>
							</div>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
329
					
330
					<h3>add_parameter_list()</h3>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
331
					
Jerome Mariette's avatar
Jerome Mariette committed
332
333
334
						<p>The <code>add_parameter_list()</code> method takes the same arguments as <code>add_parameter()</code>. However, adding this parameter,
						the final user will be allowed to enter multiple values for this parameter and the object attribut <code>self.parameter_name</code> will be
						settled as a Python list.</p>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
335
					
336
337
338
339
				</div>
				
	       		
	       		<div id="input_parameters" class="subgroup">
Jerome Mariette's avatar
Jerome Mariette committed
340
	       			<h2>Inputs</h2>
341
	       			
Ibouniyamine Nabihoudine's avatar
Ibouniyamine Nabihoudine committed
342
					<p>Just like parameters, inputs can be added to handle a single file or a list of files. Thus, the <code>add__input_file()</code> method can be used to force 
Ibouniyamine Nabihoudine's avatar
Ibouniyamine Nabihoudine committed
343
					the final user to provide one and only one file, where the <code>add__input_file_list()</code> method allows the final user to give as many files as he 
Jerome Mariette's avatar
Jerome Mariette committed
344
345
					wants.</p>
	       			
Jerome Mariette's avatar
Jerome Mariette committed
346
	       				<h3>add_input_file()</h3>
Jerome Mariette's avatar
Jerome Mariette committed
347
348
349
350
351
352
							<h4>Example</h4>
	       				<p>
							In the following example, an input named <code>reads</code> 
							is added to the workflow. The provided file is required and should be in fastq format. No file size limitation is specified. 
						</p>
				    	<div>
Jerome Mariette's avatar
Jerome Mariette committed
353
354
355
356
				    		<pre class="pre-hl "><code class="python">self.add_input_file_list("reads", 
                         "Which read files should be used", 
                         file_format="fastq", 
                         required=True)</code></pre>
Jerome Mariette's avatar
Jerome Mariette committed
357
358
				    	</div>
				    		
359
360
							<h4>Options</h4>
								
Jerome Mariette's avatar
Jerome Mariette committed
361
								<p>There are two positional argument : <code>name</code> and <code>help</code>. All other options are keyword options. </p>
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
                      
								<div class="table-responsive">
									<table class="table table-bordered table-striped">
										<thead>
											<tr>
												<th>Name</th>
												<th>Type</th>
												<th>Required</th>
												<th>Default value</th>
												<th>Description</th>
											</tr>
										</thead>
										<tbody>
											<tr>
												<td>name</td>
Ibouniyamine Nabihoudine's avatar
Ibouniyamine Nabihoudine committed
377
												<td>string</td>
378
379
												<td>true</td>
												<td>None</td>
Jerome Mariette's avatar
Jerome Mariette committed
380
381
												<td>The name of the parameter. The parameter value is accessible 
													within the workflow object through the attribute named <code>self.parameter_name</code>.</td>
382
383
384
385
											</tr>
											
											<tr>
												<td>help</td>
Ibouniyamine Nabihoudine's avatar
Ibouniyamine Nabihoudine committed
386
												<td>string</td>
387
388
												<td>true</td>
												<td>None</td>
Jerome Mariette's avatar
Jerome Mariette committed
389
												<td>The parameter help message.</td>
390
391
392
393
394
395
396
											</tr>
											
											<tr>
												<td>default</td>
												<td>string</td>
												<td>false</td>
												<td>None</td>
Jerome Mariette's avatar
Jerome Mariette committed
397
												<td>The default path value.</td>
398
399
400
401
402
403
404
											</tr>
										
											<tr>
												<td>file_format</td>
												<td>string</td>
												<td>false</td>
												<td>"any"</td>
Jerome Mariette's avatar
Jerome Mariette committed
405
406
												<td>The file format is checked before running the workflow. To create customized format, 
													refere to the <a href="./jflow-format.html">Add a file format</a> documentation.</td>
407
408
409
410
411
412
413
											</tr>
											
											<tr>
												<td>type</td>
												<td>string</td>
												<td>false</td>
												<td>"inputfile"</td>
Jerome Mariette's avatar
Jerome Mariette committed
414
415
416
417
418
419
												<td>The type can be "inputfile", "localfile", "urlfile" or "browsefile". An "inputfile" allows the 
												final user to provide a "localfile" or an "urlfile" or a "browsefile". A "localfile" restricts the final
												user to provide a path to a file visible by jflow. An "urlfile" only permits the final user to give an 
												URL as input, where a "browsefile" force the final user to upload a file from its own computer. This last
												option is only available from the GUI and is considered as a "localfile" from the command line. All the 
												uploading process is handled by jflow.</td>
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
											</tr>
											
											<tr>
												<td>required</td>
												<td>boolean</td>
												<td>false</td>
												<td>false</td>
												<td>Wether or not the parameter can be ommitted.</td>
											</tr>
											
											<tr>
												<td>flag</td>
												<td>string</td>
												<td>false</td>
												<td>None</td>
Jerome Mariette's avatar
Jerome Mariette committed
435
												<td>The command line flag (if the value is None, the flag will be <code>--name</code>).</td>
436
437
438
439
440
441
442
											</tr>
											
											<tr>
												<td>group</td>
												<td>string</td>
												<td>false</td>
												<td>"default"</td>
Jerome Mariette's avatar
Jerome Mariette committed
443
												<td>The value is used to group a list of parameters in sections. The group is used in both command line and GUI.</td>
444
445
446
447
448
449
450
											</tr>
											
											<tr>
												<td>display_name</td>
												<td>string</td>
												<td>false</td>
												<td>None</td>
Jerome Mariette's avatar
Jerome Mariette committed
451
												<td>The parameter name that should be displayed on the final form.</td>
452
453
454
455
456
457
458
											</tr>
											
											<tr>
												<td>add_to</td>
												<td>string</td>
												<td>false</td>
												<td>None</td>
Jerome Mariette's avatar
Jerome Mariette committed
459
460
												<td>If this parameter is part of a multiple parameter, <code>add_to</code> allows to define to which "parent" parameter it should be
												linked to.</td>
461
462
463
464
465
466
467
											</tr>
											
											<tr>
												<td>size_limit</td>
												<td>string</td>
												<td>false</td>
												<td>"0"</td>
Jerome Mariette's avatar
Jerome Mariette committed
468
469
470
												<td>Which maximum file size is allowed. If the value is "0", the file size allowed is unlimited. The given value should
												also provides the file size units between "bytes", "Kb", "Mb", "Gb", "Tb", "Pb", "Eb" and "Zb". A value of 10Mb will 
												restrict the user to upload a file of 10 Mega Bytes.</td>
471
											</tr>
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490

											<tr>
												<td>rules</td>
												<td>string</td>
												<td>false</td>
												<td>None</td>
												<td>Define custom rules on the parameter. Rules are separated by a ";"<br/>
													Available rules:<br/>
													<ul>
														<li><strong>Exclude:</strong> exclude parameters. If one is given, the other must be not given.<br/>
														<em>Syntax: Exclude=param1,param2,...</em></li>
														<li><strong>ToBeRequired:</strong> require other parameters if parameter is given.<br/>
														<em>Syntax: ToBeRequired=param1,param2,...</em></li>
														<li><strong>UniqueAll:</strong> the file given for this parameter must be not given for another one</li>
														<em>Syntax: Unique</em>
														</ul>
												</td>
											</tr>

491
492
493
494
495
										</tbody>
									</table>
								</div>
								
					    <h3>add_input_file_list()</h3>
Jerome Mariette's avatar
Jerome Mariette committed
496
497
498
499
					    
						<p>This method takes the same arguments as <code>add_input_file()</code>. However, adding this parameter,
						the final user will be allowed to provide multiple files and the object attribut <code>self.parameter_name</code> will be
						settled as a Python list.</p>
500
501

						<p>The <code>rules</code> argument has a rule available only on input files list: Unique. If this rule is given, a same file must be unique on the list.</p>
Jerome Mariette's avatar
Jerome Mariette committed
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
						
						<h3>add_input_directory()</h3>
						<p>
							The <code>add_input_directory()</code> method allows the user to select files from a specific directory. This 
							kind of input can be useful for tools outputing not only files but an organized directory.
							The parameter <code>get_files_fn</code> specify the function that will be used to retrieve the files. This method can 
							take as many arguments as required, but the first argument has to be a string representing the folder path.
							By default all files will be selected. From the workflow <code>process()</code> function, the files can be retrieved
							by using the <code>get_files()</code> method.
						</p>
						
						<h4>Example</h4>
	       				<p>
	       					In the following example, the <code>add_input_directory()</code> method is used to parse a directory and retrieve only fasta files
	       					inside this directory. <code>get_files()</code> will browse the directory and get all fasta files.
						</p>
			    		<div>
			    		<pre class="pre-hl "><code class="python">import os
from jflow.Workflow import Workflow

def fasta_files(folder):
    res = []
    for file in os.listdir(folder):
        if file.endswith(".fasta"):
            res.append(file)
    return res

class MyWorkflow(Workflow):
    def define_parameters(self, function="process"):
        self.add_input_directory("fastadir", "Path to folder with fasta files", 
            get_files_fn=fasta_files)

    def process(self):
        # to retrieve the files
        for fastafile in self.fastadir.get_files():
            # do something</code></pre>
				    	</div>
				    		
			    		<h4>Options</h4>
						<p>There are two positional argument : <code>name</code> and <code>help</code>. All other options are keyword options. </p>
						<div class="table-responsive">
							<table class="table table-bordered table-striped">
								<thead>
									<tr>
										<th>Name</th>
										<th>Type</th>
										<th>Required</th>
										<th>Default value</th>
										<th>Description</th>
									</tr>
								</thead>
								<tbody>
									<tr>
										<td>name</td>
										<td>string</td>
										<td>true</td>
										<td>None</td>
										<td>The name of the parameter. The parameter value is accessible 
											within the workflow object through the attribute named <code>self.parameter_name</code>.</td>
									</tr>
									
									<tr>
										<td>help</td>
										<td>string</td>
										<td>true</td>
										<td>None</td>
										<td>The parameter help message.</td>
									</tr>
									
									<tr>
										<td>default</td>
										<td>string</td>
										<td>false</td>
										<td>None</td>
										<td>The default path value.</td>
									</tr>
								
									<tr>
										<td>get_files_fn</td>
										<td>function</td>
										<td>false</td>
										<td>-</td>
										<td>
											get_files_fn will be the method called when executing <code>param.get_files()</code>. All argument from get_files()
											will be used as arguments in get_files_fn
										</td>								
									</tr>
									
									<tr>
										<td>required</td>
										<td>boolean</td>
										<td>false</td>
										<td>false</td>
										<td>Wether or not the parameter can be ommitted.</td>
									</tr>
									
									<tr>
										<td>flag</td>
										<td>string</td>
										<td>false</td>
										<td>None</td>
										<td>The command line flag (if the value is None, the flag will be <code>--name</code>).</td>
									</tr>
									
									<tr>
										<td>group</td>
										<td>string</td>
										<td>false</td>
										<td>"default"</td>
										<td>The value is used to group a list of parameters in sections. The group is used in both command line and GUI.</td>
									</tr>
									
									<tr>
										<td>display_name</td>
										<td>string</td>
										<td>false</td>
										<td>None</td>
										<td>The parameter name that should be displayed on the final form.</td>
									</tr>
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636

								<tr>
									<td>rules</td>
									<td>string</td>
									<td>false</td>
									<td>None</td>
									<td>Define custom rules on the parameter. Rules are separated by a ";"<br/>
										Available rules:<br/>
										<ul>
											<li><strong>Exclude:</strong> exclude parameters. If one is given, the other must be not given.<br/>
											<em>Syntax: Exclude=param1,param2,...</em></li>
											<li><strong>ToBeRequired:</strong> require other parameters if parameter is given.<br/>
											<em>Syntax: ToBeRequired=param1,param2,...</em></li>
										</ul>
									</td>
								</tr>
Jerome Mariette's avatar
Jerome Mariette committed
637
638
639
								</tbody>
							</table>
						</div>
640
641
	       		</div>

Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
642
643
644
645
				
				<div id="multiple_parameters" class="subgroup">
					<h2>Multiple parameters</h2>
					
Jerome Mariette's avatar
Jerome Mariette committed
646
647
648
649
650
651
652
653
654
655
656
657
658
						<p>Jflow offers, to the developper, the possibility to structure the input data by using the notion of multiple parameters. A multi 
						parameter is a collection of parameters linked together. Just like for parameters and inputs, it can be added to handle a single collection or a 
						list of collections. Thus, the <code>add_multiple_parameter()</code> method can be used to force the final user to provide one and only one 
						collection, where the <code>add_multiple_parameter_list()</code> method allows the final user to give as many collection he wants. To add a 
						parameter within the multiple parameter, it only requires to set the option <code>add_to</code> of any methods previously described. 
						The accessible object attribut <code>self.multi_parameter_name</code> is then a Python dictionary gathering all the values of the different 
						parameters under the format <code>{"sub_parameter1":value}</code></p>
						
						<h3>add_multiple_parameter()</h3>
						
						<h4>Example</h4>
						The following example creates a multiple parameter named <code>library</code> which contains two input files <code>R1</code> and <code>R2</code> 
						and a <code>sequencer</code> parameter. </p>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
659
660
661
662
663
664
				    	
				    	<div>
				    		<pre class="pre-hl "><code class="python">self.add_multiple_parameter("library", "Library.", required=True)
self.add_input_file("R1", "Path to R1 file.", required=True, add_to="library")
self.add_input_file("R2", "Path to R2 file.", add_to="library")
self.add_parameter("sequencer", "The sequencer type.", choices=["HiSeq2000", 
Philippe Bardou's avatar
Philippe Bardou committed
665
    "ILLUMINA", "UNKNOWN"], default="HiSeq2000", add_to="library")</code></pre>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
666
				    	</div>
Jerome Mariette's avatar
Jerome Mariette committed
667
668

						<h4>Options</h4>
Ibouniyamine Nabihoudine's avatar
Ibouniyamine Nabihoudine committed
669
						<p>There are two positional arguments : name and help. All other options are keyword options.</p>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
670
								
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
671
672
673
674
675
676
677
678
679
680
681
682
683
684
								<div class="table-responsive">
										<table class="table table-bordered table-striped">
											<thead>
												<tr>
													<th>Name</th>
													<th>Type</th>
													<th>Required</th>
													<th>Default value</th>
													<th>Description</th>
												</tr>
											</thead>
											<tbody>
												<tr>
													<td>name</td>
Ibouniyamine Nabihoudine's avatar
Ibouniyamine Nabihoudine committed
685
													<td>string</td>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
686
687
													<td>true</td>
													<td>None</td>
Jerome Mariette's avatar
Jerome Mariette committed
688
689
690
													<td>The name of the multi parameter. The parameter value is accessible 
														within the workflow object through the attribute named <code>self.multi_parameter_name</code>. And its sub parameters
														using <code>self.multi_parameter_name["sub_parameter_name"]</code>.</td>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
691
692
693
694
												</tr>
												
												<tr>
													<td>help</td>
Ibouniyamine Nabihoudine's avatar
Ibouniyamine Nabihoudine committed
695
													<td>string</td>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
696
697
													<td>true</td>
													<td>None</td>
Jerome Mariette's avatar
Jerome Mariette committed
698
													<td>The parameter help message.</td>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
												</tr>

												<tr>
													<td>required</td>
													<td>boolean</td>
													<td>false</td>
													<td>false</td>
													<td>Wether or not the parameter can be ommitted.</td>
												</tr>
												
												<tr>
													<td>flag</td>
													<td>string</td>
													<td>false</td>
													<td>None</td>
Jerome Mariette's avatar
Jerome Mariette committed
714
715
													<td>The command line flag (if the value is None, the flag will be <code>--name</code>). The sub parameters can be set as following
													<code>--name sub1=... sub2=...</code></td>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
716
717
718
719
720
721
722
												</tr>
												
												<tr>
													<td>group</td>
													<td>string</td>
													<td>false</td>
													<td>"default"</td>
Jerome Mariette's avatar
Jerome Mariette committed
723
													<td>The value is used to group a list of parameters in sections. The group is used in both command line and GUI.</td>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
724
725
726
727
728
729
730
												</tr>
												
												<tr>
													<td>display_name</td>
													<td>string</td>
													<td>false</td>
													<td>None</td>
Jerome Mariette's avatar
Jerome Mariette committed
731
													<td>The parameter name that should be displayed on the final form.</td>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
732
												</tr>
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748

												<tr>
													<td>rules</td>
													<td>string</td>
													<td>false</td>
													<td>None</td>
													<td>Define custom rules on the parameter. Rules are separated by a ";"<br/>
														Available rules:<br/>
														<ul>
															<li><strong>Exclude:</strong> exclude parameters. If one is given, the other must be not given.<br/>
															<em>Syntax: Exclude=param1,param2,...</em></li>
															<li><strong>ToBeRequired:</strong> require other parameters if parameter is given.<br/>
															<em>Syntax: ToBeRequired=param1,param2,...</em></li>
														</ul>
													</td>
												</tr>
Jerome Mariette's avatar
Jerome Mariette committed
749
												
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
750
751
752
753
754
											</tbody>
										</table>
									</div>
						
						<h3>add_multiple_parameter_list()</h3>
Jerome Mariette's avatar
Jerome Mariette committed
755
756
757
						<p>This method takes the same arguments as <code>add_multiple_parameter()</code>. However, adding this parameter,
						the final user will be allowed to provide multiple collection and the object attribut <code>self.multi_parameter_name</code> will be
						settled as a Python list of Python dictionary.</p>
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
758
759
760
						
				</div>

Jerome Mariette's avatar
Jerome Mariette committed
761
			</section>
Philippe Bardou's avatar
Philippe Bardou committed
762
763
			
	  		<section id="process" class="group">
Jerome Mariette's avatar
Jerome Mariette committed
764
		    	<h1 class="page-header">Process</h1>
Ibouniyamine Nabihoudine's avatar
Ibouniyamine Nabihoudine committed
765
		    	<p>The <code>process()</code> method is in charge of building the workflow by adding components (using the method <code>add_component()</code>) and 
Jerome Mariette's avatar
Jerome Mariette committed
766
		    	linking their inputs and their outputs. A component is a class representing a workflow step. See the 
Jerome Mariette's avatar
Jerome Mariette committed
767
		    	<a href="./jflow-core-component.html">component</a> documentation for more information.</p>
Jerome Mariette's avatar
Jerome Mariette committed
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784

   				<h2>add_component()</h2>
   				<p>The <code>add_component()</code> method add a component to the workflow by building a <code>jflow.component.Component</code>
   				object and returning it. All attributs defined within this object, such as the outputs, are then available from the workflow and 
   				can be used as inputs of other components.</p>
   				<h3>Example</h3>
   				<p>In the following example, the first component <code>BWAIndex</code> is built and returned in the <code>bwaindex</code> object.
   				The output <code>bwaindex.databank</code> is accessible as an object attribut and can be used as input of the <code>BWAmem</code>
   				component. This example is extracted from the <a href="./jflow-quickstart.html">Quick start</a>.</p>
					<div>
				    <pre class="pre-hl "><code class="python"># index the reference genome
bwaindex = self.add_component("BWAIndex", [self.reference_genome])
# align reads against the indexed genome
bwamem = self.add_component("BWAmem", [bwaindex.databank, self.reads])</code></pre>
				    	</div>
   				<h3>Options</h3>
   				<p>There is one positional argument : component_name. All other options are keyword options.</p>
Frédéric Escudié's avatar
Frédéric Escudié committed
785
786
787
788
789
790
791
792
793
794
795
796
797
798
   				<div class="table-responsive">
					<table class="table table-bordered table-striped">
						<thead>
							<tr>
								<th>Name</th>
								<th>Type</th>
								<th>Required</th>
								<th>Default value</th>
								<th>Description</th>
							</tr>
						</thead>
						<tbody>
							<tr>
								<td>component_name</td>
Jerome Mariette's avatar
Jerome Mariette committed
799
								<td>string</td>
Frédéric Escudié's avatar
Frédéric Escudié committed
800
								<td>true</td>
Jerome Mariette's avatar
Jerome Mariette committed
801
802
								<td>None</td>
								<td>The component class name to add to the workflow.</td>
Frédéric Escudié's avatar
Frédéric Escudié committed
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
							</tr>
							<tr>
								<td>args</td>
								<td>list</td>
								<td>false</td>
								<td>[]</td>
								<td>The component's arguments (see <a href="./jflow-core-component.html#define_parameters">here</a> for more details).</td>
							</tr>
							<tr>
								<td>kwargs</td>
								<td>dict</td>
								<td>false</td>
								<td>{}</td>
								<td>The component's keyword arguments (see <a href="./jflow-core-component.html#define_parameters">here</a> for more details).</td>
							</tr>
							<tr>
								<td>component_prefix</td>
Jerome Mariette's avatar
Jerome Mariette committed
820
								<td>string</td>
Frédéric Escudié's avatar
Frédéric Escudié committed
821
822
								<td>false</td>
								<td>"default"</td>
Jerome Mariette's avatar
Jerome Mariette committed
823
824
								<td>The prefix is used to name the component at the execution. The prefix allows to add multiple components of the same class within
								the same workflow.</td>
Frédéric Escudié's avatar
Frédéric Escudié committed
825
826
827
							</tr>
						</tbody>
					</table>
Jerome Mariette's avatar
Jerome Mariette committed
828
829
				</div>
			</section>
Philippe Bardou's avatar
Philippe Bardou committed
830
831
			
	  		<section id="other_methods" class="group">
Jerome Mariette's avatar
Jerome Mariette committed
832
		    	<h1 class="page-header">Other methods</h1>
Frédéric Escudié's avatar
Frédéric Escudié committed
833
				<div id="pre_process" class="subgroup">
Jerome Mariette's avatar
Jerome Mariette committed
834
					<h2>Pre process</h2>
Ibouniyamine Nabihoudine's avatar
Ibouniyamine Nabihoudine committed
835
					<p><code>pre_process()</code> is executed before running the <code>process</code> method. Unlike <code>process</code>, this method does not allow
Jerome Mariette's avatar
Jerome Mariette committed
836
837
					to add components, but can be useful when implementing an application requiring to prepare some data before running the workflow (insert / recover
					information from a database, add metadata to the workflow, ...).</p>
Frédéric Escudié's avatar
Frédéric Escudié committed
838
839
				</div>
				<div id="post_process" class="subgroup">
Jerome Mariette's avatar
Jerome Mariette committed
840
841
842
					<h2>Post process</h2>
					<p><code>post_process()</code> is executed right after the <code>process</code> method and cannot be used to add components. This method can
					be useful to perform some database transactions and to synchronize data.</p>
Frédéric Escudié's avatar
Frédéric Escudié committed
843
				</div>
Jerome Mariette's avatar
Jerome Mariette committed
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
				<div id="set_to_address" class="subgroup">
					<h2>Set to address</h2>
					<p><code>set_to_address()</code> overwrite the value <code>to_address</code> defined in the jflow configuration file.</p>
	   				<h3>Options</h3>
	   				<p>There is one required argument : to_address.</p>
	   				<div class="table-responsive">
						<table class="table table-bordered table-striped">
							<thead>
								<tr>
									<th>Name</th>
									<th>Type</th>
									<th>Required</th>
									<th>Default value</th>
									<th>Description</th>
								</tr>
							</thead>
							<tbody>
								<tr>
									<td>to_address</td>
									<td>string</td>
									<td>true</td>
									<td>None</td>
									<td>The email address to use to send an email to the user once the workflow is completed.</td>
								</tr>
							</tbody>
						</table>
					</div>
					
				</div>
				<div id="set_subject" class="subgroup">
					<h2>Set email subject</h2>
					<p><code>set_subject()</code> </code> overwrite the value <code>subject</code> defined in the jflow configuration file.</p>
	   				<h3>Options</h3>
	   				<p>There is one required argument : subject.</p>
	   				<div class="table-responsive">
						<table class="table table-bordered table-striped">
							<thead>
								<tr>
									<th>Name</th>
									<th>Type</th>
									<th>Required</th>
									<th>Default value</th>
									<th>Description</th>
								</tr>
							</thead>
							<tbody>
								<tr>
									<td>subject</td>
									<td>string</td>
									<td>true</td>
									<td>None</td>
895
									<td>The email subject to use for the email sent to the user once the workflow is completed.<br />
896
897
898
									Placeholders can be used to access workflow attributes or unparametred methods: 
									<code>###attribute###</code> or <code>###method()###</code>. For timestamps you can apply 
									date function with the following syntax: <code>###attribute|date###</code> or <code>###method()|date###"</code>.
899
									</td>
Jerome Mariette's avatar
Jerome Mariette committed
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
								</tr>
							</tbody>
						</table>
					</div>
				</div>
				<div id="set_message" class="subgroup">
					<h2>Set email message</h2>
					<p><code>set_message()</code> overwrite the value <code>message</code> defined in the jflow configuration file.</p>
	   				<h3>Options</h3>
	   				<p>There is one required argument : message.</p>
	   				<div class="table-responsive">
						<table class="table table-bordered table-striped">
							<thead>
								<tr>
									<th>Name</th>
									<th>Type</th>
									<th>Required</th>
									<th>Default value</th>
									<th>Description</th>
								</tr>
							</thead>
							<tbody>
								<tr>
									<td>message</td>
									<td>string</td>
									<td>true</td>
									<td>None</td>
927
									<td>The email message to use for the email sent to the user once the workflow is completed.<br />
928
929
930
									Placeholders can be used to access workflow attributes or unparametred methods: 
									<code>###attribute###</code> or <code>###method()###</code>. For timestamps you can apply 
									date function with the following syntax: <code>###attribute|date###</code> or <code>###method()|date###"</code>.
931
									</td>
Jerome Mariette's avatar
Jerome Mariette committed
932
933
934
935
936
								</tr>
							</tbody>
						</table>
					</div>
				</div>
Jerome Mariette's avatar
Jerome Mariette committed
937
938
				<div id="get_resource" class="subgroup">
					<h2>Get shared resources</h2>
939
					<p>The method <code>get_resource()</code>, giving a specific resource, returns the defined value within the <code>resources</code> 
Jerome Mariette's avatar
Jerome Mariette committed
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
					section of the jflow configuration file.</p>
	   				<h3>Options</h3>
	   				<p>There is one required argument : resource.</p>
	   				<div class="table-responsive">
						<table class="table table-bordered table-striped">
							<thead>
								<tr>
									<th>Name</th>
									<th>Type</th>
									<th>Required</th>
									<th>Default value</th>
									<th>Description</th>
								</tr>
							</thead>
							<tbody>
								<tr>
									<td>resource</td>
									<td>string</td>
									<td>true</td>
									<td>None</td>
									<td>The resource name for which is requested the configured value.</td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
Jerome Mariette's avatar
Jerome Mariette committed
966
			</section>
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103

			<section id="your-rules" class="group">
				<h1 class="page-header">Create your own parameter rules</h1>

				<p>You can create your own custom parameter rules. These rules must be declared into the file
					<code>workflows/rules.py</code>. In this file, you define the rule checking protocol. Into the
				parameter definition, the rule is set as a string describing the rule (see below).</p>

				<p>Their are three types of rules : simple rules, link rules and conditional link rules.
				</p>

				<div id="simple-rules" class="subgroup">
					<h2>Simple rules</h2>

					<p>Simple rules are declared as a simple word in the rule definition of the parameter. Example: <code>Unique</code>.
					This name is the name of the class declared below (case-sensitive).</p>
					<p>To create a such rule, create a class that inherit from the SimpleRule class:</p>
					<div>
				    		<pre class="pre-hl "><code class="python">class YourRule (SimpleRule):
	def check():
		# Your code</code></pre>
					</div>
					<p>Into the <code>check()</code> function, write how to check the rule.</p>
					<p>As the rule inherit from SimpleRule class, it has some attributes already defined:</p>
					<table class="table table-bordered table-striped">
						<thead>
							<tr>
								<th>Name</th>
								<th>Type</th>
								<th>Description</th>
							</tr>
						</thead>
						<tbody>
							<tr>
								<td>user_args</td>
								<td>Dict</td>
								<td>Dictionary describing arguments given by the user: name of each parameter as key, associated
								with their own values.</td>
							</tr>
							<tr>
								<td>wf_instance</td>
								<td>Workflow instance</td>
								<td>The workflow instance object.</td>
							</tr>
							<tr>
								<td>parameter_name</td>
								<td>string</td>
								<td>Name of the parameter containing the rule.</td>
							</tr>
							<tr>
								<td>parameter_value</td>
								<td>string</td>
								<td>Value of the parameter containing the rule.</td>
							</tr>
							<tr>
								<td>all_files</td>
								<td>List</td>
								<td>List of all files given by the user, in any parameter.</td>
							</tr>
							<tr>
								<td>wf_parameter</td>
								<td>Parameter instance</td>
								<td>The parameter object containing the rule.</td>
							</tr>
							<tr>
								<td>is_file_list</td>
								<td>boolean</td>
								<td>True if the parameter is an input file list.</td>
							</tr>
							<tr>
								<td>is_a_file</td>
								<td>boolean</td>
								<td>True if the parameter is an input file.</td>
							</tr>
							<tr>
								<td>is_file</td>
								<td>boolean</td>
								<td>True if the parameter is an input file or an input file list.</td>
							</tr>
							<tr>
								<td>is_directory</td>
								<td>boolean</td>
								<td>True if the parameter is an input directory</td>
							</tr>
							<tr>
								<td>is_file_or_directory</td>
								<td>boolean</td>
								<td>True if the parameter is an input file, an input file list or an input directory.</td>
							</tr>
						</tbody>
					</table>

				</div>

				<div id="link-rules" class="subgroup">
					<h2>Link rules</h2>
					<p>Link rules are rules defined on one parameter but having action on other parameters. The string of
					the rule is composed of its name and the targets parameters the rule acts on. Example:
						<code>Exclude=target1,target2</code>. In this example, "Exclude" is the name of the rule declared
						below (case-sensitive).</p>

					<p>To create the rule, create a class that inherit from the LinkRule class:</p>
					<div>
				    		<pre class="pre-hl "><code class="python">class YourRule (LinkRule):
	def check():
		# Your code</code></pre>
					</div>
					<p>Into the <code>check()</code> function, write how to check the rule.</p>
					<p>As the rule inherit from the LinkRule class, it has the same attributes a Simple rule have. But it has
					also additional attributes:</p>
					<table class="table table-bordered table-striped">
						<thead>
							<tr>
								<th>Name</th>
								<th>Type</th>
								<th>Description</th>
							</tr>
						</thead>
						<tbody>
							<tr>
								<td>targets_args</td>
								<td>List</td>
								<td>List of arguments the rules acts on.</td>
							</tr>

						</tbody>
					</table>
				</div>
				<div id="conditional-link-rules" class="subgroup">
                    <h2>Conditional link rules</h2>
                    <p>These rules are like link rules, but are enabled only if the parameter has one of given values.
                    The syntax of the rule string is:
                        <code>&lt;name_of_the_rule&gt;<b>?</b>[&lt;list_of_possible_values&gt;]=&lt;targets&gt;</code>.<br/>
                    Example : <code>ExcludeIf?[value1,value2]=target1,target2</code>.</p>

                    <p>To create the rule, create a class that inherit from the LinkRule class:</p>
                    <div>
Floreal Cabanettes's avatar
Floreal Cabanettes committed
1104
				    		<pre class="pre-hl "><code class="python">class YourRule (ConditionalRule):
1105
1106
1107
1108
	def check():
		# Your code</code></pre>
					</div>
                    <p>Into the <code>check()</code> function, write how to check the rule.</p>
Floreal Cabanettes's avatar
Floreal Cabanettes committed
1109
					<p>As the rule inherit from the ConditionalRule class, it has the same attributes a Link rule have. But it has
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
					also additional attributes:</p>
					<table class="table table-bordered table-striped">
						<thead>
							<tr>
								<th>Name</th>
								<th>Type</th>
								<th>Description</th>
							</tr>
						</thead>
						<tbody>
							<tr>
								<td>conditions</td>
								<td>List</td>
								<td>List of parameter values that enabled the rule.</td>
							</tr>
                            <tr>
                                <td>condition_raised</td>
                                <td>string</td>
                                <td>Value that enables the parameter if any, else None</td>
                            </tr>

						</tbody>
					</table>
                </div>
			</section>
Philippe Bardou's avatar
Philippe Bardou committed
1135
		  </div>
1136
1137
		</div>
		
Jerome Mariette's avatar
Jerome Mariette committed
1138
1139
1140
      <hr>
      <footer>
      	<div class="container" style="text-align: center;">
Philippe Bardou's avatar
Philippe Bardou committed
1141
		  <p>Copyright © 2015, INRA | Designed by <a target="_blank" href="http://bioinfo.genotoul.fr/">GenoToul Bioinfo platform</a> and <a target="_blank" href="http://www.sigenae.org/">Sigenae platform</a>.</p>
Jerome Mariette's avatar
Jerome Mariette committed
1142
1143
1144
		</div>
      </footer>
	
1145
	</div>
Jerome Mariette's avatar
Jerome Mariette committed
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
	
    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <!-- <script src="../../assets/js/docs.min.js"></script> -->
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <!-- <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> -->
	
Philippe Bardou's avatar
Philippe Bardou committed
1156
1157
1158
1159
	<!--  Highlight code -->
	<script src="js/highlight.pack.js"></script>
	<script>hljs.initHighlightingOnLoad();</script>
	
Ibouniyamine Nabihoudine's avatar
wf doc    
Ibouniyamine Nabihoudine committed
1160
	<script type='text/javascript'>
Philippe Bardou's avatar
Philippe Bardou committed
1161
1162
1163
1164
1165
		$('body').scrollspy({
    		target: '.bs-docs-sidebar',
    		offset: 150
		});
	</script>
1166
1167
</body>
</html>