Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Apply' object has no attribute 'expr' #200

Closed
admi2u opened this issue Jun 2, 2022 · 11 comments · May be fixed by #201
Closed

'Apply' object has no attribute 'expr' #200

admi2u opened this issue Jun 2, 2022 · 11 comments · May be fixed by #201

Comments

@admi2u
Copy link

admi2u commented Jun 2, 2022

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?

@kinow
Copy link
Member

kinow commented Jun 2, 2022

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.

@admi2u
Copy link
Author

admi2u commented Jun 2, 2022

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)

@kinow
Copy link
Member

kinow commented Jun 2, 2022

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).

@kinow
Copy link
Member

kinow commented Jun 2, 2022

Here's the file I have after changing the formatting and the type of that threads variable: https://gist.github.com/kinow/25f0d01ae6fe3e6b311a8dd49d06529f

@kinow
Copy link
Member

kinow commented Jun 2, 2022

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.

@admi2u
Copy link
Author

admi2u commented Jun 2, 2022

Thanks for your suggesstion! I will try to modify the relevant logic in the output content and gives a result.

@kinow
Copy link
Member

kinow commented Jun 2, 2022

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!!!

@kinow
Copy link
Member

kinow commented Jun 2, 2022

I couldn't find a license in your repository @admi2u . Is it OK to add your blast.wdl file to our unit tests?

@kinow
Copy link
Member

kinow commented Jun 2, 2022

Looks like my PR isn't producing a valid CWL yet @admi2u, so I marked the linked PR as draft. Thought it would be simpler to fix this issue, sorry 😬

@admi2u
Copy link
Author

admi2u commented Jun 6, 2022

I couldn't find a license in your repository @admi2u . Is it OK to add your blast.wdl file to our unit tests?

yes, feel free to use this file

@mr-c
Copy link
Member

mr-c commented Apr 24, 2024

Fixed in #243

@mr-c mr-c closed this as completed Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants