Skip to content

Annotate vcf with no records #5

@dariober

Description

@dariober

Hello- It seems that CAVA throws an exception if the input VCF file has no records. This is what I get:

cava.py -i in.vcf -c cava.config

-----------------------------------------------------------------------
CAVA (Clinical Annotation of VAriants) v1.2.2 is now running.
Started:  2017-08-14 09:25:16.991644 

Configuration file:  cava.config
Input file (VCF):    in.vcf
Output file (VCF):   output.vcf
Log file:            output.log

Input file contains 0 records to annotate.

Traceback (most recent call last):
  File "/home/db291g/applications/cava/CAVA/cava.py", line 420, in <module>
    breaks = findFileBreaks(copts.input, copts.threads)
  File "/home/db291g/applications/cava/CAVA/cava.py", line 134, in findFileBreaks
    delta = int((counter - first + 1) / threads)
UnboundLocalError: local variable 'first' referenced before assignment

I think a vcf with no records is a legitimate input so I fixed this on my local copy by adding this check just after https://github.com/RahmanTeam/CAVA/blob/master/cava.py#L416 :

if numOfRecords == 0:
   sys.stderr.write('Done. Nothing to be annotated.\n')
   sys.exit(0)

In this way cava writes out the VCF header and exits clean.

Maybe it should be fixed in the master as well?

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