Thank you @Wayne for clarifying my query. Yes, I'm able to get the results correctly when I changed "script:" to "shell:". :-)
Hi everyone,
This is the first time I'm trying snakemake. I wrote the following code (I have used tab space before input:, output: and script:)
rule first_try:
input:
"data/samples/A.fastq"
output:
"output1/output2/output3/A.txt"
script:
"cat {input} | wc > {output}"
When I ran this code with "snakemake --cores 1 output1/output2/output3/A.txt", I'm getting the following error
Building DAG of jobs...
Using shell: /usr/bin/bash
Provided cores: 1 (use --cores to define parallelism)
Rules claiming more threads will be scaled down.
Job stats:
job count min threads max threads
--------- ------- ------------- -------------
first_try 1 1 1
total 1 1 1
Select jobs to execute...
[Mon May 1 14:40:34 2023]
rule first_try:
input: data/samples/A.fastq
output: output1/output2/output3/A.txt
jobid: 0
reason: Missing output files: output1/output2/output3/A.txt
resources: tmpdir=/tmp
[Mon May 1 14:40:34 2023]
Error in rule first_try:
jobid: 0
input: data/samples/A.fastq
output: output1/output2/output3/A.txt
Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
Complete log: .snakemake/log/2023-05-01T144033.399600.snakemake.log
Also, I notice the output folder (from output1 and all subfolders (output2 and output3)) is getting deleted automatically whenever I run snakemake. I could not understand why the output folder is getting deleted automatically. Could anyone please help me resolve this issue.
1 answer
Did you try the following?
rule first_try:
input:
"data/samples/A.fastq"
output:
"output1/output2/output3/A.txt"
shell:
"cat {input} | wc > {output}"
Note that in my suggestion I changed script on line 6 to shell.
As noted in the documentation here, script would be used as an action if you were pointing to an external script file.
You'd use run as an action if you were coding in Python code for that portion of the rule as covered here and under 'Using Python code as actions' at the bottom here in the The Carpentries draft lesson for Snakemake.
Log in to answer this question.