如何打造文件的价值通道?
How to create a value channel of files?
如何将文件输入添加到多个并行进程?
我想做这样的事情:
proteins = Channel.fromPath( '/some/path/*.fa' )
executions = Channel.from(1, 2, 3, 4)
process blastThemAll {
input:
val num from executions
file query_file from proteins
"blastp -query ${query_file} -db nr"
}
我想要 4 个进程,每个进程都可以访问蛋白质通道中的所有文件。基本上,我希望蛋白质通道成为包含文件列表的价值通道。
我找不到怎么做...
您可以使用 collect 运算符,它将通道发出的所有项目收集到列表中,并且 return 生成的对象作为唯一发射。
A value channel is created using the value factory method or by
operators returning a single value, such us first, last, collect,
count, min, max, reduce, sum.
例如:
proteins = Channel.fromPath( '/some/path/*.fa' ).collect()
executions = Channel.from(1, 2, 3, 4)
process blastThemAll {
tag { "job ${num}" }
input:
val num from executions
path query_file from proteins
"""
find . -name '*.fa'
"""
}
和运行与:
nextflow run -ansi-log false test.nf
结果:
N E X T F L O W ~ version 21.04.3
Launching `test.nf` [gloomy_mclean] - revision: 53ee46a154
[c9/6da993] Submitted process > blastThemAll (job 4)
[0e/24cc9b] Submitted process > blastThemAll (job 1)
[43/c500eb] Submitted process > blastThemAll (job 2)
[6b/d75ce4] Submitted process > blastThemAll (job 3)
如何将文件输入添加到多个并行进程?
我想做这样的事情:
proteins = Channel.fromPath( '/some/path/*.fa' )
executions = Channel.from(1, 2, 3, 4)
process blastThemAll {
input:
val num from executions
file query_file from proteins
"blastp -query ${query_file} -db nr"
}
我想要 4 个进程,每个进程都可以访问蛋白质通道中的所有文件。基本上,我希望蛋白质通道成为包含文件列表的价值通道。
我找不到怎么做...
您可以使用 collect 运算符,它将通道发出的所有项目收集到列表中,并且 return 生成的对象作为唯一发射。
A value channel is created using the value factory method or by operators returning a single value, such us first, last, collect, count, min, max, reduce, sum.
例如:
proteins = Channel.fromPath( '/some/path/*.fa' ).collect()
executions = Channel.from(1, 2, 3, 4)
process blastThemAll {
tag { "job ${num}" }
input:
val num from executions
path query_file from proteins
"""
find . -name '*.fa'
"""
}
和运行与:
nextflow run -ansi-log false test.nf
结果:
N E X T F L O W ~ version 21.04.3
Launching `test.nf` [gloomy_mclean] - revision: 53ee46a154
[c9/6da993] Submitted process > blastThemAll (job 4)
[0e/24cc9b] Submitted process > blastThemAll (job 1)
[43/c500eb] Submitted process > blastThemAll (job 2)
[6b/d75ce4] Submitted process > blastThemAll (job 3)