Commit b313a777 authored by Cedric Laczny's avatar Cedric Laczny

Add example on how to use a config file.

parent f2940f0a
# Load your config
configfile: "config.yaml"
NAMES = config["names"]
# at the top of the file
import os
import glob
print("These are the names: ")
print(NAMES)
rule all:
input: "list_of_generated_output.txt"
rule generate_some_input:
output: "{your_pattern}_in.txt"
shell:
"""
echo "{wildcards.your_pattern}" > {output}
"""
rule generate_some_output:
input:
first="{pattern}_first_in.txt",
second="{pattern}_second_in.txt",
output: "{pattern}_out.txt"
message: "GENERATE PATTERNED {output} - Pattern: {wildcards.pattern}"
shell:
"""
cat {input.first} {input.second} > {output}
"""
# The `str(output)` is necessary as `open()` expectes a `string` type and not an `OutputFiles` type
rule list_generated_output:
input: expand("{NAME}_out.txt", NAME=NAMES)
output: "list_of_generated_output.txt"
threads: 4
shell:
"""
echo {config[heading]} > {output}
find ./ -name "*_out.txt" -print0 | xargs -0 -P {threads} -I{{}} cat {{}} >> {output}
"""
......@@ -114,8 +114,13 @@ snakemake -j 2 -s 07-threads.smk -p # Files can be listed *out*-of-order
## Cluster-scale parallelization
Demo using MUST/LeGeLiS sample
# Using a configuration file
```
snakemake -s 08-config_file.smk
cat list_of_generated_output.txt
```
# MISSING
- Modularization by using `include`
- Using a `config` file
- Using `conda` to define the toolchain
names: ["a", "b", "c"]
heading: "My heading ..."
Markdown is supported
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