2.2. Hello world!¶
In this chapter, we show how to create and use RNFtools on a Hello world example. Little knowledge of Python can be helpful, but it is not required.
RNFtools is based on Snakemake, a Python-based Make-like build system. To
simulate reads or evaluate alignments, you create simple configuration Python
scripts and RNFtools subsequently creates a set of rules to be run by
Snakemake. The rules can be then executed in a single thread, in parallel
--cores Snakemake parameter), or on a cluster. For more details about
Snakemake, please see its documentation.
This approach allows to create big and reproducible pipelines, which are easy to share (it suffices to publish a single configuration script).
Every RNFtools script consists of three parts:
1 2 3 4 5 6 7 8 9 10
# 1) importing the rnftools Python package import rnftools # 2) all your Python code will go here print("Hello world!") # 3) including Snakemake rules created by RNFtools and defining the main # Snakemake rule (declaring which files are requested) include: rnftools.include() rule: input: rnftools.input()
As it is mentioned in the second comment, all your code should be inserted into
part 2. Now save this file with name
Snakefile and run
in the same directory. A “Hello world” message will be printed, together with several Snakemake informative messages.