Is there any way to easily save logs coming from snakemake rule executing python script with the script
directive? The script uses libraries, which already have some integrated logging, and I want to store their logs. I do not want to use shell
or run
directive as they both are not so comfortable, when working with python scripts. In addition, I hope that the answer will ask for minimum changes in the python scripts, the main changes being in the Snakemake
file. Here is the example of code:
rule correcting_ids:
input:
"assembly_{type}/{sample}/{dataset}/final.fasta"
output:
"assembly_{type}/{sample}/{dataset}/final.corrected.fasta"
log:
"logs/{sample}/correct_{type}_ids_{dataset}.log"
script:
"scripts/correcting_ids.py"```
You could redirect all stdout and stderr to the logfile
python:
R: