isugifNF / polishCLR

A nextflow pipeline for polishing CLR assemblies
https://isugifnf.github.io/polishCLR/
16 stars 4 forks source link

feat: throw an error on invalid flags #45

Closed j23414 closed 1 year ago

j23414 commented 1 year ago

Description

Nextflow will quietly ignore any misspelled or extra parameters. Since polishCLR sometimes requires quite a number of files/parameters, it was necessary to add an “unrecognized parameter” catch-all kind of error.

Right now the valid parameters are hardcoded:

https://github.com/isugifNF/polishCLR/blob/98b864ca3a2611fb33a1b544d74b70b127b48e90/main.nf#L100-L109

based on the answer given by this thread.

Issue

Related to issue(s) https://github.com/isugifNF/polishCLR/issues/37

Testing

If reviewer has a working nextflow install, a quick test can be run using empty input files and some non-existent flags:

mkdir data 
cd data
touch pri.fa alt.fa mit.fa ill_R1.fastq.bz2 ill_R2.fastq.bz2 pac.subreads.bam
cd ..

nextflow run isugifNF/polishCLR -r check_valid_params \
            --primary_assembly data/pri.fa \
            --alternate_assembly data/alt.fa \
            --mitochondrial_assembly data/mit.fa \
            --illumina_reads "data/ill_{R1,R2}.fastq.bz2" \
            --pacbio_reads data/pac.subreads.bam \
            --species "BugName" \
            --k "21" \
            --falcon_unzip true \
            --step 1 \
            -stub-run \
            -profile local \
            --other hi --mito "doesn't_exist"

Which should return:

N E X T F L O W  ~  version 22.04.5
Launching `https://github.com/isugifNF/polishCLR` [focused_sax] DSL2 - revision: 98b864ca3a [check_valid_params]
[Pipeline error] Parameter(s) [other, mito] is(are) not valid in the pipeline!
Astahlke commented 1 year ago

Awesome - Also would be great to include this in the RTD.

j23414 commented 1 year ago

Code conflict occurred because I put the "define valid params" code in the same place as the "check_software" code. I moved one before the other and it runs fine.

I also added an FAQ.md file to move documentation text. Feel free to move it to a more appropriate place in the RTD.