-
Notifications
You must be signed in to change notification settings - Fork 0
/
plink2_bed2vcf.wdl
77 lines (68 loc) · 1.98 KB
/
plink2_bed2vcf.wdl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
version 1.0
workflow plink2_bed2vcf {
input {
File bed_file
File bim_file
File fam_file
File? fasta_file
String? out_prefix
Boolean? snps_only
Boolean? chr_prefix
}
call bed2vcf {
input: bed_file = bed_file,
bim_file = bim_file,
fam_file = fam_file,
fasta_file = fasta_file,
out_prefix = out_prefix,
snps_only = snps_only,
chr_prefix = chr_prefix
}
output {
File out_file = bed2vcf.out_file
String md5sum = bed2vcf.md5sum
}
meta {
author: "Stephanie Gogarten"
email: "[email protected]"
}
}
task bed2vcf {
input {
File bed_file
File bim_file
File fam_file
File? fasta_file
String? out_prefix
Boolean snps_only = true
Boolean chr_prefix = true
Int mem_gb = 16
}
Int disk_size = ceil(3*(size(bed_file, "GB") + size(bim_file, "GB") + size(fam_file, "GB"))) + 10
String out_string = if defined(out_prefix) then out_prefix else basename(bed_file, ".bed")
command {
plink2 \
--bed ${bed_file} \
--bim ${bim_file} \
--fam ${fam_file} \
--make-pgen \
--merge-x \
--sort-vars ${true="--snps-only 'just-acgt'" false="" snps_only} \
--out sorted
plink2 \
--pfile sorted \
--export vcf id-paste=iid bgz ${"--ref-from-fa --fa " + fasta_file} \
--out ${out_string} ${true="--output-chr chrM" false="" chr_prefix}
rm sorted.*
md5sum ${out_string}.vcf.gz | cut -d " " -f 1 > md5.txt
}
output {
File out_file = "${out_string}.vcf.gz"
String md5sum = read_string("md5.txt")
}
runtime {
docker: "quay.io/biocontainers/plink2:2.00a5.10--h4ac6f70_0"
disks: "local-disk " + disk_size + " SSD"
memory: mem_gb + " GB"
}
}