Skip to content

Commit

Permalink
Fix hemizygote count logic in v4 structural dataset pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
phildarnowsky-broad committed Jun 27, 2024
1 parent 5031a3d commit b2a4a4a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions data-pipeline/src/data_pipeline/datasets/gnomad_sv_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import hail as hl

# ruff doesn't like explicit comparisons to False, but we need them in here, so:
# ruff: noqa: E712


def x_position(chrom, position):
contig_number = (
Expand Down Expand Up @@ -178,7 +181,7 @@ def import_svs_from_vcfs(vcf_path):
(
pop_id,
hl.if_else(
((ds.chrom == "X") | (ds.chrom == "Y")) & (ds.par is False),
((ds.chrom == "X") | (ds.chrom == "Y")) & (ds.par == False),
ds.info[f"N_HEMIALT_{pop_id}_XY"],
0,
),
Expand All @@ -190,7 +193,7 @@ def import_svs_from_vcfs(vcf_path):
(
f"{pop_id}_XY",
hl.if_else(
((ds.chrom == "X") | (ds.chrom == "Y")) & (ds.par is False),
((ds.chrom == "X") | (ds.chrom == "Y")) & (ds.par == False),
ds.info[f"N_HEMIALT_{pop_id}_XY"],
0,
),
Expand All @@ -201,7 +204,7 @@ def import_svs_from_vcfs(vcf_path):
+ [
(
"XY",
hl.if_else(((ds.chrom == "X") | (ds.chrom == "Y")) & (ds.par is False), ds.info.N_HEMIALT_XY, 0),
hl.if_else(((ds.chrom == "X") | (ds.chrom == "Y")) & (ds.par == False), ds.info.N_HEMIALT_XY, 0),
)
]
)
Expand All @@ -211,7 +214,9 @@ def import_svs_from_vcfs(vcf_path):
freq=ds.freq.annotate(
hemizygote_count=hl.or_missing(
ds.type != "MCNV",
hl.if_else(((ds.chrom == "X") | (ds.chrom == "Y")) & (ds.par is False), ds.info.N_HEMIALT_XY, 0),
hl.if_else(
((ds.chrom == "X") | (ds.chrom == "Y")) & (ds.par == False), ds.info.N_HEMIALT_XY, 0
), # noqa: E712
),
populations=hl.if_else(
ds.type != "MCNV",
Expand Down

0 comments on commit b2a4a4a

Please sign in to comment.