Skip to content

Commit

Permalink
check if fields exist
Browse files Browse the repository at this point in the history
  • Loading branch information
KoalaQin committed Jan 13, 2024
1 parent 2fc3693 commit 55d4cd4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion gnomad/utils/transcript_annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,15 @@ def get_max_pext_per_gene(ht: hl.Table) -> hl.Table:
:return: Table of maximum transcript expression proportion per gene and maximum
mean transcript expression proportion across all tissues for each gene.
"""
# TODO: Use isinstance to check if tx_annotation is already a struct.
# TODO: Should we make it compatible with existing v2 pext?
# If the input Table already has a 'tx_annotation' field, use it.
if "tx_annotation" in ht.row:
ht = ht.select(**ht.tx_annotation)
if ["gene_id", "gene_symbol", "most_severe_consequence"] not in ht.row:
raise ValueError(
"Input Table must have 'gene_id', 'gene_symbol', and"
" 'most_severe_consequence' fields."
)
tissues = hl.eval(ht.tissues)
csq_all = hl.literal(set(CSQ_CODING_ALL_IMPACT))

Expand Down

0 comments on commit 55d4cd4

Please sign in to comment.