MissingOutputException snakemake

192 Views Asked by At

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

There are 1 best solutions below

2
On BEST ANSWER

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.