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

Add closure functionality to publishDir.enabled #3692

Closed
nvnieuwk opened this issue Feb 27, 2023 · 7 comments
Closed

Add closure functionality to publishDir.enabled #3692

nvnieuwk opened this issue Feb 27, 2023 · 7 comments
Labels

Comments

@nvnieuwk
Copy link

New feature

Hi! Thanks for using Nextflow and submitting the proposal
for a new feature or the enhancement of an existing functionality.

Please replace this text providing a short description of your
proposal.

Usage scenario

In some cases it is useful to be able to specify a closure with the publishDir.enabled attribute. (e.g. I have a meta list in my channel which contains a count of files in one family and I want to only output files that have a count of 1, because the other files will be merged in the next process). Currently the workaround is to use a closure in publishDir.saveAs and not outputting anything when the condition isn't met, but this does still create the folder specified in publishDir.path. Therefore I think it would be a nice addition to add the option of adding closures to the publishDir.enabled attribute.

Example in a config file:

withName: MODULE {
    publishDir = [
        enabled: { meta.count == 1 },
        path: { "${params.outdir}/${meta.id}" }
    ]
}
@bentsherman
Copy link
Member

For what it's worth, you might be able to specify that condition in both saveAs and path so that it doesn't always create the folder.

@nvnieuwk
Copy link
Author

Yeah you are right, but I think it will be more clear if I could specify it via the publishDir.enabled attribute. But that's a nice workaround for now, thank you!

@stale
Copy link

stale bot commented Aug 12, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Aug 12, 2023
@pditommaso
Copy link
Member

Closing in favour of #4186

@bentsherman
Copy link
Member

Not sure how #4186 will solve this issue, since this one is about allowing enabled to be dynamic where the new issue is about supporting global defaults.

@pditommaso
Copy link
Member

You are right. Also, considering there's a workaround, I still believe it is preferable to avoid the proliferation of dynamic config settings

@bentsherman
Copy link
Member

Agreed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants