diff --git a/Snakemake.html b/Snakemake.html index af1c68b..8fb6eca 100644 --- a/Snakemake.html +++ b/Snakemake.html @@ -391,36 +391,90 @@

Objectives

  1. Data Simulation: Simulate some data.
  2. Data Analysis: Analyze the simulated data.

We’ll use parallel processing to speed up the analysis step.

-
  1. Create the Snakefile:
  2. -
-

YAML +
  1. Create the Python Scripts:
  2. +

simulate_data.py:

+
+

PYTHON

-
configfile: "config.yaml"
+
import sys
 
-rule all:
-    input:
-        expand("results/analysis_{sample}.txt", sample=config["samples"])
-
-rule simulate_data:
-    input:
-        configfile = "config.yaml"
-    output:
-        "data/{sample}.txt"
-    shell:
-        "python simulate_data.py --sample {wildcards.sample} > {output}"
-
-rule analyze_data:
-    input:
-        data = "data/{sample}.txt"
-    output:
-        "results/analysis_{sample}.txt"
-    shell:
-        "python analyze_data.py {input} > {output}"
+sample = sys.argv[1] +with open(f"data/{sample}.txt", "w") as f: + f.write(f"Simulated data for {sample}\n")
+
+

analyze_data.py:

+
+

PYTHON +

+
import sys
+
+with open(sys.argv[1], "r") as f:
+    data = f.read()
+
+with open(f"results/analysis_{sys.argv[1].split('/')[-1]}", "w") as f:
+    f.write(f"Analysis of {data}\n")
+
+
  1. Create the Config File (config.yaml):
  2. +
+

YAML +

+
samples:
+  - sample1
+  - sample2
+  - sample3
+  - sample4
+  - sample5
- + -->

+