从两个通道中的任意一个获取过程输入

时间:2021-07-08 05:49:40

标签: nextflow

如何允许进程从具有互斥运行条件的进程输出的两个通道之一获取输入?例如,类似于:

params.condition = false

process a {
    output:
    path "a.out" into a_into_c

    when:
    params.condition == true

    """
    touch a.out
    """
}

process b {
    output:
    path "b.out" into b_into_c

    when:
    params.condition == false

    """
    touch b.out
    """
}

process c {
    publishDir baseDir, mode: 'copy'

    input:
    path foo from a_into_c or b_into_c

    output:
    path "final.out"

    """
    echo $foo > final.out
    """
}

如果 params.condition 为真,则 final.out 将包含 a.out(例如,在命令行中给出 --condition),如果为假则为 b.out

1 个答案:

答案 0 :(得分:1)

您可以为此使用 mix operator


<img id="picture" src="data:image/png;base64,{{ img_data }}">