PyVCF
PyVCF copied to clipboard
TypeError: object of type '_SV' has no len()
I try to get the length of REF and ALT[0] using below code, once a while I got the error for some record.
vcf_reader = vcf.Reader(open('thousand.vcf', 'r')) for record in vcf_reader: print len(record.REF), len((record.ALT[0])) TypeError: object of type '_SV' has no len()
What is a good way to find the length? My application is only interested in those records that has a length of 1 (like it has only a A, C, G or T) in REG and ALT. Do you have a good sample code for that?
It might be too late (over a year and a half since asked), but I encountered this problem too today. The variants that cause this error (SV variants) are encoded differently, see some examples here as you can see the length is given in the info field SVLEN (do notice that they use negative numbers for deletions)