Skip to content

Commit 8de2980

Browse files
committed
Obtain the extracted VCF fields in longer format
1 parent e3bee00 commit 8de2980

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

workflow/rules/vaf.smk

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,18 @@ rule extract_vcf_fields:
187187
'SnpSift extractFields -s {params.sep:q} {input.vcf:q} {params.extract_columns} >{output.tsv:q} 2>{log:q}'
188188

189189

190+
rule format_vcf_fields_longer:
191+
conda: "../envs/renv.yaml"
192+
params:
193+
sep = ","
194+
input:
195+
tsv = OUTDIR/f"{OUTPUT_NAME}.vcf_fields.tsv"
196+
output:
197+
tsv = OUTDIR/f"{OUTPUT_NAME}.vcf_fields.longer.tsv"
198+
script:
199+
"../scripts/format_vcf_fields_longer.R"
200+
201+
190202
rule vcf_to_tsv:
191203
threads: 1
192204
conda: "../envs/renv.yaml"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env Rscript
2+
3+
# Write stdout and stderr to log file
4+
log <- file(snakemake@log[[1]], open = "wt")
5+
sink(log, type = "message")
6+
sink(log, type = "output")
7+
8+
library(tidyverse)
9+
10+
read_tsv(snakemake@input$tsv) %>%
11+
separate_rows(contains("[*]"), sep = snakemake@params$sep) %>%
12+
write_tsv(snakemake@output$tsv)

0 commit comments

Comments
 (0)