|
14 | 14 | import requests |
15 | 15 |
|
16 | 16 | from ga4gh.vrs.dataproxy import create_dataproxy |
17 | | -from ga4gh.vrs.extras.annotator.vcf import VcfAnnotator |
| 17 | +from ga4gh.vrs.extras.annotator.vcf import VcfAnnotator, VcfAnnotatorArgsError |
18 | 18 |
|
19 | 19 | _logger = logging.getLogger(__name__) |
20 | 20 |
|
@@ -187,16 +187,24 @@ def _annotate_vcf_cli( |
187 | 187 | _logger.info(msg) |
188 | 188 | if not silent: |
189 | 189 | click.echo(msg) |
190 | | - annotator.annotate( |
191 | | - vcf_in.absolute(), |
192 | | - output_vcf_path=vcf_out, |
193 | | - vrs_attributes=vrs_attributes, |
194 | | - assembly=assembly, |
195 | | - compute_for_ref=(not skip_ref), |
196 | | - require_validation=require_validation, |
197 | | - output_pkl_path=pkl_out, |
198 | | - output_ndjson_path=ndjson_out, |
199 | | - ) |
| 190 | + try: |
| 191 | + annotator.annotate( |
| 192 | + vcf_in.absolute(), |
| 193 | + output_vcf_path=vcf_out, |
| 194 | + vrs_attributes=vrs_attributes, |
| 195 | + assembly=assembly, |
| 196 | + compute_for_ref=(not skip_ref), |
| 197 | + require_validation=require_validation, |
| 198 | + output_pkl_path=pkl_out, |
| 199 | + output_ndjson_path=ndjson_out, |
| 200 | + ) |
| 201 | + 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" |
| 203 | + if not silent: |
| 204 | + click.echo(msg) |
| 205 | + _logger.exception(msg) |
| 206 | + exit(1) |
| 207 | + |
200 | 208 | end = timer() |
201 | 209 | msg = f"VCF Annotator finished in {(end - start):.5f} seconds" |
202 | 210 | _logger.info(msg) |
|
0 commit comments