1

I am getting an MissingOutputException from my snakemake workflow, snakemake creates the required output in the desired directory but keeps looking for it and exits. this is my snakefile.

rule all:
    input:  
        expand('/home/stud9/NAS/results/qc_reports/fastqc/trimmed_{sample}_1_fastqc.html', sample=SAMPLES),
        expand('/home/stud9/NAS/results/qc_reports/fastqc/trimmed_{sample}_2_fastqc.html', sample=SAMPLES),
        expand('home/stud9/NAS/results/non_aligned/{sample}_nm2cov.bam', sample=SAMPLS)




rule nm2cov:
    input: 
        '/home/stud9/NAS/results/aligned/to_cov/{sample}_cov.sorted.bam'
    output:
        'home/stud9/NAS/results/non_aligned/{sample}_nm2cov.bam'
    shell:
        "cd /home/stud9/NAS/results/non_aligned && samtools view -b -f 4 {input} > {wildcards.sample}_nm2cov.bam"

I have used cd before the actual cmd because I want my results there otherwise they would show in the snakefile directory.

This is the messsage I am getting:

Waiting at most 10 seconds for missing files.
MissingOutputException in rule nm2cov  in line 50 of /home/stud9/NAS/scripts/wf_1:
Job Missing files after 10 seconds. This might be due to filesystem latency. If that is the case, consider to increase the wait time with --latency-wait:
home/stud9/NAS/results/non_aligned/148_nm2cov.bam completed successfully, but some output files are missing. 55
Shutting down, this might take some time.

sorry if my post is a little bit messy but this is the first time I post here

tried changing --latency-wait to 15 still no response.

1 Answers1

1

A MissingOutputException can be easily caused by typos or wrong paths for the output files.

In your case a preceeding / seems to be missing, causing snakemake to consider your output path to be relative rather than absolute.

Try this:


rule nm2cov:
    input: 
        '/home/stud9/NAS/results/aligned/to_cov/{sample}_cov.sorted.bam'
    output:
        '/home/stud9/NAS/results/non_aligned/{sample}_nm2cov.bam'
    shell:
        "cd /home/stud9/NAS/results/non_aligned && samtools view -b -f 4 {input} > {wildcards.sample}_nm2cov.bam"

NB: It is generally recommended to use relative paths rather than absolute paths for your Snakefile to keep the reproducibility of your workflow.

euronion
  • 1,142
  • 6
  • 14
  • 1
    these typos are really annoying. thank you for the clarification. I feel dumb though. and one more thing what do you mean by relative paths and absolute paths, I still struggle understanding these. and how to do it? is it by assigning paths to variables? – Ralph matar Jan 03 '23 at 17:05
  • Doh!!! This was very annoying and I only had a closer look at my final shell command and spotted my typo after reading your answer. Thanks! – KolaB May 06 '23 at 08:36