Answers.Body: <p>My hacktastic fix for this is to use basename to get the name of each file, then do</p>
  <pre><code>refName=`basename &quot;${Ref}&quot;`
  ln -s &quot;<span class="math-container">${Ref}" "$</span>refName&quot;
  </code></pre>
  <p>for each file.  This puts aliases to each file in the executions dir, and then I pass &quot;refName&quot; to GATK rather than &quot;${Ref}&quot;.</p>
  <p>Not a good solution, but a solution</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-21T22:37:30.273Z
Answers.LastActivityDate: 2023-08-24T15:58:17.290Z
Answers.LastEditDate: 2023-08-24T15:58:17.290Z
Answers.UserDisplayName: Greg Dougherty
Answers.Body: <p>as for wdl version 1.0 (other versions untested)</p>
  <p>you can pack your reference and related files into a struct:</p>
  <pre><code>struct Reference {
      File fasta
      File dict
      File fai
  }
  </code></pre>
  <p>You will pass the <code>Reference</code> to your tasks instead of <code>File</code>.
  Inside your workflow/config define:</p>
  <pre><code>Ref example = {
      &quot;fasta&quot; : &quot;reference.fasta&quot;,
      &quot;fai&quot; : &quot;reference.fasta.fai&quot;,
      &quot;dict&quot; : &quot;reference.dict&quot;
  }
  </code></pre>
  <p>Inside the task you just use the file want use by <code>example.fasta</code>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-05-09T15:00:48.047Z
Answers.LastActivityDate: 2023-05-09T15:01:18.343Z
Answers.LastEditDate: 2023-05-09T15:01:18.343Z
Answers.UserDisplayName: user2919167
Body: <p>I have a cromwell task that, among other variables, takes these three variables:</p>
  <pre><code>   File Ref             # Reference genome fasta
     File RefFai          # Reference Genome index
     File RefDict         # Reference Dictionary
  </code></pre>
  <p>While all three files make it into the task's &quot;inputs&quot; directory, they end up in different sub-directories of inputs:</p>
  <pre><code>ME $ find inputs
  inputs
  
  inputs/-181926642
  inputs/-181926642/Sample.vcf.bgz.tbi
  inputs/-181926642/Sample.vcf.bgz
  inputs/-1548908437
  inputs/-1548908437/GCA_000001405.15_GRCh38_no_alt_short_headers_nonACTG_to_N.dict
  inputs/44588251
  inputs/44588251/GCA_000001405.15_GRCh38_no_alt_short_headers_nonACTG_to_N.fa
  inputs/44588251/GCA_000001405.15_GRCh38_no_alt_short_headers_nonACTG_to_N.fa.fai
  </code></pre>
  <p>Which means that when I call GATK and pass it the path to the .fa file, it gets rather cranky that the .dict file isn't in the same directory.</p>
  <p>How do I force cromwell to put all three files in the same directory?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-01-14T08:29:19.590Z
Comments.Text: We did have a similar problem and there is a solution to it... however, I have hard time recalling it, sinc eit was a while ago (and we abandoned WDL). Perhaps you could paste the code for the task, which would make it easier to see, if anything is missing.
Comments.UserDisplayName: Roger V.
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-01-21T22:31:44.887Z
Comments.Text: @Vadim the code does not reference RefFai or RefDict, only Ref.
Comments.UserDisplayName: Greg Dougherty
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-01-22T06:28:03.980Z
Comments.Text: I am talking about the wdl code: one must pass all the files explicitly to the task, even if they do not appear in the command line. Every task is run from a separate folder.
Comments.UserDisplayName: Roger V.
Tags: <wdl>
Title: How do I force Cromwell / WDL to put input files in the same directory?
ThreadText: # How do I force Cromwell / WDL to put input files in the same directory?
  
  (Asked by: username_0 on 2021-01-13)
  
  I have a cromwell task that, among other variables, takes these three variables:
  
  ```
     File Ref             # Reference genome fasta
     File RefFai          # Reference Genome index
     File RefDict         # Reference Dictionary
  
  ```
  
  While all three files make it into the task's "inputs" directory, they end up in different sub-directories of inputs:
  
  ```
  ME $ find inputs
  inputs
  
  inputs/-181926642
  inputs/-181926642/Sample.vcf.bgz.tbi
  inputs/-181926642/Sample.vcf.bgz
  inputs/-1548908437
  inputs/-1548908437/GCA_000001405.15_GRCh38_no_alt_short_headers_nonACTG_to_N.dict
  inputs/44588251
  inputs/44588251/GCA_000001405.15_GRCh38_no_alt_short_headers_nonACTG_to_N.fa
  inputs/44588251/GCA_000001405.15_GRCh38_no_alt_short_headers_nonACTG_to_N.fa.fai
  
  ```
  
  Which means that when I call GATK and pass it the path to the .fa file, it gets rather cranky that the .dict file isn't in the same directory.
  
  How do I force cromwell to put all three files in the same directory?
  
  **Tags:** wdl
  
  > **Comments:**
  > **username_1**: We did have a similar problem and there is a solution to it... however, I have hard time recalling it, sinc eit was a while ago (and we abandoned WDL). Perhaps you could paste the code for the task, which would make it easier to see, if anything is missing.  
  > **username_0**: @Vadim the code does not reference RefFai or RefDict, only Ref.  
  > **username_1**: I am talking about the wdl code: one must pass all the files explicitly to the task, even if they do not appear in the command line. Every task is run from a separate folder.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2021-01-21. Score: 0 | Accepted answer
  
  My hacktastic fix for this is to use basename to get the name of each file, then do
  
  ```
  refName=`basename "${Ref}"`
  ln -s "${Ref}" "$refName"
  
  ```
  
  for each file. This puts aliases to each file in the executions dir, and then I pass "refName" to GATK rather than "${Ref}".
  
  Not a good solution, but a solution
  
  
  ---
  
  ### Answer by username_2 on 2023-05-09. Score: 1
  
  as for wdl version 1.0 (other versions untested)
  
  you can pack your reference and related files into a struct:
  
  ```
  struct Reference {
      File fasta
      File dict
      File fai
  }
  
  ```
  
  You will pass the `Reference` to your tasks instead of `File`.
  Inside your workflow/config define:
  
  ```
  Ref example = {
      "fasta" : "reference.fasta",
      "fai" : "reference.fasta.fai",
      "dict" : "reference.dict"
  }
  
  ```
  
  Inside the task you just use the file want use by `example.fasta`.
  
  
  ---
  
  