1

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

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
    """
}

其中 final.out 将包含a.outparams.condition 是否为真(例如--condition在命令行上给出),以及b.out它是否为假。

4

1 回答 1

1

您可以为此使用混合运算符

process c {
    publishDir baseDir, mode: 'copy'

    input:
    path foo from a_into_c.mix(b_into_c)

    output:
    path "final.out"

    """
    echo $foo > final.out
    """
}
于 2021-07-08T06:31:00.613 回答