Error caused by missing output files while running Nextflow

Viewed 126

I have an error when i run nextflow consist of the following sentence

Error executing process > 'BWA_INDEX (Homo_sapiens_assembly38_chr1.fasta)'

Caused by:

Missing output file(s) FASTA.* expected by process 'BWA_INDEX(Homo_sapiens_assembly38_chr1.fasta)'

I use the following script.

#!/usr/bin/env nextflow

params.PublishDir = "/home/nextflow_test/genesFilter"
params.pathFasta = "/home/nf-core/references/Homo_sapiens/GATK/GRCh38/Sequence/WholeGenomeFasta/Homo_sapiens_assembly38_chr1.fasta"

InputFasta = file(params.pathFasta)

process BWA_INDEX {

tag {InputFasta.name}

publishDir (
path: "${params.PublishDir}",
    mode: 'copy',
    overwrite: 'true',
    saveAs: "${params.PublishDir}/${it}"
)

input:
path InputFasta

output:
file("FASTA.*") into bwa_indexes

script:
"""
bwa-mem2 index "${InputFasta}"
"""
}

ch_bwa = bwa_indexes

Nevertheless into the work directory (specified after the error sentence) the process does work correctly and the output files are generated but not on my desire output directory. I tried to replace the "file" by the "path" on the script in the line:

output:
file("FASTA.*")

As well as replace "FASTA.* " for "${params.PublishDir}/FASTA.*" but the error still appears. I don't know exactly why it happens. ¿Maybe could be due to the use of params to specify the inputs and outputs?

Thanks in advance!

1 Answers

Missing output file(s) FASTA.* expected by process 'BWA_INDEX(Homo_sapiens_assembly38_chr1.fasta)'

Nextflow is expecting files matching the glob pattern FASTA.* in the working directory, but they could not be found when the process exited (successfully). You just need to tell Nextflow what files to expect in your output declaration. The files that bwa-mem2 index Homo_sapiens_assembly38_chr1.fasta should have created might look like:

Homo_sapiens_assembly38_chr1.fasta.0123
Homo_sapiens_assembly38_chr1.fasta.amb
Homo_sapiens_assembly38_chr1.fasta.ann
Homo_sapiens_assembly38_chr1.fasta.bwt.2bit.64
Homo_sapiens_assembly38_chr1.fasta.bwt.8bit.32
Homo_sapiens_assembly38_chr1.fasta.pac

The following output declaration should be sufficient to find these files:

output:
path("${InputFasta}.*") into bwa_indexes

Note that only files that are declared in your output block are published to the publishDir. Also, the 'saveAs' publishDir parameter must be a closure for it to work correctly. You will need to fix this (or just remove the line entirely) to make your example work.

Related