Cannot look up input variable, variable never declared

Post author
Alex O

I'm trying to import an established, but modified workflow into a new workflow I'm writing, but I keep getting this error when trying to generate inputs:

 

Failed to process workflow definition 'analysis' (reason 1 of 1): 
Cannot lookup value 'input_bam', it is never declared. Available values are: ['fastq_in', 'hisatOut', 'runtime_zones', 'library', 'slidingWindow_qual', 'slidingWindow_len', 'hisat2.hisatOut', 'Leading', 'truSeq_fa', 'runtime_preemptible', '__resource_log_code', 'hisat2.__after', 'runtime_cpu', 'samtools.__after', 'transcriptome_fasta', 'salmon_quant.salmon_log', 'Trailing', 'transcript_to_gene_map', 'salmon_quant.transcript', 'salmon_quant.resource_log', 'minLen', 'samout', 'runtime_memory', 'resource_log_code', 'salmon_quant.gene', 'trimmomatic.trimmedOut', 'bam_suffix', 'truSeq_score', 'trimmomatic.__after', 'runtime_docker', 'salmon_quant.__after', 'samtools.samout', 'salmon_quant.meta_json', 'salmon_quant.aux_info', 'indexFile', 'resource_log_interval', 'truSeq_mis']

 

Despite very specifically defining it:


```

call salmonQuant.salmon_quant as salmon_quant{
input:
input_bam=samtools.samout,
transcriptome_fasta=transcriptome_fasta,
transcript_to_gene_map=transcript_to_gene_map,
bam_suffix=bam_suffix,
library=library,
resource_log_code=resource_log_code,
runtime_preemptible=runtime_preemptible,
runtime_memory=if defined(runtime_memory) then '$runtime_memory' else 8 + ceil(size(input_bam, 'G') / 2),
runtime_cpu=runtime_cpu,
runtime_docker=runtime_docker,
runtime_zones=runtime_zones
}
```
I have tried renaming variables, moving things around, etc, but nothing is fixing it. Any ideas how to solve this?

Thank you,
 
Alex

Comments

14 comments

  • Comment author
    Beri

    Hi Alex,

     

    Is it possible to share the whole workflow? 

    0
  • Comment author
    Alex O

    I made a github repo with the files. What is your username, so I can add you to the collaborators?

    0
  • Comment author
    Beri

    bshifaw, thanks

    0
  • Comment author
    Alex O

    Shared, thanks!

    0
  • Comment author
    Beri

    The message is referring to the following line:

    runtime_memory=if defined(runtime_memory) then '$runtime_memory' else 8 + ceil(size(input_bam, 'G') / 2)

    The declaration made in the call input block is meant to be used by the task and not within the call block. So replace the input_bam in the above line with samtools.samout

    0
  • Comment author
    Alex O
    That solved the problem, but now, for some reason, I'm getting this:

    Call input and runtime attributes evaluation failed for salmon_quant:
    Failed to evaluate input 'runtime_memory' (reason 1 of 1): For input string: "$runtime_memory"
    Failed to evaluate input '__runtime_disk_space' (reason 1 of 1): [Attempted 1 time(s)] - NoSuchFileException: /Users/alexanderostrovsky/Desktop/wdl/jamboree/cromwell-executions/analysis/54ea7ccb-457c-4e19-8683-8aa0e62e2668/call-salmon_quant/salmon_quant_singlebam/84502be0-edc8-44a7-bc61-9c7d50c58850/call-salmon_quant/execution/sequence.fasta

    Looking at the files, it's not ever actually generating the inputs folder for the run, despite the file being labeled correctly. Any ideas why not?

    0
  • Comment author
    Beri

    For the first error try removing the quotes and dollar sign from

    '$runtime_memory'

    For the second error make sure the files exists. 

    0
  • Comment author
    Alex O

    For the first, I had originally put the quotes on to prevent

    Unrecognized token on line 60, column 60:

    runtime_memory=if defined(runtime_memory) then $runtime_memory else 8 + ceil(size(input_bam, 'G') / 2),
    ^

    And for the second, the file is in the same folder as where I'm running, is in the same folder as the wdl, is populated and is labeled in the  inputs.json as 

    sequence.fasta
    0
  • Comment author
    Alex O
    • Edited

    Furthermore, the else is being triggered despite having runtime memory defined.

     

    The only way was able to get it to start was by taking out the conditional, which I would have preferred stay in

    0
  • Comment author
    Alex O

    If you want to take a look, I posted the most recent version of the files on the repo I shared last week

    0
  • Comment author
    Beri

    Hey Alex,

    You should be able to avoid the "unrecognized token" message if you remove the quotes along with the dollar sign.
    Its best to use the full path of a file instead of abbreviations to avoid issues like "files not found"
    For the latest repo it looks like the contents of the  modernsalmon.wdl has been replaced with an input json file. 

    If you are new to WDL, you may be interested in reviewing our WDL documentation here. For a more technical document on the WDL you be interested in the Tec Spec.

    0
  • Comment author
    Alex O
    • Edited

    Beri, The first issue was fixed, and I appreciate the links to the documentation. The reason I'm confused with this specific case is that I am using that documentation and importing a file in the same way I have been for the other tools in my pipeline, but it is not generating an executions folder as it should be, and therefore there is no file to be found, despite being labeled properly and populated. I am mostly confused with why there is no executions folder for this tool in the pipeline. Thank you again.

     

    Edit: For some reason, the input for this specific tool had to be an absolute path, unlike the other files for this workflow. It now runs

    0
  • Comment author
    Beri

    Happy to hear the error was solved

    0
  • Comment author
    Alex O
    • Edited

    Sorry for one last thing: any idea why variables wouldn't populate with their values? The script is using the strings "${input_value}" instead of the actual values of the variables for every variable in only the final tool.

     

    Edit for anyone who looks here: Turns out you can’t mix the command section “<<< >>>” from one file with at “{}” in another, it will use your inputs as string literals

    0

Please sign in to leave a comment.