vcf.Reader() in Python doesn't read my VCF
0
0
Entering edit mode
12 months ago
Najla • 0

I was working on a building a GUI with wxPython and wanted to import a VCF file

with open(file_path, 'r') as file:
                vcf_reader = vcf.Reader(file)
                for record in vcf_reader:
                    # Access the fields of each VCF record as needed
                    chrom = record.CHROM
                    pos = record.POS
                    ref = record.REF
                    alt = record.ALT
                    qual = record.QUAL

however I got this error

SyntaxError: One of the FILTER lines is malformed: ##FILTER=All filters passed  

even though I check the header in the vcf file and it seems correct

##fileformat=VCFv4.1
##fileDate=20221003
##phasing=unphased
##source=VariantAnnotation 1.40.0
##FILTER=<ID=PASS,Description="All filters passed">
##FORMAT=<ID=AD,Number=2,Type=Integer,Description="Allelic depths (number of reads in each observed allele)">
##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Total read depth">
##FORMAT=<ID=FT,Number=1,Type=String,Description="Variant filters"> 

Does anyone know why is this happening and how to fix this issue? Thanks!

vcf python wxpython • 490 views
ADD COMMENT
0
Entering edit mode

Have you tried to check all the lines having the word "FILTER"? You might have another FILTER line in your header not compliant.

grep FILTER input.vcf

ADD REPLY

Login before adding your answer.

Traffic: 1766 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6