Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CLI to use JCommander #568

Open
julesjacobsen opened this issue Sep 9, 2024 · 0 comments
Open

Update CLI to use JCommander #568

julesjacobsen opened this issue Sep 9, 2024 · 0 comments
Assignees
Milestone

Comments

@julesjacobsen
Copy link
Contributor

julesjacobsen commented Sep 9, 2024

JCommander (https://jcommander.org/) allows for a more advanced CLI parsing experience than the Commons CLI lib currently being used, but is simpler and less fully featured than picocli (https://picocli.info/). This simplicity enables better integration with Spring Boot as the commands can be parsed before the container starts enabling faster feedback to check for incorrect input. This does make the code a little clunkier and requires the input commands to be parsed twice, but this isn't apparent to the user.

https://jcommander.org/#_more_complex_syntaxes_commands

This will enable a better separation of commands which Commons CLI doesn't allow. e.g. Currently:

$ java -jar exomiser-cli-14.1.0-ALPHA.jar --help
usage: java -jar exomiser-cli-{build.version}.jar [...]
    --analysis <file>            Path to analysis script file. This should
                                 be in yaml format.
    --analysis-batch <file>      Path to analysis batch file. This should
                                 be in plain text file with the path to a
                                 single analysis script file in yaml
                                 format on each line.
    --assembly <assembly>        Genome assembly of sample VCF file.
                                 Either 'GRCh37' or 'GRCh38'
    --batch <file>               Path to cli batch file. This should be in
                                 plain text file with the cli input for an
                                 analysis on each line.
 -h,--help                       Shows this help
    --job <file>                 Path to job file. This should be in JSON
                                 or YAML format.
    --output <string>            Path to outputOptions file. This should
                                 be in JSON or YAML format.
    --output-directory <path>    Directory where the output files should
                                 be written. This option is EXCLUSIVE to
                                 the output-prefix option.
    --output-filename <string>   Filename prefix for the output files.
                                 Will be generated from the input VCF
                                 filename if not specified. This option is
                                 EXCLUSIVE to the output-prefix option.
    --output-format <string>     A list of comma separated output
                                 format(s) e.g. HTML or HTML,JSON. Valid
                                 options include [HTML, JSON, TSV_GENE,
                                 TSV_VARIANT, VCF]. Note that HTML is the
                                 most human-friendly, JSON is the most
                                 detailed. (default = HTML,JSON)
    --output-prefix <string>     Path/filename without an extension to be
                                 prepended to the output file format
                                 options. This option is EXCLUSIVE to the
                                 output-directory and output-filename
                                 options. DEPRECATED! Use
                                 --output-directory and/or
                                 --output-filename instead.
    --ped <file>                 Path to sample PED file.
    --preset <string>            The Exomiser analysis preset for the
                                 input sample. One of 'exome', 'genome' or
                                 'phenotype-only'
    --sample <file>              Path to sample or phenopacket file. This
                                 should be in JSON or YAML format.
    --vcf <file>                 Path to sample VCF file. Also requires
                                 'assembly' option to be defined.

should really be:

  Commands:
    analysis      Analyses VCF files
      Usage: analysis [options]
        Options:
            --analysis <file>            Path to analysis script file. This should
                                         be in yaml format.
            --assembly <assembly>        Genome assembly of sample VCF file.
                                         Either 'GRCh37' or 'GRCh38'
         -h,--help                       Shows this help
            --job <file>                 Path to job file. This should be in JSON
                                         or YAML format.
            --output <string>            Path to outputOptions file. This should
                                         be in JSON or YAML format.
            --output-directory <path>    Directory where the output files should
                                         be written. This option is EXCLUSIVE to
                                         the output-prefix option.
            --output-filename <string>   Filename prefix for the output files.
                                         Will be generated from the input VCF
                                         filename if not specified. This option is
                                         EXCLUSIVE to the output-prefix option.
            --output-format <string>     A list of comma separated output
                                         format(s) e.g. HTML or HTML,JSON. Valid
                                         options include [HTML, JSON, TSV_GENE,
                                         TSV_VARIANT, VCF]. Note that HTML is the
                                         most human-friendly, JSON is the most
                                         detailed. (default = HTML,JSON)
            --output-prefix <string>     Path/filename without an extension to be
                                         prepended to the output file format
                                         options. This option is EXCLUSIVE to the
                                         output-directory and output-filename
                                         options. DEPRECATED! Use
                                         --output-directory and/or
                                         --output-filename instead.
            --ped <file>                 Path to sample PED file.
            --preset <string>            The Exomiser analysis preset for the
                                         input sample. One of 'exome', 'genome' or
                                         'phenotype-only'
            --sample <file>              Path to sample or phenopacket file. This
                                         should be in JSON or YAML format.
            --vcf <file>                 Path to sample VCF file. Also requires
                                         'assembly' option to be defined.
    analysis-batch
        Options:
            <file>      Path to analysis batch file. This should
                                 be in plain text file with the path to a
                                 single analysis script file in yaml
                                 format on each line.
    batch
        Options:
             <file>          Path to cli batch file. This should be in
                                 plain text file with the cli input for an
                                 analysis on each line.

as the analysis, batch and analysis-batch are really separate commands with distinct input requirements. This also allows other commands to be added, such as perhaps a single variant analysis or annotation.

@julesjacobsen julesjacobsen self-assigned this Sep 9, 2024
@julesjacobsen julesjacobsen added this to the 15.0.0 milestone Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant