Skip to content

Commit b0d2da8

Browse files
tomwhitejeromekelleher
authored andcommitted
Use any non-redundant meta information lines stored by bio2zarr
1 parent 6e3a2a4 commit b0d2da8

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

tests/test_vcf_writer.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,11 @@ def test_write_vcf__generate_header():
327327
##contig=<ID=19>
328328
##contig=<ID=20>
329329
##contig=<ID=X>
330+
##fileDate=20090805
331+
##reference=1000GenomesPilot-NCBI36
332+
##phasing=partial
333+
##ALT=<ID=DEL:ME:ALU,Description="Deletion of ALU element">
334+
##ALT=<ID=CNV,Description="Copy number variable region">
330335
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT NA00001 NA00002 NA00003
331336
""" # noqa: E501
332337

vcztools/vcf_writer.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,12 @@ def _generate_header(
414414
file=output,
415415
)
416416

417+
# Other meta information lines not covered above
418+
if "vcf_meta_information" in ds.attrs:
419+
for key, value in ds.attrs["vcf_meta_information"]:
420+
if key not in ("fileformat", "source"):
421+
print(f"##{key}={value}", file=output)
422+
417423
# [1.5 Header line syntax]
418424
print(
419425
"#CHROM",

0 commit comments

Comments
 (0)