# Cheat Sheet

The `ruffus` module is a lightweight way to add support for running computational pipelines.

Each stage or task in a computational pipeline is represented by a python function
Each python function can be called in parallel to run multiple jobs.

## 1. Annotate functions with Ruffus decorators

### Core

Decorator | Syntax |
--- | --- | ---
@originate (Manual) | @originate ( `output_files`, [`extra_parameters`,…] ) |
@split (Manual) | @split ( `tasks_or_file_names`, `output_files`, [`extra_parameters`,…] ) |
@transform (Manual) | @transform ( `tasks_or_file_names`, suffix(`suffix_string`), `output_pattern`, [`extra_parameters`,…] ) @transform ( `tasks_or_file_names`, regex(`regex_pattern`), `output_pattern`, [`extra_parameters`,…] ) |
@merge (Manual) | @merge (`tasks_or_file_names`, `output`, [`extra_parameters`,…] ) |
@posttask (Manual) | @posttask ( `signal_task_completion_function` ) @posttask (touch_file( `'task1.completed'` )) |

### See Decorators for a complete list of decorators

## 2. Print dependency graph if necessary

- For a graphical flowchart in `jpg`, `svg`, `dot`, `png`, `ps`, `gif` formats:

      pipeline_printout_graph ( "flowchart.svg")

- For a text printout of all jobs

      pipeline_printout()

## 3. Run the pipeline

    pipeline_run(multiprocess = N_PARALLEL_JOBS)