Skip to content

Dynamic output using file input #2544

Answered by manuelesimi
ssadedin asked this question in Q&A
Discussion options

You must be logged in to vote

I think your closure is a fair enough solution.

However, unless you have some external requirements not shown here, you can simply assign the same name to the output file as follows:

    input:
        file   test_fastq from fastq
        
    output:
        path("filename.bam") into aligned_bam
        
    script:
        """
           ... some command ... >  filename.bam
        """

This way you don't have to do the mapping at all.
Nextflow would take care of passing it to the next process without any conflict.

This works also if you publish all these bams in the same folder, because you can always use the saveAs option of publishDir to rename them. It's really up to you.

But I wish…

Replies: 7 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by pditommaso
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #2530 on January 08, 2022 08:18.