【问题标题】:Nextflow : Is it possible to tranform a queue channel to a value channel?Nextflow:是否可以将队列通道转换为价值通道?
【发布时间】:2019-01-02 17:20:07
【问题描述】:

我有一个进程A,它将文件输出到通道outA。我想将该文件用作 3 个下游进程 BCD 的输入。由于创建的频道outA默认是队列频道,所以我不能直接多次使用该文件(与价值频道不同)。

目前,我使用into 运算符复制频道outA,如here 所述(参见下面的代码)。

我还知道您可以通过执行Channel.value(file('/path/to/file.txt')) 从文件创建价值渠道。

我目前的代码:

// Upstream process creating a queue channel with one file
process A {
    output:
        file outA
    "echo 'Bonjour le monde !' > $outA"
}

// Queue channel triplication
outA.into {inB; inC; inD}

// Downstream processes all using the same file
process B {
    input:
        file inB
    "script of process B $inB"
}

process C {
    input:
        file inC
    "script of process C $inC"
}

process D {
    input:
        file inD
    "script of process D $inD"
}

我工作正常,但我想知道是否可以将队列通道outA 转换为值通道,以便我可以使用相同的通道作为进程 B、C 和 D 的输入.

【问题讨论】:

    标签: nextflow


    【解决方案1】:

    您可以使用first() 运算符来执行此操作,例如:

    inX = outA.first()
    
    process B {
        input:
            file inX
        "script of process B $inX"
    }
    
    etc
    

    另请注意,当流程没有输入(如流程 A)时,其输出隐含的价值通道。

    【讨论】:

      猜你喜欢
      • 2022-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-15
      • 1970-01-01
      • 2020-08-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多