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

Include module statement inside a conditional statement throws error when run as a subworkflow #2162

Closed
JoseEspinosa opened this issue Jun 9, 2021 · 3 comments
Milestone

Comments

@JoseEspinosa
Copy link
Contributor

JoseEspinosa commented Jun 9, 2021

Bug report

Expected behavior and actual behavior

When a module include is in a conditional statement it gives an exception if it's run as a subworkflow but not it is run as the main.

Steps to reproduce the problem

I created this repo to reproduce the issue.

If this script is run as the main it works.

git clone https://github.com/JoseEspinosa/nxf_issue_conditional_include.git
cd workflows/
nextflow run my_pipeline.nf

However, if it is run from the parent directory with this script then it throws an exception.

cd..
nextflow run main.nf

The problem is on this line which has an include inside the if statement. But the behavior is not consistent when running it as a subworkflow or as the main script.

Program output

N E X T F L O W  ~  version 21.04.0
Launching `main.nf` [condescending_mahavira] - revision: 71cf30c291
No such file: Can't find a matching module file for include: ./modules/foo/main.nf

 -- Check script './workflows/my_pipeline.nf' at line: 10 or see '.nextflow.log' file for more details

nextflow.log

Environment

  • Nextflow version: [21.04.0 build 5552]
  • Java version: [1.8.0_65]
  • Operating system: [macOS]
  • Bash version: (use the command $SHELL --version)[GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)]
@pditommaso
Copy link
Member

Include should not go into workflow. This is not expected to be supported in any way.

@JoseEspinosa
Copy link
Contributor Author

The snipped below works, it is ok or it would be better just to have the include outside any conditional closure?

if (!params.skip_foo) {
    include { FOO } from './modules/foo/main.nf'
}

workflow MY_PIPELINE {    
      
     if (!params.skip_foo) {
         FOO()               
     }
}

@pditommaso
Copy link
Member

Just killed this 7dbf64b. Thanks Jose for reporting.

@pditommaso pditommaso added this to the v21.10.0 milestone Jun 17, 2021
pditommaso pushed a commit that referenced this issue Dec 24, 2021
Make clear that include must be outside of workflow definitions. This worked until 21.04.3 but then was disabled:

- #2519
- #2162
phue pushed a commit to phue/nextflow that referenced this issue Jan 25, 2022
Make clear that include must be outside of workflow definitions. This worked until 21.04.3 but then was disabled:

- nextflow-io#2519
- nextflow-io#2162
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

No branches or pull requests

2 participants