Skip to content

Subclass of AbstractVcfAnnotator can decide to abort annotation #605

@ehclark

Description

@ehclark

The AbstractVcfAnnotate.annotate() iterates over the VCF and for each site, essentially does the following:

for record in vcf:
  # ... do some setup ...
  try:
    vrs_field_data = self._get_vrs_data(record, ...)
  except Exception:
    # ... annotate record with error info ...

  vcf_out.write(record)

The call to _get_vrs_data() includes a call to the on_vrs_object() extension that is provided for subclasses to implement an per site customizations or side effects. It is impossible for the subclass to signal to the VCF iterator that an unrecoverable, global error has occurred. For example, in AnyVar, on_vrs_object() periodically batch inserts VRS objects into a database. If the database insert fails due to a connectivity or other persistent database problem, the annotator continues to iterate. In the case of AnyVar, every site beyond the batch size limit triggers a fresh attempt to insert the accumulated data (and the commensurate spewing of log data). It would be preferable for AnyVar to be able to raise an exception type that would cause the annotator to terminate and fail.

So something like:

for record in vcf:
  # ... do some setup ...
  try:
    vrs_field_data = self._get_vrs_data(record, ...)
  except TerminateException as te:
    raise te
  except Exception:
    # ... annotate record with error info ...

  vcf_out.write(record)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions