Skip to content

Commit 8c9cb62

Browse files
committed
merge rules to build BED
1 parent a3b4742 commit 8c9cb62

2 files changed

Lines changed: 12 additions & 17 deletions

File tree

workflow/envs/tools.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
channels:
2+
- conda-forge
3+
- bioconda
4+
dependencies:
5+
- bedtools==2.31.1
6+
- bcftools==1.23

workflow/rules/sites.smk

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,19 @@
1-
rule problematic_vcf_filter:
1+
rule problematic_vcf_to_bed:
22
conda:
3-
"../envs/bcftools.yaml"
3+
"../envs/tools.yaml"
44
params:
55
filters = ["mask"],
66
input:
77
vcf = lambda wildcards: select_problematic_vcf(),
88
output:
99
vcf = temp(OUTDIR / "sites_masked.vcf"),
10-
log:
11-
LOGDIR / "problematic_vcf_filter" / "log.txt"
12-
shell:
13-
"""FILTER_STR=$(echo "{params.filters}" | tr ' ' ',') && """
14-
"""bcftools view -f "$FILTER_STR" {input.vcf} >{output.vcf} 2>{log}"""
15-
16-
17-
rule problematic_vcf_to_bed:
18-
conda:
19-
"../envs/bedtools.yaml"
20-
input:
21-
vcf = OUTDIR / "sites_masked.vcf",
22-
output:
2310
bed = temp(OUTDIR / "sites_masked.bed"),
2411
log:
25-
LOGDIR / "build_problematic_bed" / "log.txt",
12+
LOGDIR / "problematic_vcf_to_bed" / "log.txt",
2613
shell:
27-
"bedtools merge -i {input.vcf} >{output.bed} 2>{log}"
14+
"FILTER_STR=$(echo \"{params.filters}\" | tr ' ' ',') && "
15+
"bcftools view -f \"$FILTER_STR\" {input.vcf} >{output.vcf} 2>{log} && "
16+
"bedtools merge -i {output.vcf} >{output.bed} 2>{log}"
2817

2918

3019
rule bcftools_mpileup_all_sites:

0 commit comments

Comments
 (0)