-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfeature-counts-parallel.wdl
58 lines (47 loc) · 1.62 KB
/
feature-counts-parallel.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
version 1.0
# based on https://github.com/gatk-workflows/seq-format-conversion/blob/master/cram-to-bam.wdl
workflow FeatureCountsWorkflow {
input {
File? ref_fasta
File? ref_fasta_fai
File gencode_gtf
Array[File] input_bams_or_crams
}
scatter(input_bam_or_cram in input_bams_or_crams) {
call FeatureCountsTask {
input:
ref_fasta=ref_fasta,
ref_fasta_fai=ref_fasta_fai,
gencode_gtf=gencode_gtf,
input_bam_or_cram=input_bam_or_cram
}
}
}
task FeatureCountsTask {
input {
File? ref_fasta
File? ref_fasta_fai
File gencode_gtf
File input_bam_or_cram
String output_prefix = sub(basename(input_bam_or_cram), ".bam$||.cram$", "")
Int disk_size = ceil(size(gencode_gtf, "GB") + size(input_bam_or_cram, "GB")) + 5
}
command {
echo --------------; echo "Start - time: $(date)"; set -euxo pipefail; echo --------------
samtools view -h \
~{"-T " + ref_fasta} \
~{input_bam_or_cram} \
| /featureCounts --extraAttributes gene_name \
-a ~{gencode_gtf} \
-o ~{output_prefix}.tsv
echo --------------; set +xe; echo "Done - time: $(date)"; echo --------------
}
output {
File feature_counts_tsv="~{output_prefix}.tsv"
File feature_counts_summary="~{output_prefix}.tsv.summary"
}
runtime {
docker: "weisburd/feature-counts@sha256:30a52fc577992546223e7435cba340c03f87950555a35e4724ebbff24f24475b"
disks: "local-disk ${disk_size} HDD"
}
}