【问题标题】:Take process input from either of two channels从两个通道中的任何一个获取过程输入
【发布时间】:2021-09-18 14:28:28
【问题描述】:

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

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

【问题讨论】:

    标签: nextflow


    【解决方案1】:

    您可以为此使用mix operator

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

    【讨论】:

      猜你喜欢
      • 2015-12-14
      • 1970-01-01
      • 1970-01-01
      • 2020-11-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-11
      • 2010-12-11
      相关资源
      最近更新 更多