Skip to content

Commit

Permalink
feat: optionally suppress console output
Browse files Browse the repository at this point in the history
  • Loading branch information
jsstevenson committed Aug 30, 2024
1 parent 4082981 commit 925edaa
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/ga4gh/vrs/extras/vcf_annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,18 @@ class SeqRepoProxyType(str, Enum):
show_default=True,
help="Require validation checks to pass in order to return a VRS object"
)
@click.option(
"--silent",
"-s",
is_flag=True,
default=False,
help="Suppress messages printed to stdout"
)
def annotate_click( # pylint: disable=too-many-arguments
vcf_in: str, vcf_out: Optional[str], vrs_pickle_out: Optional[str],
vrs_attributes: bool, seqrepo_dp_type: SeqRepoProxyType, seqrepo_root_dir: str,
seqrepo_base_url: str, assembly: str, skip_ref: bool, require_validation: bool
seqrepo_base_url: str, assembly: str, skip_ref: bool, require_validation: bool,
silent: bool,
) -> None:
"""Annotate VCF file via click
Expand All @@ -124,15 +132,17 @@ def annotate_click( # pylint: disable=too-many-arguments
start = timer()
msg = f"Annotating {vcf_in} with the VCF Annotator..."
_logger.info(msg)
click.echo(msg)
if not silent:
click.echo(msg)
annotator.annotate(
vcf_in, vcf_out=vcf_out, vrs_pickle_out=vrs_pickle_out,
vrs_attributes=vrs_attributes, assembly=assembly,
compute_for_ref=(not skip_ref), require_validation=require_validation
)
end = timer()
msg = f"VCF Annotator finished in {(end - start):.5f} seconds"
_logger.info(msg)
if not silent:
_logger.info(msg)
click.echo(msg)

class VCFAnnotator: # pylint: disable=too-few-public-methods
Expand Down

0 comments on commit 925edaa

Please sign in to comment.