Entering edit mode
7.6 years ago
a.james
▴
240
Hello,
I am trying to convert my multiple vcf file into a tabular format. And I am having error while parsing through each row of the file here is part of the script,
for files in results:
Va_BM = vcf.Reader(filename=files, compressed=False)
for variant in Va_BM:
tumor_REL = variant.samples[0]
normal_ID = variant.samples[1]
The error, is ,
ValueError Traceback (most recent call last)
/home/usr/Tools/anaconda3/lib/python3.4/site-packages/vcf/parser.py in _parse_samples(self, samples, samp_fmt, site)
464 try:
--> 465 sampdat[i] = int(vals)
466 except ValueError:
ValueError: invalid literal for int() with base 10: '86,2'
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
<ipython-input-131-857e0813455d> in <module>()
9
10 # iterating lines in VCF file (one line = one variant)
---> 11 for variant in Va_BM:
12 tumor_REL = variant.samples[0]
13 normal_ID = variant.samples[1]
/home/usr/Tools/anaconda3/lib/python3.4/site-packages/vcf/parser.py in __next__(self)
565
566 if fmt is not None:
--> 567 samples = self._parse_samples(row[9:], fmt, record)
568 record.samples = samples
569
Dont understand where I am going wrong, the vcf file is from Mutect2
and file format is ##fileformat=VCFv4.2
any help would be great.
Thank you
search your VCF for the word
'86,2'
in the genotypes . There is a problem with your vcf at this point. Your parser expects an integer.Thats the first line of my vcf file I mean after header, and I am wondering 82, 2 is in int format isnt?
why don't you show us the whole line ?????
Here is the whole line which complaints,
you put the quote around 86,2 to highlight the number don't you ? or there are really some quotes in the VCF file (and it's the error)
No, I just highlighted it for bio-stars. There is no quote in real vcf file.
@Pierre Lindenbaum, apparently the issue is with vcf.reader parser doesn't suit for vcf 4.2 files.