Skip to content

Commit

Permalink
add new taxid_to_nextclade workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dpark01 committed Apr 3, 2024
1 parent 2ac90b1 commit 2d135a8
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .dockstore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,11 @@ workflows:
primaryDescriptorPath: /pipes/WDL/workflows/subsample_by_metadata_with_focal.wdl
testParameterFiles:
- /empty.json
- name: taxid_to_nextclade
subclass: WDL
primaryDescriptorPath: /pipes/WDL/workflows/taxid_to_nextclade.wdl
testParameterFiles:
- /empty.json
- name: terra_table_to_tsv
subclass: WDL
primaryDescriptorPath: /pipes/WDL/workflows/terra_table_to_tsv.wdl
Expand Down
35 changes: 35 additions & 0 deletions pipes/WDL/tasks/tasks_nextstrain.wdl
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
version 1.0

task taxid_to_nextclade_dataset_name {
input {
String taxid
}
command <<<
python3 <<CODE
taxid = int("~{taxid}")
taxid_to_dataset_map = {
2697049 : 'sars-cov-2',
641809 : 'flu_h1n1pdm_ha',
335341 : 'flu_h3n2_ha',
518987 : 'flu_vic_ha',
208893 : 'rsv_a',
208895 : 'rsv_b',
10244 : 'MPXV',
619591 : 'hMPXV'
}
with open('DATASET_NAME', 'wt') as outf:
outf.write(taxid_to_dataset_map.get(taxid, '') + '\n')
CODE
>>>
runtime {
docker: "python:slim"
memory: "1 GB"
cpu: 1
disks: "local-disk " + disk_size + " LOCAL"
disk: disk_size + " GB" # TES
dx_instance_type: "mem2_ssd1_v2_x2"
maxRetries: 2
}
output {
String nextclade_dataset_name = read_string("DATASET_NAME")
}
}
task nextclade_one_sample {
meta {
description: "Nextclade classification of one sample. Leaving optional inputs unspecified will use SARS-CoV-2 defaults."
Expand Down
15 changes: 15 additions & 0 deletions pipes/WDL/workflows/taxid_to_nextclade.wdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version 1.0

import "../tasks/tasks_nextstrain.wdl" as nextstrain

workflow taxid_to_nextclade {
meta {
description: "Convert taxids to a nextclade dataset name"
}

call nextstrain.taxid_to_nextclade_dataset_name

output {
String nextclade_dataset = taxid_to_nextclade_dataset_name.nextclade_dataset_name
}
}

0 comments on commit 2d135a8

Please sign in to comment.