Snakefile (Python-like syntax)SnakefileSnakefile defines rules for creating filesoutput: the files the rule createsshell: the shell command that creates the filesinput: the files the rule depends onAssume we wrote the script summarize_genome.py that accepts a FASTA file as input and creates a summary file as output.
rule summarize_genome:
input:
"data/genome.fasta"
output:
"results/genome_summary.txt"
shell:
"python scripts/summarize_genome.py {input} {output}"
rule summarize_genome:
input:
"data/genome.fasta"
output:
"results/genome_summary.txt"
shell:
"python scripts/summarize_genome.py {input} {output}"
The input and output values are inserted into the command and executed:
python scripts/summarize_genome.py data/genome.fasta \
results/genome_summary.txt
all ruleall that defines the files that
should be created by the workflowall rule should come first, and only have input specifiedrule all:
input:
"results/genome_summary.txt"
rule summarize_genome:
# rule definition from previous
$ ls
data scripts Snakefile
$ snakemake -j 1