-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathabra2.wdl
104 lines (89 loc) · 2.78 KB
/
abra2.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
101
102
103
104
## ABRA2 realigner
version 1.0
workflow abra2 {
input {
File vcf
File? vcfidx
String sample_name
File? normalBam
File? normalIdx
File tumorBam
File tumorIdx
File refFasta
File refFastaIdx
File? targets
}
call runabra2 {
input:
normalBam=normalBam,
normalIdx=normalIdx,
tumorBam=tumorBam,
tumorIdx=tumorIdx,
refFasta=refFasta,
vcf=vcf,
vcfidx=vcfidx,
sample_name=sample_name,
refFastaIdx=refFastaIdx,
targets=targets
}
}
task runabra2 {
input {
File? normalBam
File? normalIdx
String sample_name
File tumorBam
File tumorIdx
File refFasta
File refFastaIdx
File vcf
File? vcfidx
File? targets
Int cpu = 3
Int machine_mem_gb = 12
Int? preemptible_tries =3
Int? max_retries
}
Int command_mem=machine_mem_gb-1
Int disk_space_gb=5*ceil(size(tumorBam, "GB")+size(normalBam, "GB")+size(refFasta, "GB")+size(vcf, "GB"))
String existBam= if defined(normalBam) then "1" else "0"
command <<<
set -e
mkdir tmp
vcfPath="indelist.vcf"
EXTENSION=$(echo "~{vcf}")
if [[ $EXTENSION == *"gz"* ]];
then
gunzip -c ~{vcf} > $vcfPath
else
cp ~{vcf} $vcfPath
fi;
if [ ~{existBam} -eq "1" ];
then
echo 'normal exists'
java -Xmx~{command_mem}g -jar /usr/local/bin/abra2.jar --in ~{normalBam},~{tumorBam} --out ~{sample_name}.N.abra2.bam,~{sample_name}.T.abra2.bam \
--ref ~{refFasta} --threads ~{cpu} --in-vcf $vcfPath ~{"--targets " + targets} --index --tmpdir tmp > ~{sample_name}.log
cp "~{sample_name}.T.abra2.bai" "~{sample_name}.T.abra2.bam.bai"
cp "~{sample_name}.N.abra2.bai" "~{sample_name}.N.abra2.bam.bai"
else
echo 'no normal'
java -Xmx~{command_mem}g -jar /usr/local/bin/abra2.jar --in ~{tumorBam} --out ~{sample_name}.T.abra2.bam \
--ref ~{refFasta} --threads ~{cpu} --in-vcf $vcfPath ~{"--targets " + targets} --index --tmpdir tmp > ~{sample_name}.log
cp "~{sample_name}.T.abra2.bai" "~{sample_name}.T.abra2.bam.bai"
fi;
>>>
runtime {
docker: "mskaccess/abra2:2.22"
preemptible: select_first([preemptible_tries, 1])
maxRetries: select_first([max_retries, 0])
memory: machine_mem_gb + " GB"
disks: "local-disk " + disk_space_gb + " HDD"
cpu: cpu
}
output {
File Abra2Tumour = "${sample_name}.T.abra2.bam"
File Abra2TumourIdx = "${sample_name}.T.abra2.bam.bai"
File? Abra2Normal = "${sample_name}.N.abra2.bam"
File? Abra2NormalIdx = "${sample_name}.N.abra2.bam.bai"
}
}