You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My use case is that I'm writing a VCF merge tool. For that reason, I want the output VCF to have the union of all input VCF headers (INFO and FORMAT, mostly). Unfortunately this is tricky to do in cyvcf2. We have add_info_to_header and co, as well as add_to_header. However, add_info_to_header takes a dictionary and not a HREC object we get from header_iter(), nor is there a way to convert an HREC to a dict. On the other hand, add_to_header(str(some_hrec)) seems like it should work, but it just gives me the error Exception: couldn't add '%s' to header. My current example code is:
File "/some/path/vcf_transform/vcf_transform.py", line 83, in merge_vcfs
out.add_to_header(str(field))
File "cyvcf2/cyvcf2.pyx", line 297, in cyvcf2.cyvcf2.VCF.add_to_header
Exception: couldn't add '%s' to header
python-BaseException
Is there a working way to copy headers from one VCF to the output?
The text was updated successfully, but these errors were encountered:
My use case is that I'm writing a VCF merge tool. For that reason, I want the output VCF to have the union of all input VCF headers (INFO and FORMAT, mostly). Unfortunately this is tricky to do in
cyvcf2
. We haveadd_info_to_header
and co, as well asadd_to_header
. However,add_info_to_header
takes a dictionary and not aHREC
object we get fromheader_iter()
, nor is there a way to convert an HREC to a dict. On the other hand,add_to_header(str(some_hrec))
seems like it should work, but it just gives me the errorException: couldn't add '%s' to header
. My current example code is:The error I get here is:
Is there a working way to copy headers from one VCF to the output?
The text was updated successfully, but these errors were encountered: