From cad3c22072d1b43554ee5beab18ee9acdf5b6561 Mon Sep 17 00:00:00 2001 From: Christian Meesters Date: Wed, 24 Apr 2024 14:44:46 +0200 Subject: [PATCH] feat: added config file to tutorial folder --- setup/solutions/08_Snakefile | 22 ++++++++++++++++------ setup/tutorial/config/config.yaml | 6 ++++++ 2 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 setup/tutorial/config/config.yaml diff --git a/setup/solutions/08_Snakefile b/setup/solutions/08_Snakefile index 283e915..ca3eae6 100644 --- a/setup/solutions/08_Snakefile +++ b/setup/solutions/08_Snakefile @@ -1,25 +1,34 @@ -SAMPLES = ['A', 'B'] +configfile: "config/config.yaml" rule all: input: "plots/quals.svg", "calls/all.vcf" + +def get_bwa_map_input_fastqs(wildcards): + return config["samples"][wildcards.sample] + rule bwa_map: input: "data/genome.fa", - "data/samples/{sample}.fastq" + get_bwa_map_input_fastqs output: - "mapped_reads/{sample}.bam" + temp("mapped_reads/{sample}.bam") + params: + rg=r"@RG\tID:{sample}\tSM:{sample}" + log: "logs/bwa_mem/{sample}.log" + threads: 8 shell: - "bwa mem {input} | " - "samtools view -Sb - > {output}" + "(bwa mem -R '{params.rg}' -t {threads} {input} | " + "samtools view -Sb - > {output}) 2> {log}" + rule samtools_sort: input: "mapped_reads/{sample}.bam" output: - "sorted_reads/{sample}.bam" + temp("sorted_reads/{sample}.bam") shell: "samtools sort -T sorted_reads/{wildcards.sample} " "-O bam {input} > {output}" @@ -33,6 +42,7 @@ rule samtools_index: shell: "samtools index {input}" + rule bcftools_call: input: fa="data/genome.fa", diff --git a/setup/tutorial/config/config.yaml b/setup/tutorial/config/config.yaml new file mode 100644 index 0000000..fd839f5 --- /dev/null +++ b/setup/tutorial/config/config.yaml @@ -0,0 +1,6 @@ +samples: + A: A.fastq + B: B.fastq + +bwa_map: + rg=r"@RG\tID:{sample}\tSM:{sample}"