nextflow icon indicating copy to clipboard operation
nextflow copied to clipboard

Support named channel inputs for processes and workflows

Open nh13 opened this issue 4 years ago • 5 comments

New feature

I would like to have the DSL2 support specifying the channels for processes and workflows via keywords. Some workflows I've written require many channels (5, 10, even 20!). It's hard to make sure that the order I specify is the same as the order I require.

Usage scenario


workflow foo {
    take:
    ch_in_1
    ch_in_2
    ...
    ch_in_100

    main:
    ...
}

workflow bar {
    ch_in_1   = Channel.from(...)
    ch_in_2   = Channel.from(...)
    ...
    ch_in_100 = Channel.from(...)

    ...
    foo(
        ch_in_1:    ch_in_1,
        ch_in_2:    ch_in_2,
        ....
        ch_in_100:  ch_in_100,
    )
}

Suggest implementation

?

nh13 avatar Aug 09 '21 23:08 nh13

This is a good point. Now that DSL2 allows named outputs it makes sense to have named input arguments as well

pditommaso avatar Aug 11 '21 19:08 pditommaso

@pditommaso how can I help contribute a PR for this? Is there a good place in the code to start looking?

nh13 avatar Oct 28 '21 03:10 nh13

Allowing this for workflows, we should do the same for processes.

The entry point should the workflow run

https://github.com/nextflow-io/nextflow/blob/7f91ecb39618b1327d5dc3d7aac9f9049159baff/modules/nextflow/src/main/groovy/nextflow/script/WorkflowDef.groovy#L166-L178

and process run

https://github.com/nextflow-io/nextflow/blob/7f91ecb39618b1327d5dc3d7aac9f9049159baff/modules/nextflow/src/main/groovy/nextflow/script/ProcessDef.groovy#L164-L164

Nice to know is that named params in groovy are just mapped to a LinkedHashMap, therefore the run method would receive a single argument of that type.

Think right now, this could open a potential ambiguity with existing code which may already invoke a workflow/process with a single map argument.

pditommaso avatar Oct 28 '21 08:10 pditommaso

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[bot] avatar Mar 27 '22 20:03 stale[bot]

I should circle back to this. Keeping it open.

nh13 avatar Mar 27 '22 20:03 nh13