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

Commit d0e9b398 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Udate doc

parent c2eb843d
......@@ -92,7 +92,8 @@
<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>
<li><a href="#conditional-rules">Conditional rules</a></li>
<li><a href="#raise-error-warning">Raise an error or a warning in a rule</a></li>
</ul>
</li>
</ul>
......@@ -311,14 +312,14 @@ class MyWorkflow (Workflow):
<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>
<li><strong>RequiredIf:</strong> parameter is required only if other parameters have (or have not) some values.<br/>
<em>Syntax: RequiredIf?(ANY|ALL)[param_1=value1,param_2!=value2,...] (all conditions or any condition)</em><br/>
Special values: * for any value of the parameter (not empty), None for not given (or empty)<br/>
Example: RequiredIf?ANY[adapter_1!="AATGC",adapter_2=*,gtf_file=None]</li>
<li><strong>ActivateIf:</strong> parameter is enabled only if other parameters have some values.<br/>
<em>Syntax (like RequiredIf rule):<br/></br:>ActivateIf?(ANY|ALL)[param_1=value1,param_2=value2,...]</em> (all conditions or any condition)</li>
</ul>
</td>
</tr>
......@@ -482,6 +483,12 @@ class MyWorkflow (Workflow):
<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>RequiredIf:</strong> parameter is required only if other parameters have (or have not) some values.<br/>
<em>Syntax: RequiredIf?(ANY|ALL)[param_1=value1,param_2!=value2,...] (all conditions or any condition)</em><br/>
Special values: * for any value of the parameter (not empty), None for not given (or empty)<br/>
Example: RequiredIf?ANY[adapter_1!="AATGC",adapter_2=*,gtf_file=None]</li>
<li><strong>ActivateIf:</strong> parameter is enabled only if other parameters have some values.<br/>
<em>Syntax (like RequiredIf rule):<br/></br:>ActivateIf?(ANY|ALL)[param_1=value1,param_2=value2,...]</em> (all conditions or any condition)</li>
<li><strong>UniqueAll:</strong> the file given for this parameter must be not given for another one</li>
<em>Syntax: Unique</em>
</ul>
......@@ -631,6 +638,12 @@ class MyWorkflow(Workflow):
<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>RequiredIf:</strong> parameter is required only if other parameters have (or have not) some values.<br/>
<em>Syntax: RequiredIf?(ANY|ALL)[param_1=value1,param_2!=value2,...] (all conditions or any condition)</em><br/>
Special values: * for any value of the parameter (not empty), None for not given (or empty)<br/>
Example: RequiredIf?ANY[adapter_1!="AATGC",adapter_2=*,gtf_file=None]</li>
<li><strong>ActivateIf:</strong> parameter is enabled only if other parameters have some values.<br/>
<em>Syntax (like RequiredIf rule):<br/></br:>ActivateIf?(ANY|ALL)[param_1=value1,param_2=value2,...]</em> (all conditions or any condition)</li>
</ul>
</td>
</tr>
......@@ -1053,6 +1066,13 @@ bwamem = self.add_component("BWAmem", [bwaindex.databank, self.reads])</code></p
<td>boolean</td>
<td>True if the parameter is an input file, an input file list or an input directory.</td>
</tr>
<tr>
<td>nb_rows</td>
<td>Dict</td>
<td>Number of rows for each MultipleParameterList. Example: {sample:3, data:2}, where
sample and data are the name of tow MultipleParameterList.
</td>
</tr>
</tbody>
</table>
......@@ -1092,21 +1112,35 @@ bwamem = self.add_component("BWAmem", [bwaindex.databank, self.reads])</code></p
</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.
<div id="conditional-rules" class="subgroup">
<h2>Conditional rules</h2>
<p>These rules are like simple 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>
<code>&lt;name_of_the_rule&gt;<b>?</b>(ALL|ANY)[&lt;conditions&gt;]</code>.<br/>
Example : <code>RequiredIf?ALL[param1=value1,param2!=value2]</code>.</p>
<p>To create the rule, create a class that inherit from the LinkRule class:</p>
<p>ALL or ANY: if ALL is set, all conditions must be raised to activate the rule. If ANY is set, the
condition is raised if at least one condition is raised.</p>
<p>Conditions are written with this structure : &lt;parameter_name&gt;=&lt;parameter_value&gt;
(if parameter must be equal to value) or &lt;parameter_name&gt;!=&lt;parameter_value&gt;
(if parameter must be not equal to value. The parameter name is the name of a workflow
parameter. If the parameter is the one into the rule is defined, we can use the keyword
<em>self</em> instead of its name.<br/>Special values:
<ul>
<li>parameter_name=*: condition is raised if the parameter is given, regardless of its value</li>
<lI>parameter_name=None: condition is raised if the parameter is not given</lI>
</ul>
</p>
<p>To create the rule, create a class that inherit from the Conditional class:</p>
<div>
<pre class="pre-hl "><code class="python">class YourRule (ConditionalRule):
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 ConditionalRule class, it has the same attributes a Link rule have. But it has
<p>As the rule inherit from the SimpleRule 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>
......@@ -1131,6 +1165,14 @@ bwamem = self.add_component("BWAmem", [bwaindex.databank, self.reads])</code></p
</tbody>
</table>
</div>
<div id="raise-error-warning" class="subgroup">
<h2>Raise an error or a warning in a rule</h2>
<p>Into the <code>check()</code> function of your rule, when the rule generate an error, use the
function <code>self.error()</code>.<br/>
Example: <code>self.error("Parameter " + self.parameter_name + " was not correct")</code>.</p>
<p>If the rule generate a warning, use the function <code>self.warning()</code> instead.<br/>
Example: <code>self.warning("Parameter " + self.parameter_name + " will be ignored")</code></p>
</div>
</section>
</div>
</div>
......
......@@ -118,6 +118,9 @@ class ConditionalRule(SimpleRule):
class Exclude(LinkRule):
"""
If the parameter is given, the target parameters are disabled, and vice-versa
"""
def check(self):
for exclude in self.targets_args:
......@@ -126,6 +129,9 @@ class Exclude(LinkRule):
class ToBeRequired(LinkRule):
"""
If the parameter is given, the target parameters becomes required
"""
def check(self):
for require in self.targets_args:
......@@ -136,6 +142,9 @@ class ToBeRequired(LinkRule):
class RequiredIf(ConditionalRule):
"""
The parameter is required only if other parameters have, or have not, some values
"""
def check(self):
if self.condition_raised:
......@@ -144,6 +153,9 @@ class RequiredIf(ConditionalRule):
class ActivateIf(ConditionalRule):
"""
The parameter is enabled only if other parameters have, or have not, some values
"""
def check(self):
if not self.condition_raised and self.parameter_name in self.user_args and \
......
......@@ -21,6 +21,9 @@ from jflow.rules import SimpleRule, LinkRule, ConditionalRule
class Unique(SimpleRule):
"""
The file given in a file list parameter must be given only one time in the list
"""
def check(self):
if self.is_file_list:
......@@ -32,6 +35,10 @@ class Unique(SimpleRule):
class UniqueAll(SimpleRule):
"""
The file given for one parameter must be given only one time for it and for all files given in any parameter of the
workflow
"""
def check(self):
if self.is_file:
......@@ -46,6 +53,10 @@ class UniqueAll(SimpleRule):
class FullOrEmpty(SimpleRule):
"""
Into a MultipleParameterList, add this rule to a sub-parameter to require the parameter is given for each row,
or for None rows.
"""
def check(self):
if self.parameter_name.index(">") > -1:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment