如何指示 nextlow 在哪里输出?

How to indicate to nextlow where takes output?

我在 python 中有一个脚本,可以将文件保存在特定目录中。

例如此代码名为 "write.py":

with open("project/results/txt/output.txt", "w") as f:
    f.write("this is a txt file")

所以我在 "project/src" 中执行我的脚本,这个脚本的输出在 "project/results/txt/".

这里是 "project/" 中的 Nextflow 脚本示例:

process writeTxt{
    output:
    file "output.txt"

    """
    python3 ../../../src/write.py 
    """
}

"../../../" ==> 退出工作目录

但是 nextflow return 它没有找到 "projet/results/txt/output.txt"。

那么如何向 Nextflow 指示脚本的输出在哪里?

这是一个反模式。 Nextflow 任务应在任务执行目录中生成和使用文件。如果此类输出文件是由上游任务生成的,则必须将其声明为任务输出以使其在任务工作目录中可访问。