Skip to content

Commit

Permalink
Get INFO/FORMAT description from attrs if present
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwhite committed Sep 30, 2024
1 parent 05cb6d4 commit e5ae887
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions vcztools/vcf_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,10 +489,9 @@ def _generate_header(ds, original_header, sample_ids, *, no_version: bool = Fals
category = "INFO"
vcf_number = _array_to_vcf_number(category, key, arr)
vcf_type = _array_to_vcf_type(arr)
if "comment" in arr.attrs:
vcf_description = arr.attrs["comment"]
else:
vcf_description = RESERVED_INFO_KEY_DESCRIPTIONS.get(key, "")
vcf_description = arr.attrs.get(
"description", RESERVED_INFO_KEY_DESCRIPTIONS.get(key, "")
)
print(
f'##INFO=<ID={key},Number={vcf_number},Type={vcf_type},Description="{vcf_description}">',
file=output,
Expand All @@ -514,10 +513,9 @@ def _generate_header(ds, original_header, sample_ids, *, no_version: bool = Fals
category = "FORMAT"
vcf_number = _array_to_vcf_number(category, key, arr)
vcf_type = _array_to_vcf_type(arr)
if "comment" in arr.attrs:
vcf_description = arr.attrs["comment"]
else:
vcf_description = RESERVED_FORMAT_KEY_DESCRIPTIONS.get(key, "")
vcf_description = arr.attrs.get(
"description", RESERVED_FORMAT_KEY_DESCRIPTIONS.get(key, "")
)
print(
f'##FORMAT=<ID={key},Number={vcf_number},Type={vcf_type},Description="{vcf_description}">',
file=output,
Expand Down

0 comments on commit e5ae887

Please sign in to comment.