-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_vcf_samples.wdl
64 lines (51 loc) · 1.3 KB
/
check_vcf_samples.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
version 1.0
workflow check_vcf_samples {
input {
File vcf_file # can change this to Array[File] and scatter
Array[String] sample_list
}
call vcf_samples {
input: vcf_file = vcf_file
}
call compare_string_sets {
input: string_file = vcf_samples.sample_file,
string_array = sample_list
}
output {
String check_status = compare_string_sets.check_status
}
meta {
author: "Stephanie Gogarten"
email: "[email protected]"
}
}
task vcf_samples {
input {
File vcf_file
}
command {
bcftools query --list-samples ${vcf_file} > samples.txt
}
output {
File sample_file = "samples.txt"
}
runtime {
docker: "xbrianh/xsamtools:v0.5.2"
}
}
task compare_string_sets {
input {
Array[String] string_array
File string_file
}
command {
echo ${sep=' ' string_array} > string_list.txt
Rscript -e "a <- scan('string_list.txt', what=character(), quiet=TRUE); b <- readLines('${string_file}'); if (setequal(a,b)) status <- 'PASS' else status <- 'FAIL'; cat(status, file='status.txt')"
}
output {
String check_status = read_string("status.txt")
}
runtime {
docker: "rocker/r-ver:4.1.2"
}
}