Skip to content

Commit

Permalink
Create snakemake.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
RamiyapriyaS authored Jan 16, 2025
1 parent c1a4e80 commit e0b20dd
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions docs/chatbot_comparison/knowledge_testing/snakemake.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
1. Question: How do you define a rule in Snakemake, and what are the essential components of a rule?

Expected Answer: A rule in Snakemake is defined using the rule keyword followed by a rule name. Essential components include input, output, and shell or script. For example:
Python
```
rule example:
input: "input_file.txt"
output: "output_file.txt"
shell: "cat {input} > {output}"
```

2. Question: How does Snakemake handle dependencies between rules, and how can you specify that one rule depends on the output of another?

Expected Answer: Snakemake handles dependencies by specifying the output of one rule as the input of another. This creates a directed acyclic graph (DAG) of jobs. For example:
Python
```
rule first_rule:
output: "intermediate_file.txt"
shell: "echo 'data' > {output}"

rule second_rule:
input: "intermediate_file.txt"
output: "final_output.txt"
shell: "cat {input} > {output}"
```

3. Question: What are wildcards in Snakemake, and how are they used in rule definitions?
Expected Answer: Wildcards in Snakemake are placeholders that match parts of filenames and allow for flexible rule definitions. They are enclosed in curly braces {}. For example:
Python
```
rule all:
input: expand("results/{sample}.txt", sample=["sample1", "sample2"])

rule process:
input: "data/{sample}.txt"
output: "results/{sample}.txt"
shell: "cp {input} {output}"
```

0 comments on commit e0b20dd

Please sign in to comment.