Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run Python Script in Nextflow

I'm new to Nextflow and I tried to run a Python Script in Nextflow. So I stored the Python Script in the same Folder as the Nextflow Pipeline and tried to run it but I always get this error: .command.sh: line 2: ./example.py: No such file or directory. Does anybody encountered the same problem and was capable to solve it?

My Process looks like this:

#!/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}
    """

}

P.S.:My Python Script is executable from the Terminal!

Thank you in advance!

like image 239
TomHanks Avatar asked Jan 30 '26 08:01

TomHanks


1 Answers

Nextflow runs each task in a separate working directory. Therefore ./example.py won't work. You have to use example.py and make the script accessible through the system PATH or copy it into the project bin/ directory.

like image 61
pditommaso Avatar answered Feb 01 '26 01:02

pditommaso



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!