Skip to content

Commit

Permalink
Merge pull request #30 from broadinstitute/dev_bait_set_wdl
Browse files Browse the repository at this point in the history
Adding dev version of checkBaitSetName WDL
  • Loading branch information
yueyaog authored Apr 14, 2023
2 parents 721ec18 + 111d67a commit 0c2ce7b
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .dockstore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,8 @@ workflows:
primaryDescriptorPath: /checkBaitSetName/checkBaitSetName.wdl
testParameterFiles:
- /checkBaitSetName/checkBaitSetName.inputs.json
- name: checkBaitSetName_dev
subclass: WDL
primaryDescriptorPath: /checkBaitSetName/checkBaitSetName.dev.wdl
testParameterFiles:
- /checkBaitSetName/checkBaitSetName.dev.inputs.json
6 changes: 6 additions & 0 deletions checkBaitSetName/checkBaitSetName.dev.inputs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"checkBaitSetName.compareBaitSetName.target_intervals": "File",
"checkBaitSetName.compareBaitSetName.bait_intervals": "File? (optional)",
"checkBaitSetName.compareBaitSetName.fail_task": "Boolean",
"checkBaitSetName.compareBaitSetName.bait_set": "String"
}
54 changes: 54 additions & 0 deletions checkBaitSetName/checkBaitSetName.dev.wdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
workflow checkBaitSetName{
call compareBaitSetName

output {
String mismatch_message = compareBaitSetName.mismatch_message
Int? bait_mismatch = compareBaitSetName.bait_mismatch
}
}

task compareBaitSetName {
String bait_set
Boolean fail_task
File target_intervals
File? bait_intervals
String target_intervals_name = basename(target_intervals)
String bait_intervals_name = if defined(bait_intervals) then basename(select_first([bait_intervals])) else bait_set + "."

command <<<
python <<CODE
import sys
target_correct = "${target_intervals_name}".startswith("${bait_set}.")
bait_correct = "${bait_intervals_name}".startswith("${bait_set}.")
if not target_correct and not bait_correct:
print("Bait and target intervals do not match the bait_set.")
open("set_mismatch.txt", 'w').write("1")
sys.stderr.write("1")
elif not target_correct:
print("Target intervals do not match the bait_set.")
open("set_mismatch.txt", 'w').write("1")
sys.stderr.write("1")
elif not bait_correct:
print("Bait intervals do not match the bait_set.")
open("set_mismatch.txt", 'w').write("1")
sys.stderr.write("1")
else:
print("bait_set matches the provided intervals.")
open("set_mismatch.txt", 'w').write("0")
CODE
>>>

output {
String mismatch_message = read_string(stdout())
Int bait_mismatch = read_int("set_mismatch.txt")
}

runtime {
docker: "python:3"
memory: "2 GB"
disks: "local-disk 10 HDD"
preemptible: 1
maxRetries: 0
failOnStderr: fail_task
}
}

0 comments on commit 0c2ce7b

Please sign in to comment.