Debian Codegraph @

tests/inputs/Snakefile

raw
1 """
2 A sample Snakefile for testing line counting
3 """
4
5 SAMPLES = ["A", "B"]
6
7
8 # This is a
9 # multiline
10 # comment
11 rule all:
12 input:
13 "plots/quals.svg"
14
15
16 rule bwa_map:
17 input:
18 "data/genome.fa", # Inline comments are also supported
19 "data/samples/{sample}.fastq"
20 output:
21 "mapped_reads/{sample}.bam"
22 shell:
23 "bwa mem {input} | samtools view -Sb - > {output}"
24
25
26 rule samtools_sort:
27 input:
28 "mapped_reads/{sample}.bam"
29 output:
30 "sorted_reads/{sample}.bam"
31 shell:
32 "samtools sort -T sorted_reads/{wildcards.sample} "
33 "-O bam {input} > {output}"
34
35
36 rule samtools_index:
37 input:
38 "sorted_reads/{sample}.bam"
39 output:
40 "sorted_reads/{sample}.bam.bai"
41 shell:
42 "samtools index {input}"
43
44
45 rule bcftools_call:
46 input:
47 fa="data/genome.fa",
48 bam=expand("sorted_reads/{sample}.bam", sample=SAMPLES),
49 bai=expand("sorted_reads/{sample}.bam.bai", sample=SAMPLES)
50 output:
51 "calls/all.vcf"
52 shell:
53 "bcftools mpileup -f {input.fa} {input.bam} | "
54 "bcftools call -mv - > {output}"
55
56
57 rule plot_quals:
58 input:
59 "calls/all.vcf"
60 output:
61 "plots/quals.svg"
62 script:
63 "scripts/plot-quals.py"