Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotate vcf with no records #5

Open
dariober opened this issue Aug 14, 2017 · 1 comment
Open

Annotate vcf with no records #5

dariober opened this issue Aug 14, 2017 · 1 comment

Comments

@dariober
Copy link

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?

@marton-munz
Copy link
Contributor

Hi, thanks very much for this. You are absolutely right and your suggested fix looks perfect. We are going to add this to the next stable CAVA release.
If next time you have a feedback/suggestion, could you please post it to the CAVA User Group so that all users registered there would be able to see it?:
https://groups.google.com/forum/#!forum/cava-user-group
Many thanks again for your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants