cyvcf2 icon indicating copy to clipboard operation
cyvcf2 copied to clipboard

Accessing Variant num_called property causes segmentation fault

Open BrunoGrandePhD opened this issue 7 years ago • 1 comments

First of all, thanks for the speedy package, @brentp. Much appreciated!

Now, about the issue: whenever I access the num_called property of a Variant instance, Python crashes with a segmentation fault. The VCF file was generated by the Strelka SNV and indel caller. I'm not familiar with Cython, so I can't readily submit a pull request. I figured this might be an easy fix. Then again, don't we all start by thinking that...

Steps to reproduce error

Here's a one-variant test VCF file. I had to change the file extension to .txt to upload it to GitHub.

I'm using cyvcf2 v0.5.1 on Python v3.5.2.

>>> from cyvcf2 import VCF
>>> vcf = VCF('test.txt')
>>> var = next(vcf)
>>> var.num_called
[1]    43035 segmentation fault  python

Let me know if you need anything else!

BrunoGrandePhD avatar Aug 02 '16 19:08 BrunoGrandePhD

while it shouldn't segfault, you don't have genotypes in your VCF, so num_called will never return something sensible. I'll add a guard for this scenario, but at best, it will return None.

brentp avatar Aug 02 '16 20:08 brentp

Hi just to note this still occurs with version '0.30.18' (latest PyPi release)

Pisces 5.2.11.63 VCFs (From Illumina TSO500) define GT in the header but it's not in the FORMAT field for CNV records

The VCF 4.3 specification says "The first key must always be the genotype (GT) if it is present. There are no required keys. "

vcf-validator and bcftools say the Pisces VCF is ok

davmlaw avatar May 01 '23 08:05 davmlaw

closed by #262

brentp avatar May 05 '23 15:05 brentp