Hi,
I'm trying to add a new filter to a VCF file after processing using pysam. I can add new format fields to the output header using :
I tried similar apporaches to add filters, but so far haven't succeeded.
Similary to set a filter field for a VariantRecord, I haven't found the correct syntax.
Does anybody have working examples on how to do this?
Edit : I managed to add a new filter definition using :
Now I'm hitting what looks like 'readonly' features of variantrecord.filters
I'm trying to add a new filter to a VCF file after processing using pysam. I can add new format fields to the output header using :
Code:
vcf_file = pysam.VariantFile(vcf_path) new_header = vcf_file.header new_header.formats.add('New_Field', 1,"Float", "New_Field_Descr") vcf_out = pysam.VariantFile(out_path,'w',header=new_header)
Similary to set a filter field for a VariantRecord, I haven't found the correct syntax.
Does anybody have working examples on how to do this?
Edit : I managed to add a new filter definition using :
Code:
new_header.add_line('##FILTER=<ID=new_filter,Description="new_filter explained">')
Code:
AttributeError: attribute 'filter' of 'pysam.cbcf.VariantRecord' objects is not writable