Skip to content

Commit

Permalink
Merge pull request #602 from broadinstitute/jg/rename_as_sb
Browse files Browse the repository at this point in the history
Fix to drop 'AS_SB' after converting to 'AS_SB_TABLE' in `get_as_info_expr`
  • Loading branch information
jkgoodrich authored Sep 21, 2023
2 parents a486dc3 + c5dd669 commit 1dababe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gnomad/utils/sparse_mt.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ def get_as_info_expr(

# Add FS and SOR if SB is present.
if "AS_SB_TABLE" in info or "AS_SB" in info:
drop = []
# Rename AS_SB to AS_SB_TABLE if present and add SB Ax2 aggregation logic.
if "AS_SB" in agg_expr:
if "AS_SB_TABLE" in agg_expr:
Expand All @@ -450,6 +451,7 @@ def get_as_info_expr(
).extend(
info.AS_SB.map(lambda x: x[2:]) # each alt
)
drop = ["AS_SB"]
else:
as_sb_table = info.AS_SB_TABLE
info = info.annotate(
Expand All @@ -460,7 +462,7 @@ def get_as_info_expr(
AS_SOR=hl.range(1, hl.len(mt.alleles)).map(
lambda i: sor_from_sb(as_sb_table[0].extend(as_sb_table[i]))
),
)
).drop(*drop)

return info

Expand Down

0 comments on commit 1dababe

Please sign in to comment.