accessing list of entities in a sample set in WDL
I have both a sample table and a sample set table, where each row in the sample set table contains a subset of samples. I want to write a WDL workflow that writes the list of samples in a set to a file, then uses that file as an argument to another command. How can I refer to the list of sample entities inside my WDL code?
Comments
4 comments
Hi Stephanie,
Thanks for writing in. Samples in a sample_set are typically interpreted as an Array[File] in a WDL. I believe it should be possible to write a task that takes the Array[File] input and writes the contents to a list of type File. That File would be output for that task, and input for the task you want to feed it into.
Alternatively, I wonder if you can pass that Array[File] into your command directly. What do you think?
Kind regards,
Jason
Hi Stephanie,
We haven't heard from you in a while so we just wanted to check-in. Did any of the suggestions from my previous message help? Do you have any questions I can help answer at this time?
Kind regards,
Jason
I tried the simplest scenario I could think of, where the input samples are an Array[File] and the file list is written to an output file with `cat`:
https://github.com/UW-GAC/primed-bcftools/blob/main/bcftools_stats.wdl
However, when I try to run this workflow on Terra, it immediately fails, with no error message or any indication of what is going wrong. I feel totally lost when trying to write a WDL that works with data tables. Is there any documentation or examples that address how to use data tables in a WDL? I've found documentation on how to use data tables in an existing workflow, and documentation on how to write a WDL, but I haven't been able to find anything that combines the two.
I figured this out, and my confusion with the above answer came from the fact that I was trying to identify the "sample_id", not a sample-specific filename (which does not even exist in my use case, as I have multi-sample files). "sample_id" can be referenced in the WDL in an Array[String]:
Then in the WDL task, I can access the contents of this String Array and write it to a file:
When I run the workflow, the input sample_list is specified as "this.samples.sample_id" where the root entity type is a sample set.
Please sign in to leave a comment.