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

Commit 9c579ed7 authored by Ibouniyamine Nabihoudine's avatar Ibouniyamine Nabihoudine
Browse files

wf doc

parent a87a7a4f
......@@ -67,8 +67,8 @@
<!--Nav Bar -->
<nav class="col-xs-3 bs-docs-sidebar">
<ul id="sidebar" class="nav nav-stacked fixed">
<li><a href="#where">Where adding a new workflow</a></li>
<li><a href="#workflow" class="active">Adding workflow</a></li>
<li><a href="#workflow-architecture" class="active">Where to add the new workflow</a></li>
<li><a href="#workflow" class="active">Workflow definition</a></li>
<li><a href="#define_parameters">Define parameters</a>
<ul class="nav nav-stacked">
<li><a href="#add_parameter">Add parameter</a></li>
......@@ -92,31 +92,44 @@
</nav>
<div class="col-xs-12 col-sm-9">
<section id="where" class="group">
<section id="workflow-architecture" class="group">
<div class="page-header">
<h1>Where adding a new workflow</h1>
</div>
<p>Create a directory (named by the desired workflow name) in the <code>workflows/</code> directory.</p>
<pre class="pre-hl"><code class="python">jflow/
<h1>Where to add the new workflow</h1>
</div>
<p>The new wokflow must be added as a new python package in the <code>workflows</code> package. The definition of
the workflows must be written in <code><a href="#workflow">__init__.py</a></code>.</p>
<p>User can optionaly add : </p>
<ul>
<li><code><a href="./jflow-core-component.html">components</a></code> package to define specific components to this new workflow.</li>
<li><code>lib</code> package to define specific libraries.</li>
<li><code>bin</code>, a folder with binaries used in the workflow.</li>
</ul>
<pre class="pre-hl "><code class="text">jflow/
├── bin/
├── docs/
├── src/
├── workflows/
│ ├── myWorkflowName/ ** workflow package to add **
│ │ ├── components/ ** workflow specific components **
│ │ ├── lib/ ** workflow specific libraries **
│ │ ├── bin/ ** workflow specific binairies **
│ │ └── __init__.py ** the workflow code **
│ ├── components/
│ ├── extparsers/
│ ├── myWorkflowName ** create a directory name by the desired workflow namew **
│ │ └── __init__.py ** add your code in the __init__.py file (see below) **
│ ├── __init__.py
│ ├── formats.py
│ └── types.py
├── applications.properties
└── README</code></pre>
</section>
</section>
<section id="workflow" class="group">
<div class="page-header">
<h1>The <i>Workflow</i> class</h1>
<h1>The <i>Workflow</i> definition</h1>
</div>
In order to add workflow you need to:
<p>The new workflow is a class defined in <code>__init__.py</code>. In order to add workflow you must: </p>
<ul>
<li>Inherit from the <code>Workflow</code> class</li>
<li>Implement the <code>get_description()</code> function to define the workflow description</li>
......@@ -125,7 +138,7 @@
<li>Link components inputs and outputs (typing test is done)</li>
</ul>
<div>
<pre class="pre-hl "><code class="python">from jflow.workflow import Workflow
<pre class="pre-hl "><code class="python">from jflow.workflow import Workflow
from jflow.parameter import InputFileList, InputFile
class Alignment (Workflow):
......@@ -151,13 +164,146 @@ class Alignment (Workflow):
bwa = self.add_component("BWA", [bwaindex.databank, self.read_1, self.read_2])
</code></pre>
</div>
<p>The <code>get_name()</code> method can be overwritted to change de command name of the workflows. By default
the workflows will be called as the class name in lower case.</p>
</section>
<section id="define_parameters" class="group">
<div class="page-header">
<h1>Define parameters</h1>
</div>
<div id="add_parameter" class="subgroup"><h2>Add parameter</h2></div>
<p>
The define parameters function is used to add workflow 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 hows the parameter will be described in the command line and in the interface.
</p>
<div id="add_parameter" class="subgroup">
<h2>The add_parameter() method</h2>
<p>This method is the basic method used to add a parameter to our workflow.</p>
<p>Here, 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">def define_parameters(self, function="process"):
self.add_parameter("sequencer",
"The sequencer type.",
choices = ["HiSeq2000", "ILLUMINA","SLX","SOLEXA","454","UNKNOWN"],
default="HiSeq2000")
</code></pre>
</div>
<h3>Options</h3>
<p>List of options that can be added to <code>add_parameter()</code></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>str</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>
</tr>
<tr>
<td>help</td>
<td>str</td>
<td>true</td>
<td>None</td>
<td>The help message pronpted to the user.</td>
</tr>
<tr>
<td>default</td>
<td>-</td>
<td>false</td>
<td>None</td>
<td>This is the default value of our parameter.</td>
</tr>
<tr>
<td>type</td>
<td>-</td>
<td>false</td>
<td>types.StringType</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>
</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>
</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></td>
<td>The parameter command line flag (default is <em>"--name"</em>)</td>
</tr>
<tr>
<td>group</td>
<td>string</td>
<td>false</td>
<td>"default"</td>
<td></td>
</tr>
<tr>
<td>display_name</td>
<td>string</td>
<td>false</td>
<td></td>
<td>The display name of the parameter</td>
</tr>
<tr>
<td>cmd_format</td>
<td>string</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>argpos</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="add_parameter_list" class="subgroup"><h2>Add parameter list</h2></div>
<div id="add_input_directory" class="subgroup"><h2>Add input directory</h2></div>
<div id="add_input_file" class="subgroup"><h2>Add input file</h2></div>
......@@ -206,7 +352,7 @@ class Alignment (Workflow):
<script>hljs.initHighlightingOnLoad();</script>
<script src="js/offcanvas.js"></script>
<script type='text/javascript'>
<script type='text/javascript'>
$('body').scrollspy({
target: '.bs-docs-sidebar',
offset: 150
......
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