brentp / slivar

genetic variant expressions, annotation, and filtering for great good.
MIT License
247 stars 23 forks source link

argument parser doesn't handle `=` in --arg=value #140

Open tedil opened 1 year ago

tedil commented 1 year ago

Given an invocation of slivar such as slivar expr --info="INFO.some_integer >= 2" -v slivar-example.vcf, a syntax error occurs:

duko.nim(71) compile Error: unhandled exception: SyntaxError: parse error (line 1) expression was:'INFO.some_integer <' [ValueError]

However, replacing >= with > works as expected (same for <= and <).

slivar version: 0.2.7 71af7d12881ae0590c6d2a97ef2b282cc93fe7c6 (installed via bioconda)

I have attached a small VCF file which can be used to reproduce this problem: slivar-example.vcf.txt

brentp commented 1 year ago

Can you use single quotes and let me know if the error persists:

slivar expr --info='INFO.some_integer >= 2' -v slivar-example.vcf

I think your shell might be interpreting before it gets to slivar.

tedil commented 1 year ago

Yes, I thought that is what was happening, too, but it happens with both single and double quotes, and both with bash and zsh.

brentp commented 1 year ago

Oh, I see, you can't use --info=... just use `--info '...' so:

slivar expr --info 'INFO.some_integer >= 2' -v slivar-example.vcf
tedil commented 1 year ago

Ah, I see, that indeed solves the issue! The CLI help explicitly states --info='...'. If that is not intended, the help page should reflect that (and error on incorrect usage).

brentp commented 1 year ago

Indeed it does. That's a PITA. It's from the argument parser that I'm using.