Best way to have set an optional file argument based on a boolean value?
I'm working on a validation WDL and I'm looking for a way to pass in an optional interval file to my tasks based on whether a boolean value is true. I can't make the file optional at the workflow level.
I'm currently doing the following:
Boolean isUsingIntervals = sub(inputBaseName, "Pond.*", "") != "Nex" File? garbageFile File? interval_list_final = if !isUsingIntervals then interval_list else garbageFile
This way the
interval_list_final gets set to the empty optional File
garbageFile in the case I don't want to use it.
However, this seems like I'm doing something wrong. Is there a better way to do this?