我有一个从文本文件创建变量的 nextflow 脚本,我需要将该变量的值传递给命令行命令(这是一个 bioconda 包)。这两个过程发生在“脚本”部分中。我尝试使用“$”符号调用变量而没有任何结果,我认为是因为在 nextflow 脚本的脚本部分中使用该符号是为了调用在输入部分中定义的变量。
为了让自己更清楚,这里是我想要实现的代码示例:
params.gz_file = '/path/to/file.gz'
params.fa_file = '/path/to/file.fa'
params.output_dir = '/path/to/outdir'
input_file = file(params.gz_file)
fasta_file = file(params.fa_file)
process foo {
//publishDir "${params.output_dir}", mode: 'copy',
input:
path file from input_file
path fasta from fasta_file
output:
file ("*.html")
script:
"""
echo 123 > number.txt
parameter=`cat number.txt`
create_report $file $fasta --flanking $parameter
"""
}
通过 doig 这个我收到的错误是:
Error executing process > 'foo'
Caused by:
Unknown variable 'parameter' -- Make sure it is not misspelt and defined somewhere in the script before using it
有没有办法parameter
在脚本中调用变量而不用 Nextflow 将其解释为输入文件?提前致谢!