-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathrfam.wdl
executable file
·83 lines (77 loc) · 2.41 KB
/
rfam.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
version 1.0
workflow rfam {
input {
String cmzscore
File imgap_input_fasta
String imgap_project_id
Int additional_threads
Int additional_memory
String database_location="/refdata/img/"
String cm="~{database_location}"+"Rfam/13.0/Rfam.cm"
String claninfo_tsv="~{database_location}"+"Rfam/13.0/Rfam.claninfo"
String feature_lookup_tsv="~{database_location}"+"Rfam/13.0/Rfam_feature_lookup.tsv"
String container
}
call run {
input:
input_fasta = imgap_input_fasta,
project_id = imgap_project_id,
cm = cm,
cmzscore=cmzscore,
feature_lookup_tsv = feature_lookup_tsv,
claninfo_tsv = claninfo_tsv,
threads = additional_threads,
container=container,
memory = additional_memory
}
output {
File rfam_gff = run.rfam_gff
File rfam_tbl = run.tbl
String rfam_version = run.rfam_ver
}
}
task run {
input {
String bin="/opt/omics/bin/cmsearch"
String clan_filter_bin="/opt/omics/bin/structural_annotation/rfam_clan_filter.py"
File input_fasta
String cm
String project_id
String prefix=sub(project_id, ":", "_")
String cmzscore
String claninfo_tsv
String feature_lookup_tsv
Int threads
Int memory = 100
String container
String rfam_version_file = "rfam_version.txt"
}
command <<<
set -euo pipefail
~{bin} --notextw --cut_tc --cpu ~{threads} -Z ~{cmzscore} --tblout ~{prefix}_rfam.tbl ~{cm} ~{input_fasta}
tool_and_version=$(~{bin} -h | grep INFERNAL | perl -pne 's/^.*INFERNAL/INFERNAL/' )
if [ $(grep -c -v '#' ~{prefix}_rfam.tbl) -eq 0 ] ; then
touch ~{prefix}_rfam.gff
else
grep -v '^#' ~{prefix}_rfam.tbl | \
awk '$17 == "!" {print $1,$3,$4,$6,$7,$8,$9,$10,$11,$15,$16}' | \
sort -k1,1 -k10,10nr -k11,11n | \
~{clan_filter_bin} "$tool_and_version" \
~{claninfo_tsv} ~{feature_lookup_tsv} > ~{prefix}_rfam.gff
fi
#get database version
rfam_version=$(basename $(dirname ~{cm}))
echo "Rfam $rfam_version" > ~{rfam_version_file}
>>>
runtime {
time: "1:00:00"
docker: container
cpu: threads
memory: "~{memory} GiB"
}
output {
File tbl = "~{prefix}_rfam.tbl"
File rfam_gff = "~{prefix}_rfam.gff"
String rfam_ver = read_string(rfam_version_file)
}
}