Commit 73abde0f authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

add information about the way of writing workflow

parent 11a919a4
# Snakemake workflows
This directory contains every workflows built from Snakemake tool found in the `tools` directory of the repository.
## Design and best practices
All the Snakemake workflows try to respect some rules and best practices in their design.
Therefore, workflows have the following parts:
1. reference to `config.yaml` file
2. reference to tool rules
3. set up of common variable for the workflow
4. set up of specific variables for the tools
5. `rule all` to specify what is/are the specific file(s) expected from the workflow.
#### Reference to tool rules
The location of the tools included in the workflow can vary depending your organization.
Therefore, we decide to put every references at the begining of the workflow to make it easy
to customize and change if necessary.
#### Set up common variable for the workflow
Then every common variables are set up. This can be handy for reference to a common directory.
#### Set up specific variables for the tools
Every specific variables for every tools are then specified. For more details about the way
every tool is describe, you can refer to the `README` of the `tools` directory of the
repository.
In brief, every tool has its input and output refered as a variable: `__TOOLNAME_variable`.
Therefore every variable needs to be configured and we recommand using reference to a `config.yaml` file.
Thus, we can easily set up the input of a tool `B` as being the output of `A`:
```python
# ---- Tool A
__toola_input = config.get('input')
__toola_output = "file.a"
# ---- Tool B
__toolb_input = __toola_output
__toolb_ouput = config.get('output')
```
## Usage
### Using on TARS
For the following examples, we consider that we want to run every job a dedicated queue called `atm`.
First need a virtual environment with snakemake:
```bash
module load Python/3.6.0 # Install seems to fail with latest version of Python
python3 -m venv .snakemake_venv
source .snakemake_venv/bin/activate
(.snakemake_venv)$ pip install snakemake
```
Then, to run a `SnakeFile` on Tars we use a command similar to the following:
```bash
sbatch --qos=atm -p atm -c 1 snakemake -p -j 6 --cluster-config cluster.yml --cluster "sbatch --qos={cluster.queue} -p {cluster.queue} -c {threads}"
```
\ No newline at end of file
__default__:
queue: atm
\ No newline at end of file
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