Skip to content

Commit 6b2ab41

Browse files
authored
fix: use POSIX/GNU conventions for option word separators (#521)
the general recommendation is to use hyphens to separate words for reasons like visibility in certain terminal contexts and how some html documentation handles it. This is something we've been bad about in the past but it'd be good to get it cleaned up
1 parent 92d0c09 commit 6b2ab41

2 files changed

Lines changed: 23 additions & 23 deletions

File tree

docs/extras/vcf_annotator.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,37 @@ vrs-annotate vcf --help
1515

1616
### Configuring the sequence data proxy
1717

18-
Like other VRS-Python tools, the VCF annotator requires access to [sequence and identifier data services](https://vrs.ga4gh.org/en/stable/impl-guide/required_data.html#data-services), as implemented in libraries like [SeqRepo](https://github.com/biocommons/biocommons.seqrepo). By default, the CLI will attempt to connect to a [SeqRepo REST instance](https://github.com/biocommons/seqrepo-rest-service) at `http://localhost:5000/seqrepo`, but a URI can be passed with the `--dataproxy_uri` option or set with the `GA4GH_VRS_DATAPROXY_URI` environment variable (the former takes priority over the latter).
18+
Like other VRS-Python tools, the VCF annotator requires access to [sequence and identifier data services](https://vrs.ga4gh.org/en/stable/impl-guide/required_data.html#data-services), as implemented in libraries like [SeqRepo](https://github.com/biocommons/biocommons.seqrepo). By default, the CLI will attempt to connect to a [SeqRepo REST instance](https://github.com/biocommons/seqrepo-rest-service) at `http://localhost:5000/seqrepo`, but a URI can be passed with the `--dataproxy-uri` option or set with the `GA4GH_VRS_DATAPROXY_URI` environment variable (the former takes priority over the latter).
1919

2020
For example, to use a local set of SeqRepo data, you can use an absolute file path:
2121

2222
```commandline
23-
vrs-annotate vcf --dataproxy_uri="seqrepo+file:///usr/local/share/seqrepo/2024-12-20/" --vcf_out=out.vcf.gz input.vcf.gz
23+
vrs-annotate vcf --dataproxy-uri="seqrepo+file:///usr/local/share/seqrepo/2024-12-20/" --vcf-out=out.vcf.gz input.vcf.gz
2424
```
2525

2626
Alternative, a relative file path:
2727

2828
```commandline
29-
vrs-annotate vcf --dataproxy_uri="seqrepo+../seqrepo/2024-12-20/" --vcf_out=out.vcf.gz input.vcf.gz
29+
vrs-annotate vcf --dataproxy-uri="seqrepo+../seqrepo/2024-12-20/" --vcf-out=out.vcf.gz input.vcf.gz
3030
```
3131

3232
Or an alternate REST path:
3333

3434
```commandline
35-
vrs-annotate vcf --dataproxy_uri="seqrepo+http://mylabwebsite.org/seqrepo" --vcf_out=out.vcf.gz input.vcf.gz
35+
vrs-annotate vcf --dataproxy-uri="seqrepo+http://mylabwebsite.org/seqrepo" --vcf-out=out.vcf.gz input.vcf.gz
3636
```
3737

3838
### Other Options
39-
`--vrs_attributes`
39+
`--vrs-attributes`
4040
>Will include VRS_Start, VRS_End, VRS_State fields in the INFO field.
4141
4242
`--assembly` [TEXT]
43-
>The assembly that the `vcf_in` data uses. [default: GRCh38]
43+
>The assembly that the `vcf-in` data uses. [default: GRCh38]
4444
45-
`--skip_ref`
45+
`--skip-ref`
4646
>Skip VRS computation for REF alleles.
4747
48-
`--require_validation`
48+
`--require-validation`
4949
>Require validation checks to pass in order to return a VRS object
5050
5151
`--help`

src/ga4gh/vrs/extras/annotator/cli.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def _cli() -> None:
3030

3131

3232
class _LogLevel(str, Enum):
33-
"""Define legal values for `--log_level` option."""
33+
"""Define legal values for `--log-level` option."""
3434

3535
DEBUG = "debug"
3636
INFO = "info"
@@ -42,7 +42,7 @@ class _LogLevel(str, Enum):
4242
def _log_level_option(func: Callable) -> Callable:
4343
"""Provide reusable log level CLI option decorator.
4444
45-
Adds a `--log_level` CLI option to any decorated command. Doesn't pass on any
45+
Adds a `--log-level` CLI option to any decorated command. Doesn't pass on any
4646
values, just sets the logging level for this module.
4747
4848
:param func: incoming click command
@@ -60,7 +60,7 @@ def _set_log_level(ctx: dict, param: str, value: _LogLevel) -> None: # noqa: AR
6060
logging.getLogger(__name__).setLevel(level_map[value])
6161

6262
return click.option(
63-
"--log_level",
63+
"--log-level",
6464
type=click.Choice([v.value for v in _LogLevel.__members__.values()]),
6565
default="info",
6666
help="Set the logging level.",
@@ -73,42 +73,42 @@ def _set_log_level(ctx: dict, param: str, value: _LogLevel) -> None: # noqa: AR
7373
@_cli.command(name="vcf")
7474
@_log_level_option
7575
@click.argument(
76-
"vcf_in",
76+
"vcf-in",
7777
nargs=1,
7878
type=click.Path(exists=True, readable=True, dir_okay=False, path_type=Path),
7979
)
8080
@click.option(
81-
"--vcf_out",
81+
"--vcf-out",
8282
required=False,
8383
type=click.Path(writable=True, allow_dash=False, path_type=Path),
8484
help=(
8585
"Declare save location for output annotated VCF. At least one form of output must be declared."
8686
),
8787
)
8888
@click.option(
89-
"--pkl_out",
89+
"--pkl-out",
9090
required=False,
9191
type=click.Path(writable=True, allow_dash=False, path_type=Path),
9292
help=(
9393
"Declare save location for output PKL file mapping VRS IDs to alleles. At least one form of output must be declared."
9494
),
9595
)
9696
@click.option(
97-
"--ndjson_out",
97+
"--ndjson-out",
9898
required=False,
9999
type=click.Path(writable=True, allow_dash=False, path_type=Path),
100100
help=(
101101
"Declare save location for output NDJSON file dump of VRS alleles. At least one form of output must be declared."
102102
),
103103
)
104104
@click.option(
105-
"--vrs_attributes",
105+
"--vrs-attributes",
106106
is_flag=True,
107107
default=False,
108108
help="Include VRS_Start, VRS_End, and VRS_State fields in the VCF output INFO field.",
109109
)
110110
@click.option(
111-
"--dataproxy_uri",
111+
"--dataproxy-uri",
112112
required=False,
113113
default="seqrepo+http://localhost:5000/seqrepo",
114114
help="URI declaring source of sequence data. See subcommand description for more information.",
@@ -123,13 +123,13 @@ def _set_log_level(ctx: dict, param: str, value: _LogLevel) -> None: # noqa: AR
123123
type=str,
124124
)
125125
@click.option(
126-
"--skip_ref",
126+
"--skip-ref",
127127
is_flag=True,
128128
default=False,
129129
help="Skip VRS computation for REF alleles.",
130130
)
131131
@click.option(
132-
"--require_validation",
132+
"--require-validation",
133133
is_flag=True,
134134
default=False,
135135
help="Require validation checks to pass to construct a VRS object.",
@@ -155,12 +155,12 @@ def _annotate_vcf_cli(
155155
) -> None:
156156
"""Extract VRS objects from VCF located at VCF_IN.
157157
158-
$ vrs-annotate vcf input.vcf.gz --vcf_out output.vcf.gz --pkl_out vrs_objects.pkl
158+
$ vrs-annotate vcf input.vcf.gz --vcf-out output.vcf.gz --pkl-out vrs_objects.pkl
159159
160-
Note that at least one of --vcf_out, --pkl_out, or --ndjson_out must be selected and
160+
Note that at least one of --vcf-out, --pkl-out, or --ndjson-out must be selected and
161161
defined; otherwise, this process will terminate immediately.
162162
163-
Sequence data from a provider such as SeqRepo is required. Use the `--dataproxy_uri`
163+
Sequence data from a provider such as SeqRepo is required. Use the `--dataproxy-uri`
164164
option or the environment variable `GA4GH_VRS_DATAPROXY_URI` to define its location
165165
(the former will take priority over the latter when both are set).
166166
@@ -199,7 +199,7 @@ def _annotate_vcf_cli(
199199
output_ndjson_path=ndjson_out,
200200
)
201201
except VcfAnnotatorArgsError:
202-
msg = "No VCF, PKL, or NDJSON output path provided -- must set at least one of --vcf_out, --pkl_out, or --ndjson_out"
202+
msg = "No VCF, PKL, or NDJSON output path provided -- must set at least one of --vcf-out, --pkl-out, or --ndjson-out"
203203
if not silent:
204204
click.echo(msg)
205205
_logger.exception(msg)

0 commit comments

Comments
 (0)