jhuapl-bio / taxtriage

TaxTriage is a Nextflow workflow designed to agnostically identify and classify microbial organisms within short- or long-read metagenomic NGS data. This flexible tool was developed with various use-cases of mNGS in mind.
MIT License
21 stars 4 forks source link

Porechop causes workflow to fail if nothing trims from a sample #58

Closed Merritt-Brian closed 1 month ago

Merritt-Brian commented 7 months ago

Description of the bug

If a sample doesn't contain any trimmable reads, the file remains the same and the output is not emitted. This makes the pipeline fail. Make the output optional if it fails so the workflow can continue by reverting the next step to use the original fastq file

Command used and terminal output

No response

Relevant files

No response

System information

No response

fanninpm commented 2 months ago

Here's a temporary fix for the script block in the porechop/main.nf file:

porechop \\
    -i $reads \\
    -t $task.cpus \\
    $args \\
    -o ${prefix}.tmp.fastq.gz

if [ -s ${prefix}.tmp.fastq.gz ]
then
    mv ${prefix}.tmp.fastq.gz ${prefix}.fastq.gz
else
    rm ${prefix}.tmp.fastq.gz
    cp $reads ${prefix}.fastq.gz
fi

# etc.

You would also need to manipulate the task.ext.prefix variable in the configuration file. Apparently Nextflow excludes input files when it looks for output files, at least on version 24.04.4.

I suggest reporting this problem upstream to nf-core, because, as the saying goes, "there's nothing more permanent than a temporary fix".

Merritt-Brian commented 1 month ago

thanks @fanninpm, added to pipeline with commit: f54c74224d20040e81df88453a0d07a6a467bfff. Closing