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

Commit 765e700b authored by Jerome Mariette's avatar Jerome Mariette
Browse files

component parameters ok

parent 3aa7a42c
......@@ -74,8 +74,8 @@
<li><a href="#define_parameters">Define parameters</a>
<ul class="nav nav-stacked">
<li><a href="#parameters">Parameters</a></li>
<li><a href="#input_parameters">Input parameters</a></li>
<li><a href="#output_parameters">Output parameters</a></li>
<li><a href="#input_parameters">Inputs</a></li>
<li><a href="#output_parameters">Outputs</a></li>
</ul>
</li>
<li><a href="#external_components" >External components</a>
......@@ -166,41 +166,33 @@ class MyComponent (Component):
<h1 class="page-header">Define parameters</h1>
<p>
The <code>define_parameters()</code> function is used to add component parameters, inputs and outputs. Several methods are available to add different
types of parameters. The added parameter will be available as an object attibut, thus be accessible using <code>self.param_name</code>.
Each function defines how the parameter will be described in the command line and in the interface.
The <code>define_parameters()</code> method can take as many options (positional or keyword) as needed.
The <code>define_parameters()</code> method is used to add component parameters, inputs and outputs. To do so, several methods are available.
Once defined, the new parameters are available as object attibuts, thus they are accessible through <code>self.parameter_name</code>.
</p>
<div>
<pre class="pre-hl "><code class="python">def define_parameters(self, input_files, reference_genome):
self.add_input_file("reference_genome", "the reference file",
file_format="fasta", default=reference_genome, required=True)
self.add_input_file_list("input_files", "fastq files", default=input_files,
file_format="fastq", required=True)
self.add_output_file_list("sais", "sai files",
pattern="{basename_woext}.sai", items=self.input_files)</code></pre>
</div>
<li><a href="#parameters">Parameters</a></li>
<p>
Several types of parameters can be added, all described in the following sections. All have two required positional
arguments: <code>name</code> and <code>help</code>. The other arguments are optional and can be given to the method by using their
keywords.
</p>
<div id="parameters" class="subgroup">
<h2>Parameters</h2>
<h3>add_parameter() method</h3>
<p>
This method is the basic one used to add parameters. In the next example, a parameter named <code>sequencer</code>
is added to the component. It has a list of choices and the default value is set as one of the options of
<code>define_parameters()</code>.
</p>
<div>
<pre class="pre-hl "><code class="python">def define_parameters(self, sequencer_name):
self.add_parameter("sequencer",
"The sequencer type.",
choices = ["HiSeq2000", "ILLUMINA","SLX","SOLEXA","454","UNKNOWN"],
default=sequencer_name)</code></pre>
</div>
<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
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>
<h3>add_parameter()</h3>
<h4>Example</h4>
<p>
In the following example, a parameter named <code>sequencer</code>
is added to the workflow. It has a list of choices and the default value is "HiSeq2000".
</p>
<div>
<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>
</div>
<h4>Options</h4>
......@@ -223,8 +215,8 @@ self.add_output_file_list("sais", "sai files",
<td>string</td>
<td>true</td>
<td>None</td>
<td>The name of the parameter. The parameter will then be available
in the workflow as <code>self.parameter_name</code>.</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>
......@@ -232,7 +224,7 @@ self.add_output_file_list("sais", "sai files",
<td>string</td>
<td>true</td>
<td>None</td>
<td>The help message prompted to the user.</td>
<td>The parameter help message.</td>
</tr>
<tr>
......@@ -240,24 +232,25 @@ self.add_output_file_list("sais", "sai files",
<td>-</td>
<td>false</td>
<td>None</td>
<td>This is the default value of our parameter.</td>
<td>The default parameter value. It's type depends on the parameter type.</td>
</tr>
<tr>
<td>type</td>
<td> * </td>
<td>string</td>
<td>false</td>
<td>"str"</td>
<td> The type to which our argument will be converted. All default python types are available (int, str, float, bool). User can define new
types in <em>types.py</em> file.</td>
<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>
</tr>
<tr>
<td>choices</td>
<td>list</td>
<td>false</td>
<td>false</td>
<td>A container of the allowable values for the argument.</td>
<td>[]</td>
<td>A list of the allowed values.</td>
</tr>
<tr>
......@@ -273,7 +266,7 @@ self.add_output_file_list("sais", "sai files",
<td>string</td>
<td>false</td>
<td>None</td>
<td>The parameter command line flag (default is <em>"--name"</em>).</td>
<td>The command line flag (if the value is None, the flag will be <code>--name</code>).</td>
</tr>
<tr>
......@@ -281,7 +274,7 @@ self.add_output_file_list("sais", "sai files",
<td>string</td>
<td>false</td>
<td>"default"</td>
<td>This is used to regroup a list of parameters in the command line and the GUI.</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>
......@@ -289,7 +282,16 @@ self.add_output_file_list("sais", "sai files",
<td>string</td>
<td>false</td>
<td>None</td>
<td>The display name of the parameter.</td>
<td>The parameter name that should be displayed on the final form.</td>
</tr>
<tr>
<td>add_to</td>
<td>string</td>
<td>false</td>
<td>None</td>
<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>
</tr>
<tr>
......@@ -297,7 +299,7 @@ self.add_output_file_list("sais", "sai files",
<td>string</td>
<td>false</td>
<td>""</td>
<td>The command format is the flag used in the command line for our parameter.</td>
<td>The command format is the parameter skeleton required to build the final command line.</td>
</tr>
<tr>
......@@ -305,19 +307,21 @@ self.add_output_file_list("sais", "sai files",
<td>integer</td>
<td>false</td>
<td>-1</td>
<td>The position of the parameter in the command line.</td>
<td>The parameter position in the command line.</td>
</tr>
</tbody>
</table>
</div>
<h3>add_parameter_list()</h3>
<p>This method description and options are the same as <code>add_parameter()</code>. See the previous
method for a description of available options.</p>
<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>
</div>
<div id="input_parameters" class="subgroup">
<h2>Input parameters</h2>
<h2>Inputs</h2>
<h3>add_input_file() method</h3>
<p>To add an input file to the component, use the <code>add_input_file()</code> method. Like <code>add_parameter()</code> it adds a single parameter
......@@ -441,7 +445,7 @@ self.add_output_file_list("sais", "sai files",
<div id="output_parameters" class="subgroup">
<h2>Output parameters</h2>
<h2>Outputs</h2>
<h3>add_out_file() method</h3>
<p>To add an output file, use the <code>add_input_file()</code> method. Like <code>add_parameter()</code> it adds a single parameter
......
......@@ -188,7 +188,7 @@ class MyWorkflow (Workflow):
<h4>Options</h4>
<p>There are two positional argument : name and help. All other options are keyword options.</p>
<p>There are two positional arguments: <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">
......
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