mbhall88 / rasusa

Randomly subsample sequencing reads or alignments
https://doi.org/10.21105/joss.03941
MIT License
203 stars 17 forks source link

Error when using --output twice #70

Closed pmielle closed 4 months ago

pmielle commented 4 months ago

hello,

I think there is a cli argument parsing bug in v1.0.0:

$ rasusa reads -n 10 -o sample1.fastq -o sample2.fastq read1.fastq read2.fastq

yields the following error:

Error: Bad combination of input and output files: Got more than 2 files for output.

n.b. specifying -o sample1.fastq sample2.fastq seems to work as expected

(Thank you for your work on rasusa!)

mbhall88 commented 4 months ago

Ahhh thank you for picking this up @pmielle. Can't believe I didn't think to test this.

I have added a fix which will require a major version bump unfortunately. Essentially, -o must be passed twice now and can only take one file on each occurrence. Your command should work in v2.0.0 without needing to change anything. But the reason it doesn't work in v1.0.0 is that -o can take one or two files. So in your case it was trying to be greedy and take one file in the first usage and then two files in the second usage, giving three files.

pmielle commented 4 months ago

Thank you for fixing this, and doing it so fast too! I will upgrade to v2 as soon as I can Have a good one