I have a Nextflow module that runs a python script from bin folder to check sample input, it makes assertion errors if theres anything wrong with the input, but I can’t seem to get these errors to print to the logging output that appears when you run the pipeline or to print in the .nextflow.log - I checked another nf-core pipeline and they seem to use AssertionErrors so not sure what I need to do here?
You can use log.info, log.warn and log.error to print to the standard output and register the event/message to the Nextflow log file. Is this what you’re looking for? If you can share a minimal reproducible example, I can try to work out a solution for your specific case.
do you mean logger.error in the python script? or are you talking about having something in the nextflow module code itself?
could you possibly link me to somewhere this is done eg. in nfcore for example? I checked nfcore/rnaseq but I don’t understand how the input spreadsheet is checked now, theres no module that does this anymore, instead it appears to be a groovy function but unclear where this is defined: WorkflowRnaseq.validateInput(it)
I also checked nf-core/rnasplice - I am basically doing it exactly as they do with the SAMPLESHEET_CHECK module and check_samplesheet_fastq.py has assertion errors in it.
It’s a Nextflow function that should be placed in Nextflow script files, and nf-core pipelines do that with Groovy functions. You can also capture the stdout/stderr from the Python script and print it from the process (setting the debug process directive to true, for example).
Hrmm setting debug to true in my process still isn’t passing on the AssertionError.
Sorry I know a minimal example would be more helpful but that would take hours to put together because theres so many layers to this. main.nf → input_check.nf → samplesheet_check.nf → python script
I’d be grateful if you could point me to an nf-core pipeline that is doing this in the way you suggest - like I said I’ve implemented it like rnasplice/modules/local/samplesheet_check.nf at f70bbce27cbade36f993a7e39fa6e574fc4c6d3a · nf-core/rnasplice · GitHub and its not working. I don’t know any groovy so would be a bit difficult for me to reimplement the python as groovy functions, but if you could link me to where in the rnaseq code this is happening I could try to emulate it
So I identified that actually the python script isn’t being run at all, but there are no errors output about that, the only error is that the next process doesn’t have its input. So now I need to figure out why the script isn’t being run
Just to clarify, if your Python script raises an error the traceback will be added to the .nextflow.log. If it runs successfully these logs will not surface in the Nextflow log file.
Sorry this has been a total wild goose chase. My original error actually was elsewhere but now get this error trying to run the python script: .command.sh: /Users/capitac/repos/nfcore-clipseq/bin/samplesheet_fastq_check.py: /usr/bin/env: bad interpreter: Permission denied
I have tried #!/usr/bin/env python3 and #!/usr/bin/env python at the start of my python script but neither work - any ideas?