mmcguffi / pLannotate

Webserver and command line tool for annotating engineered plasmids
GNU General Public License v3.0
103 stars 20 forks source link

feat: use defopt instead of click for parsing #29

Closed nh13 closed 1 year ago

nh13 commented 1 year ago

Note: defopt is very opinionated on the single and long flag namings, so there is some backwards incompatibility (e.g. --file-name versus --file_name).

jeffreybarrick commented 1 year ago

I'm leaving comments/decision/testing of this to @mmcguffi

My only comments are that I prefer the hyphen format for multiword options and that currently if I type plannotate batch I get an error versus the help message that I expected for running with no options.

nh13 commented 1 year ago

@jeffreybarrick what's the error you get? Did you remember to install the updated dependencies?

$ plannotate batch   
Running command: plannotatebatch
usage: plannotate batch [-h] -i INPUT [-o OUTPUT] [-f FILE_NAME] [-s SUFFIX] [-y YAML_FILE] [-l | --linear | --no-linear] [--html | --no-html] [-c | --csv | --no-csv] [-d | --detailed | --no-detailed] [-g | --gbk | --no-gbk]
plannotate batch: error: the following arguments are required: -i/--input
$ plannotate batch -h
usage: plannotate batch [-h] -i INPUT [-o OUTPUT] [-f FILE_NAME] [-s SUFFIX] [-y YAML_FILE] [-l | --linear | --no-linear] [--html | --no-html] [-c | --csv | --no-csv] [-d | --detailed | --no-detailed] [-g | --gbk | --no-gbk]

Annotates engineered DNA sequences, primarily plasmids. Accepts a FASTA or GenBank file and outputs
a GenBank file with annotations, as well as an optional interactive plasmid map as an HTLM file.

optional arguments:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        path to the input FASTA or GBK file
  -o OUTPUT, --output OUTPUT
                        path to the output folder
                        (default: .)
  -f FILE_NAME, --file-name FILE_NAME
                        name of output file (do not add extension). If not provided, uses the input file name.
                        (default: None)
  -s SUFFIX, --suffix SUFFIX
                        suffix appended to output files. Use '' for no suffix.
                        (default: _pLann)
  -y YAML_FILE, --yaml-file YAML_FILE
                        (default: /Users/nhomer/work/git/pLannotate/plannotate/data/data/databases.yml)
  -l, --linear, --no-linear
                        enables linear DNA annotation
                        (default: True)
  --html, --no-html     creates an html plasmid map in specified path
                        (default: True)
  -c, --csv, --no-csv   creates a cvs file in specified path
                        (default: True)
  -d, --detailed, --no-detailed
                        uses modified algorithm for a more-detailed search with more false positives
                        (default: True)
jeffreybarrick commented 1 year ago

My comment was about the current code not the updated PR code... glad to see it does print the help with the updated code.

mmcguffi commented 1 year ago

defopt seems interesting and I like how elegant it appears to be. I'll dig into it a little more and decide then -- thanks for writing up the PR at a minimum.

Just an FYI I'm currently in the process of moving across the country and starting a new job, so I won't be able to test/address these immediately, but I definitely will once I am settled.

nh13 commented 1 year ago

No urgency here. This is all just trying to give back as I find things.

mmcguffi commented 1 year ago

I very much appreciate the effort on this @nh13, but I am going to stick with click for now -- maybe this is a foolish, sisyphean choice since click has burned me so many times, but I guess we'll see...

At some point I intend to refactor and add type hints/docstrings throughout, so maybe I'll re-assess defopt then

Thanks again for the help and labor!