输出文件没有写入特定路径使用awk到nextflow进程



我想把AWK得到的不同输出的路径选择到一个nextflow进程中,但是我无法得到。通过在视图后编写$it,我可以在工作目录中获得输出,但我需要选择$PATH。我试图改变$it to "${PathOutdir}/test_out.csv",但不工作。这里我在nextflow进程中放入了一个简单的awk函数。我应该使用工作流功能吗?提前感谢!

PathFile = "/home/pvellosillo/nextflow_test/test.csv"
InputCsv = file(PathFile)
PathOutdir = "/home/pvellosillo/nextflow_test"
process genesFilter {
tag "PathInputFile:${PathFile}"
input:
path InputCsv
output:
file("test_out.csv") into out_filter
shell:
"""
#!/bin/bash
awk 'BEGIN{FS=OFS="t"}{print $2}' $InputCsv > "test_out.csv"
"""
}
out_filter.view {"${PathOutdir}/test_out.csv"}

从你上面的问题和评论:

注意,通过使用publishDir {$PathOutdir},我在a中得到一个输出选定的目录,但文件是到工作的符号链接目录而不是简单的文件

我认为您想要'copy'模式,以便声明的输出文件可以发布到publishDir。确保避免访问publishDir:

中的输出文件

异步复制文件到指定目录方式,所以他们可能不会立即在出版目录在进程执行结束时。出于这个原因,的方法访问输出文件发布目录,但是通过通道。

params.pathFile = "/home/pvellosillo/nextflow_test/test.csv"
params.publishDir = "/home/pvellosillo/nextflow_test"
InputCsv = file( params.pathFile )

process genesFilter {
tag { InputCsv.name }
publishDir(
path: "${params.publishDir}/genesFilter",
mode: 'copy',
)
input:
path InputCsv
output:
path "test_out.csv" into out_filter
shell:
'''
awk 'BEGIN { FS=OFS="\t" } { print $2 }' "!{InputCsv}" > "test_out.csv"
'''
}
out_filter.view()

还要注意shell脚本定义要求使用单引号'分隔的字符串。

最新更新