Skip to content

Commit 1ff9f7c

Browse files
committed
fix: formatting
1 parent 849c8ac commit 1ff9f7c

1 file changed

Lines changed: 34 additions & 23 deletions

File tree

setup_creators/tutorial/11_Snakefile_rule_params

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,66 +4,77 @@ rule all:
44
input:
55
"calls/all.vcf",
66
"calls/positions.png",
7-
"calls/quals.svg"
8-
7+
"calls/quals.svg",
8+
9+
910
def get_bwa_map_input_fastqs(wildcards):
1011
return config["samples"][wildcards.sample]
1112

13+
1214
rule bwa_map:
1315
input:
1416
"data/genome.fa",
15-
get_bwa_map_input_fastqs
17+
get_bwa_map_input_fastqs,
1618
output:
17-
"mapped_reads/{sample}.bam"
19+
"mapped_reads/{sample}.bam",
20+
log:
21+
"logs/bwa_map/{sample}.log",
1822
params:
19-
rg=config["bwa_map"]["rg"]
23+
rg=config['bwa_map']['rg'],
2024
shell:
21-
"bwa mem -R '{params.rg}' {input} | samtools view -Sb - > {output}"
25+
"(bwa mem -R '{params.rg}' {input} | samtools view -Sb - > {output}) 2> {log}"
2226

2327

2428
rule samtools_sort:
2529
input:
26-
"mapped_reads/{sample}.bam"
30+
"mapped_reads/{sample}.bam",
2731
output:
28-
"sorted_reads/{sample}.bam"
32+
"sorted_reads/{sample}.bam",
33+
log:
34+
"logs/samtools_sort/{sample}.log",
2935
shell:
3036
"samtools sort -T sorted_reads/{wildcards.sample} "
31-
"-O bam -o {output} {input}"
37+
"-O bam -o {output} {input} 2> {log}"
3238

3339

3440
rule samtools_index:
3541
input:
36-
"sorted_reads/{sample}.bam"
42+
"sorted_reads/{sample}.bam",
3743
output:
38-
"sorted_reads/{sample}.bam.bai"
44+
"sorted_reads/{sample}.bam.bai",
45+
log:
46+
"logs/samtools_index/{sample}.log",
3947
shell:
40-
"samtools index {input}"
48+
"samtools index {input} 2> {log}"
4149

4250

4351
rule bcftools_call:
4452
input:
4553
fa="data/genome.fa",
4654
bam=expand("sorted_reads/{sample}.bam", sample=config["samples"]),
47-
bai=expand("sorted_reads/{sample}.bam.bai", sample=config["samples"])
55+
bai=expand("sorted_reads/{sample}.bam.bai", sample=config["samples"]),
4856
output:
49-
"calls/all.vcf"
57+
"calls/all.vcf",
58+
log:
59+
"logs/bcftools_call/bcftools.log",
5060
shell:
51-
"bcftools mpileup -f {input.fa} {input.bam} | "
52-
"bcftools call -mv - > {output}"
61+
"(bcftools mpileup -f {input.fa} {input.bam} | "
62+
"bcftools call -mv - > {output}) 2> {log}"
63+
5364

5465
rule plot_positions:
5566
input:
56-
rules.bcftools_call.output
67+
rules.bcftools_call.output,
5768
output:
58-
"calls/positions.png"
69+
"calls/positions.png",
5970
script:
60-
"scripts/plot-positions.py"
61-
71+
"scripts/plot-positions.py"
72+
73+
6274
rule plot_quals:
6375
input:
64-
"calls/all.vcf"
76+
"calls/all.vcf",
6577
output:
66-
"calls/quals.svg"
78+
"calls/quals.svg",
6779
script:
6880
"scripts/plot-quals.py"
69-

0 commit comments

Comments
 (0)