Skip to content

Commit

Permalink
feat: added config file to tutorial folder
Browse files Browse the repository at this point in the history
  • Loading branch information
cmeesters committed Apr 24, 2024
1 parent e8602a0 commit cad3c22
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
22 changes: 16 additions & 6 deletions setup/solutions/08_Snakefile
Original file line number Diff line number Diff line change
@@ -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}"
Expand All @@ -33,6 +42,7 @@ rule samtools_index:
shell:
"samtools index {input}"


rule bcftools_call:
input:
fa="data/genome.fa",
Expand Down
6 changes: 6 additions & 0 deletions setup/tutorial/config/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
samples:
A: A.fastq
B: B.fastq

bwa_map:
rg=r"@RG\tID:{sample}\tSM:{sample}"

0 comments on commit cad3c22

Please # to comment.