0

As per the Nextflow documentation I put my awk scripts in the bin/ folder. Some scripts share the same functions so I wrote a file with only awk functions that I usually include using:

@include "relative/path/to/lib.awk"

But because the script runs in the nextflow work directory the relative path doesn't work anymore. I tried to put the library file in bin/ too but it didn't work as well.

How should I proceed? I don't want to copy/paste functions in the scripts, I also don't want to hardcode an absolute path.

4

1 回答 1

1

感谢@Pallie 提供有关workflow.projectDir. 关于这个变量的文档在这里(我想我到处找,不清楚我能做到这一点),这个答案也有帮助:https ://stackoverflow.com/a/28463193/2849598 。

awk 可以加载库文件AWKPATH,我有我的文件lib/,用于下一个流程:

process my_process {
  input:
  path input from input_channel

  output:
  path "output.txt"

  script:
  """
  export AWKPATH="$workflow.projectDir/lib"
  script.awk ${input} > output.txt
  """
}

在我的脚本的顶部,我像这样调用库文件

@include "my_functions.awk"
于 2019-11-15T18:11:57.820 回答