bio-raum / FooDMe2

A nextflow pipeline for the identification of species from mixed samples based on mitochondrial amplicons
https://bio-raum.github.io/FooDMe2/
GNU General Public License v3.0
1 stars 1 forks source link

Re-write FooDMe scripts for cli use #2

Closed marchoeppner closed 4 months ago

marchoeppner commented 6 months ago

Most FooDMe scripts are integrated into the snakemake workflow and don't use traditional I/O interfacing. We need to re-write the relevant scripts to use.e.g argparse so files and options can be specified from the command line.

See: https://github.com/bio-raum/FooDMe2/blob/dev/bin/filter_blast.py

gregdenay commented 6 months ago

I cleaned up this script to have a well-formatted template. How does nextflow handles logging for scripts? Does it log stdout by default or do we need to add logging in the python scripts?

marchoeppner commented 5 months ago

Since nextflow processes are, technically, wrapped "bash" calls, logging would work like you'd expect (abbreviated code example):

input:
path(foo.txt)

output:
path(faa.txt), emit: faa
path(my_log.txt), emit: log

script:
"""
python my_script.py --input foo.txt --output faa.txt 2> my_log.txt
"""

Or you could make the log file a command line argument also (--log my_log.txt).

Nextflow does capture STDOUT and STDERR by default - although it only stores them for debugging purposes inside the respective work directory as hidden files (.command.err and .command.log)