3

我是 Nextflow 的新手,我尝试在 Nextflow 中运行 Python 脚本。因此,我将 Python 脚本存储在与 Nextflow 管道相同的文件夹中并尝试运行它,但我总是收到此错误:.command.sh: line 2: ./example.py: No such file or directory. 有没有人遇到过同样的问题并且有能力解决它?

我的流程如下所示:

#!/usr/bin/env nextflow

input_ch = Channel.fromPath('data/*.txt')

process foo {

    input:
    file x from input_ch

    output:
    file "$x" into outputt_ch

    """
    ./example.py ${x}
    """

}

PS:我的 Python 脚本可以从终端执行!

先感谢您!

4

2 回答 2

3

Nextflow 在单独的工作目录中运行每个任务。因此./example.py不会工作。您必须使用example.py并使脚本可通过系统访问PATH或将其复制到项目bin/目录中。

于 2020-07-27T10:05:10.927 回答
1

另一种解决方案是使用projectDir变量。例如,

#!/usr/bin/env nextflow

input_ch = Channel.fromPath('data/*.txt')
project_dir = projectDir

process foo {

    input:
    file x from input_ch

    output:
    file "$x" into outputt_ch

    """
    python $project_dir/example.py ${x}
    """

}
于 2020-10-13T19:09:57.950 回答