|
1 | 1 | # Emulate a user configuring the module. |
2 | 2 | configfile: workflow.source_path("./test_config.yaml") |
3 | 3 |
|
| 4 | + |
4 | 5 | # Emulate how another workflow might create inputs for this module. |
5 | 6 | rule create_external_input: |
6 | | - message: "Example of a rule external to your module." |
| 7 | + message: |
| 8 | + "Example of a rule external to your module." |
7 | 9 | output: |
8 | | - text_file = "results/module_area_potentials/resources/user/user_message.md" |
| 10 | + text_file="results/module_area_potentials/resources/user/user_message.md", |
9 | 11 | run: |
10 | 12 | from pathlib import Path |
11 | 13 | from textwrap import dedent |
12 | | - text = dedent("""Modular workflows can be used by more than one project! |
| 14 | + |
| 15 | + text = dedent( |
| 16 | + """Modular workflows can be used by more than one project! |
13 | 17 | For example, this text comes from a file external to the module. |
14 | 18 | Try your best to make this workflow reusable so that others may benefit from your methods.""" |
15 | 19 | ) |
16 | 20 | file_path = Path(output.text_file) |
17 | 21 | with file_path.open("w") as f: |
18 | 22 | f.write(text) |
19 | 23 |
|
| 24 | + |
20 | 25 | # Import the module and configure it. |
21 | 26 | # `snakefile:` specifies the module. It can use file paths and special github(...) / gitlab(...) markers |
22 | 27 | # `prefix:` re-routes all input/output paths of the module, helping to avoid file conflicts. |
23 | 28 | module module_area_potentials: |
24 | | - snakefile: "../../workflow/Snakefile" |
25 | | - config: config["module_area_potentials"] |
26 | | - prefix: "results/module_area_potentials/" |
| 29 | + snakefile: |
| 30 | + "../../workflow/Snakefile" |
| 31 | + config: |
| 32 | + config["module_area_potentials"] |
| 33 | + prefix: |
| 34 | + "results/module_area_potentials/" |
| 35 | + |
27 | 36 |
|
28 | 37 | # rename all module rules with a prefix, to avoid naming conflicts. |
29 | 38 | use rule * from module_area_potentials as module_area_potentials_* |
30 | 39 |
|
| 40 | + |
31 | 41 | # Request something from the module |
32 | 42 | rule all: |
33 | | - message: "A generic test case for your module." |
| 43 | + message: |
| 44 | + "A generic test case for your module." |
34 | 45 | default_target: True |
35 | 46 | input: |
36 | | - "results/module_area_potentials/results/combined_text.md" |
| 47 | + "results/module_area_potentials/results/combined_text.md", |
0 commit comments