nf-core / rnaseq

RNA sequencing analysis pipeline using STAR, RSEM, HISAT2 or Salmon with gene/isoform counts and extensive quality control.
https://nf-co.re/rnaseq
MIT License
923 stars 708 forks source link

Helpful error message when strandedness cannot be infered #1390

Closed simoxb closed 1 month ago

simoxb commented 2 months ago

Description of feature

When running the rnaseq workflow wit the infer_strandedness step, it came to my attention that when neither the stranded_threshold nor the unstranded_threshold is reached, the workflow aborts with the following error message:

ERROR ~ No such variable: strandedness

 -- Check script 'rnaseq/workflows/rnaseq/../../subworkflows/local/utils_nfcore_rnaseq_pipeline/../../nf-core/fastq_qc_trim_filter_setstrandedness/main.nf' at line: 38 or see '.nextflow.log' file for more details
ERROR ~ Pipeline failed. Please refer to troubleshooting docs: https://nf-co.re/docs/usage/troubleshooting

 -- Check '.nextflow.log' file for details

This is because of the following code snippet in rnaseq/subworkflows/nf-core/fastq_qc_trim_filter_setstrandedness/main.nf:

        if (forwardProportion >= stranded_threshold) {
            strandedness = 'forward'
        } else if (reverseProportion >= stranded_threshold) {
            strandedness = 'reverse'
        } else if (proportionDifference <= unstranded_threshold) {
            strandedness = 'unstranded'
        }

If neither threshold is reached, the strandedness variable isn't initialized, leading to the workflow crashing. I think a more helpful error message would be great here, or maybe even a standard value of the strandedness variable to prevent the workflow from crashing?

PS: Not sure if this is a bug or a feature request.

mdozmorov commented 1 month ago

I experienced the same error, for the first time after many successful runs. The error message, No such variable: strandedness, is confusing, would be helpful to have more informative one

JaeungJayJang commented 1 month ago

I just faced this problem as well while using the workflow. I checked the code and found that there is a variabled called library_strandedness that is not called within the file. was this meant to be the default variable for another variabled called strandedness? @pinin4fjords, Can I ask what this variable do?

    def library_strandedness = 'undetermined'
pinin4fjords commented 1 month ago

Ahh, thanks for flagging this everyone. I'll push a fix ASAP.

pinin4fjords commented 1 month ago

https://github.com/nf-core/modules/pull/6763

pinin4fjords commented 1 month ago

Addressed in https://github.com/nf-core/rnaseq/pull/1405