-
Notifications
You must be signed in to change notification settings - Fork 1
/
imp-prep-recode-plink-split-vcf.wdl
100 lines (87 loc) · 2.09 KB
/
imp-prep-recode-plink-split-vcf.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
task plink {
File bim
File fam
File bed
String basename
File Chromosome
File Exclude
File Force_Allele1
File Position
File Strand_Flip
command <<<
mkdir bfiles
mv ${bim} bfiles/
mv ${bed} bfiles/
mv ${fam} bfiles/
plink --bfile bfiles/${basename} --exclude ${Exclude} --make-bed --out TEMP1
plink --bfile TEMP1 --update-map ${Chromosome} --update-chr --make-bed --out TEMP2
plink --bfile TEMP2 --update-map ${Position} --make-bed --out TEMP3
plink --bfile TEMP3 --flip ${Strand_Flip} --make-bed --out TEMP4
plink --bfile TEMP4 --a2-allele ${Force_Allele1} --make-bed --out updated
plink --bfile updated --real-ref-alleles --make-bed --out updated
plink --bfile updated --real-ref-alleles --recode vcf --out ${basename}
>>>
runtime {
disks: "local-disk 100 HDD"
memory: "32 GB"
docker: "jrose77/plinkdocker"
}
output {
File out_vcf = "${basename}.vcf"
}
}
task split_vcf {
Int chr
File in_vcf
String basename
command <<<
mkdir in_files/
mv ${in_vcf} in_files/
cd in_files && bgzip ${basename}.vcf && bcftools index ${basename}.vcf.gz && cd ..
bcftools view -r ${chr} in_files/${basename}.vcf.gz| bgzip >chr${chr}.vcf.gz
bcftools index chr${chr}.vcf.gz
>>>
runtime {
disks: "local-disk 100 HDD"
memory: "32 GB"
docker: "vandhanak/bcftools:1.3.1"
}
output {
File chr_vcf = "chr${chr}.vcf.gz"
File chr_vcf_ind = "chr${chr}.vcf.gz.csi"
}
}
workflow plink_workflow {
String basename
Int chr
File bim
File fam
File bed
File Chromosome
File Exclude
File Force_Allele1
File Position
File Strand_Flip
call plink {
input:
basename=basename,
bim=bim,
fam=fam,
bed=bed,
Chromosome=Chromosome,
Exclude=Exclude,
Force_Allele1=Force_Allele1,
Position=Position,
Strand_Flip=Strand_Flip
}
call split_vcf {
input:
in_vcf=plink.out_vcf,
chr=chr,
basename=basename
}
output {
File chr_vcf=split_vcf.chr_vcf
File chr_vcf_ind=split_vcf.chr_vcf_ind
}
}