Commit 4147a001 authored by Jerome Mariette's avatar Jerome Mariette
Browse files

workflow doc ok

parent 5d4dbfeb
......@@ -581,25 +581,27 @@ self.add_exclution_rule("fasta_file", "fastq")</code></pre>
<section id="process" class="group">
<h1 class="page-header">Overloading <i>process</i></h1>
<p>The <code>process()</code> method defines the actions done by the workflow.</p>
<p>In process you can add components with the method <code>add_component()</code>.
A component is class which represents a step in the workflow defined by a set of commands.
The components sequence and their parallelisation are managed by the input and output linkage between components.</p>
<pre class="pre-hl "><code class="python">def process(self):
Run the workflow
indexed_ref = self.reference_genome
if not os.path.exists( self.reference_genome + ".bwt" ): # reference is not indexed
# index the reference genome
bwaindex = self.add_component("BWAIndex", [self.reference_genome])
indexed_ref = bwaindex.databank
# align reads against indexed genome
bwa = self.add_component("BWA", [indexed_ref, self.read_1, self.read_2])</code></pre>
<h2>The add_component() method</h2>
<p>This method is used to add a component to the workflow.</p>
<h1 class="page-header">Process</h1>
<p>The <code>process()</code> method is in charge to build the workflow by adding components (using the method <code>add_component()</code>) and
linking their inputs and their outputs. A component is a class representing a workflow step. See the
<a href="./jflow-core-component.html">Add a component</a> documentation for more information.</p>
<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>
<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>
<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>
<p>There is one positional argument : component_name. All other options are keyword options.</p>
<div class="table-responsive">
<table class="table table-bordered table-striped">
......@@ -614,10 +616,10 @@ self.add_exclution_rule("fasta_file", "fastq")</code></pre>
<td> - </td>
<td>The class name of the component used.</td>
<td>The component class name to add to the workflow.</td>
......@@ -635,10 +637,11 @@ self.add_exclution_rule("fasta_file", "fastq")</code></pre>
<td>This prefix is used with the component name as a unique identifiant. This is necessary when you use the same component several time in the workflow.</td>
<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>
......@@ -646,14 +649,17 @@ self.add_exclution_rule("fasta_file", "fastq")</code></pre>
<section id="other_methods" class="group">
<h1 class="page-header">Other available methods</h1>
<h1 class="page-header">Other methods</h1>
<div id="pre_process" class="subgroup">
<h2>Overloading <i>pre process</i></h2>
<p>This method is executed brefore process and cannot be used to add components.</p>
<h2>Pre process</h2>
<p><code>pre_process()</code> is executed before to run the <code>process</code> method. Unlike <code>process</code>, this method does not allow
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>
<div id="post_process" class="subgroup">
<h2>Overloading <i>post process</i></h2>
<p>This method is executed after process and cannot be used to add components.</p>
<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>
Supports Markdown
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