'Apply' object has no attribute 'expr'
admi2u opened this issue · 11 comments
my wdl file :
https://github.com/admi2u/blast_wdl/blob/master/blast.wdl#L74
while convert this file to cwl use wdl2cwl script, report this error:
Traceback (most recent call last): File "/root/wdl-cwl-translator/wdl2cwl/main.py", line 726, in get_workflow_outputs self, output_source = item_expr.expr.name[::-1].replace(".", "/", 1)[::-1] AttributeError: 'Apply' object has no attribute 'expr'
how can i fix this problem?
Hi @admi2u
Thanks for providing a link to the WDL workflow file. Looking at the stack trace, the error appears to be coming from the miniwdl
code.
We use miniwdl
to read/parse the WDL file, our code to handle the parsed data, and then cwl-utils
to write the CWL files.
I just tried using miniwdl
after pip install miniwdl
, I tried to validate your blast.wdl
file and it also failed.
miniwdl check ~/Downloads/blast.wdl
blast.wdl
workflow blast
(Ln 4, Col 5) UnboundDeclaration, String? blast_docker_override should either be in the input section or bound to an expression
(Ln 6, Col 5) UnboundDeclaration, File queryfa should either be in the input section or bound to an expression
if
call runblastp
if
call runblastn
if
call runblastx
if
call runtblastn
if
call runtblastx
(Ln 70, Col 30) StringCoercion, input String threads = :Int:
task runblastn
(Ln 81, Col 5) UnboundDeclaration, String docker should either be in the input section or bound to an expression
(Ln 82, Col 5) UnboundDeclaration, File Queryfa should either be in the input section or bound to an expression
(Ln 83, Col 5) UnboundDeclaration, String Fname should either be in the input section or bound to an expression
(Ln 84, Col 5) UnboundDeclaration, String Outfile should either be in the input section or bound to an expression
(Ln 85, Col 5) UnboundDeclaration, Int threads should either be in the input section or bound to an expression
(Ln 87, Col 5) UnboundDeclaration, Int outfmt should either be in the input section or bound to an expression
(Ln 89, Col 5) UnboundDeclaration, Float evalue should either be in the input section or bound to an expression
(Ln 97, Col 5) UnboundDeclaration, Int? max_hsps should either be in the input section or bound to an expression
(Ln 99, Col 5) UnboundDeclaration, String? taxids should either be in the input section or bound to an expression
(Ln 100, Col 5) UnboundDeclaration, String? negative_taxids should either be in the input section or bound to an expression
task runblastp
(Ln 133, Col 5) UnboundDeclaration, String docker should either be in the input section or bound to an expression
(Ln 134, Col 5) UnboundDeclaration, File Queryfa should either be in the input section or bound to an expression
(Ln 135, Col 5) UnboundDeclaration, String Fname should either be in the input section or bound to an expression
(Ln 137, Col 5) UnboundDeclaration, Int outfmt should either be in the input section or bound to an expression
(Ln 138, Col 5) UnboundDeclaration, String Outfile should either be in the input section or bound to an expression
(Ln 139, Col 5) UnboundDeclaration, Float evalue should either be in the input section or bound to an expression
(Ln 140, Col 5) UnboundDeclaration, Int threads should either be in the input section or bound to an expression
(Ln 148, Col 5) UnboundDeclaration, Int? max_hsps should either be in the input section or bound to an expression
(Ln 149, Col 9) UnboundDeclaration, String? taxids should either be in the input section or bound to an expression
(Ln 150, Col 9) UnboundDeclaration, String? negative_taxids should either be in the input section or bound to an expression
task runblastx
(Ln 180, Col 5) UnboundDeclaration, File Queryfa should either be in the input section or bound to an expression
(Ln 181, Col 5) UnboundDeclaration, String Fname should either be in the input section or bound to an expression
(Ln 182, Col 5) UnboundDeclaration, Int outfmt should either be in the input section or bound to an expression
(Ln 183, Col 5) UnboundDeclaration, Float evalue should either be in the input section or bound to an expression
(Ln 184, Col 5) UnboundDeclaration, String Outfile should either be in the input section or bound to an expression
(Ln 185, Col 5) UnboundDeclaration, String docker should either be in the input section or bound to an expression
(Ln 186, Col 5) UnboundDeclaration, Int threads should either be in the input section or bound to an expression
(Ln 194, Col 9) UnboundDeclaration, String? taxids should either be in the input section or bound to an expression
(Ln 195, Col 9) UnboundDeclaration, String? negative_taxids should either be in the input section or bound to an expression
(Ln 196, Col 5) UnboundDeclaration, Int? max_hsps should either be in the input section or bound to an expression
task runtblastn
(Ln 227, Col 5) UnboundDeclaration, File Queryfa should either be in the input section or bound to an expression
(Ln 228, Col 5) UnboundDeclaration, String Fname should either be in the input section or bound to an expression
(Ln 229, Col 5) UnboundDeclaration, Int outfmt should either be in the input section or bound to an expression
(Ln 230, Col 5) UnboundDeclaration, Float evalue should either be in the input section or bound to an expression
(Ln 231, Col 5) UnboundDeclaration, String Outfile should either be in the input section or bound to an expression
(Ln 232, Col 5) UnboundDeclaration, String docker should either be in the input section or bound to an expression
(Ln 233, Col 5) UnboundDeclaration, Int threads should either be in the input section or bound to an expression
(Ln 242, Col 5) UnboundDeclaration, Int? max_hsps should either be in the input section or bound to an expression
(Ln 243, Col 5) UnboundDeclaration, String? taxids should either be in the input section or bound to an expression
(Ln 244, Col 9) UnboundDeclaration, String? negative_taxids should either be in the input section or bound to an expression
task runtblastx
(Ln 274, Col 5) UnboundDeclaration, File Queryfa should either be in the input section or bound to an expression
(Ln 275, Col 5) UnboundDeclaration, String Fname should either be in the input section or bound to an expression
(Ln 276, Col 5) UnboundDeclaration, Int outfmt should either be in the input section or bound to an expression
(Ln 277, Col 5) UnboundDeclaration, String Outfile should either be in the input section or bound to an expression
(Ln 278, Col 5) UnboundDeclaration, String threads should either be in the input section or bound to an expression
(Ln 279, Col 5) UnboundDeclaration, Float evalue should either be in the input section or bound to an expression
(Ln 280, Col 5) UnboundDeclaration, String docker should either be in the input section or bound to an expression
(Ln 281, Col 9) UnboundDeclaration, String? taxids should either be in the input section or bound to an expression
(Ln 287, Col 9) UnboundDeclaration, String? negative_taxids should either be in the input section or bound to an expression
(Ln 288, Col 5) UnboundDeclaration, Int? max_hsps should either be in the input section or bound to an expression
I think we need to figure out first why miniwdl
is complaining about your file. I tried adding a version header to specify 1.0, but it did not change the error.
Hi @kinow
Thanks for your help, I have add the version header with version draft-2
,
but tried to validate blast.wdl file still failed.
blast.wdl
workflow blast
if
call runblastp
if
call runblastn
if
call runblastx
if
call runtblastn
if
call runtblastx
(Ln 69, Col 30) StringCoercion, input String threads = :Int:
task runblastn
task runblastp
task runblastx
task runtblastn
task runtblastx
* Suggestion: install shellcheck (www.shellcheck.net) to check task commands. (--suppress CommandShellCheck suppresses this message)
Ah, I think these are warnings, if you change the threads
type to Int
in the runtblastx
task the StringCoercion
warning will go away.
I'm looking at our code now to understand the error now. Looks like your WDL workflow is valid but we are calling an attribute on the Apply
that doesn't exist (exactly as the error message suggests).
Here's the file I have after changing the formatting and the type of that threads variable: https://gist.github.com/kinow/25f0d01ae6fe3e6b311a8dd49d06529f
Right, looks like at the moment our translation assumes the outputs are referencing the output of tasks or are int/string/etc.
It doesn't appear to be handling expressions like Apply
(that select_first
is an Apply
for miniwdl
). I think the select_first
is handled when it appears in other parts of the WDL file, so might be a matter of just applying similar logic in the output
content now.
Thanks for your suggesstion! I will try to modify the relevant logic in the output
content and gives a result.
Nice, I will take a look tomorrow too if I have time (we have a CWL APAC meeting at NZ lunch time that I help organize, so might be a bit busy). If you manage to find a fix, feel free to submit a pull request @admi2u 🙇 thanks!!!
I couldn't find a license in your repository @admi2u . Is it OK to add your blast.wdl
file to our unit tests?