Skip to content

Commit

Permalink
Fix bug with 'minimised' field in VEP output
Browse files Browse the repository at this point in the history
  • Loading branch information
Redmar-van-den-Berg committed Jan 13, 2025
1 parent b24c79b commit 7d75831
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions utilities/hamlet_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def parse_genes_v2(sample, genes):
values = parse_variant(sample, gene, variant)
# Copy over hgvs
for field in ["hgvsc", "hgvsp", "impact"]:
values[field] = transcript_consequence[field]
values[field] = transcript_consequence.get(field, '')
# Copy over consequence terms
values["consequence_terms"] = ",".join(transcript_consequence["consequence_terms"])
# Throw out the 'input' field, since that is just the VCF
Expand Down Expand Up @@ -82,15 +82,23 @@ def parse_variant(sample, gene, variant):
# Next print every variant line
for var_line in parse(sample, genes):
if header is None:
header = list(var_line.keys())
header = get_fields(var_line)
print(*header, sep="\t")
else:
current_keys = list(var_line.keys())
current_keys = get_fields(var_line)
if current_keys != header:
msg = f"{current_keys}\n{dynamic_keys}\n do not match!"
msg = f"\n{current_keys}\n{header}\n do not match!"
raise RuntimeError(msg)
print(*(var_line[field] for field in header), sep="\t")

def get_fields(var_line):
fields = list(var_line.keys())
# minimised is not set for every variant, so we remove it
try:
fields.remove('minimised')
except ValueError:
pass
return fields

def print_fusion_table(json_files):
"""Print fusion table"""
Expand Down

0 comments on commit 7d75831

Please sign in to comment.