Skip to content

Commit 6183ad9

Browse files
authored
Merge pull request #576 from populationgenomics/avoid-deprecated
Avoid DeprecationWarnings from superseded hail function and import [minor]
2 parents a089bbc + 9244cb5 commit 6183ad9

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

gnomad/sample_qc/relatedness.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ def _is_dnm(
10971097
locus.in_autosome(),
10981098
proband_gt.is_het() & father_gt.is_hom_ref() & mother_gt.is_hom_ref(),
10991099
)
1100-
return hl.cond(
1100+
return hl.if_else(
11011101
locus.in_autosome_or_par() | (proband_is_female & locus.in_x_nonpar()),
11021102
proband_gt.is_het() & father_gt.is_hom_ref() & mother_gt.is_hom_ref(),
11031103
hl.or_missing(

gnomad/utils/annotations.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ def get_lowqual_expr(
378378

379379
if isinstance(qual_approx_expr, hl.expr.ArrayNumericExpression):
380380
return hl.range(1, hl.len(alleles)).map(
381-
lambda ai: hl.cond(
381+
lambda ai: hl.if_else(
382382
hl.is_snp(alleles[0], alleles[ai]),
383383
qual_approx_expr[ai - 1] < min_snv_qual,
384384
qual_approx_expr[ai - 1] < min_indel_qual,
@@ -505,7 +505,7 @@ def get_adj_expr(
505505
"""
506506
return (
507507
(gq_expr >= adj_gq)
508-
& hl.cond(gt_expr.is_haploid(), dp_expr >= haploid_adj_dp, dp_expr >= adj_dp)
508+
& hl.if_else(gt_expr.is_haploid(), dp_expr >= haploid_adj_dp, dp_expr >= adj_dp)
509509
& (
510510
hl.case()
511511
.when(~gt_expr.is_het(), True)
@@ -555,12 +555,12 @@ def add_variant_type(alt_alleles: hl.expr.ArrayExpression) -> hl.expr.StructExpr
555555
alts = alt_alleles[1:]
556556
non_star_alleles = hl.filter(lambda a: a != "*", alts)
557557
return hl.struct(
558-
variant_type=hl.cond(
558+
variant_type=hl.if_else(
559559
hl.all(lambda a: hl.is_snp(ref, a), non_star_alleles),
560-
hl.cond(hl.len(non_star_alleles) > 1, "multi-snv", "snv"),
561-
hl.cond(
560+
hl.if_else(hl.len(non_star_alleles) > 1, "multi-snv", "snv"),
561+
hl.if_else(
562562
hl.all(lambda a: hl.is_indel(ref, a), non_star_alleles),
563-
hl.cond(hl.len(non_star_alleles) > 1, "multi-indel", "indel"),
563+
hl.if_else(hl.len(non_star_alleles) > 1, "multi-indel", "indel"),
564564
"mixed",
565565
),
566566
),
@@ -748,7 +748,7 @@ def fs_from_sb(
748748
# Normalize table if counts get too large
749749
if normalize:
750750
fs_expr = hl.bind(
751-
lambda sb, sb_sum: hl.cond(
751+
lambda sb, sb_sum: hl.if_else(
752752
sb_sum <= 2 * min_cell_count,
753753
sb,
754754
sb.map(lambda x: hl.int(x / (sb_sum / min_cell_count))),

gnomad/utils/file_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from typing import Callable, Dict, List, Optional, Tuple, Union
1212

1313
import hail as hl
14-
from hailtop.aiogoogle import GoogleStorageAsyncFS
14+
from hailtop.aiocloud.aiogoogle import GoogleStorageAsyncFS
1515
from hailtop.aiotools import AsyncFS, LocalAsyncFS
1616
from hailtop.aiotools.router_fs import RouterAsyncFS
1717
from hailtop.utils import bounded_gather

gnomad/utils/filtering.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def add_filters_expr(
237237
lambda x, y: x.union(y),
238238
current_filters,
239239
[
240-
hl.cond(filter_condition, hl.set([filter_name]), hl.empty_set(hl.tstr))
240+
hl.if_else(filter_condition, hl.set([filter_name]), hl.empty_set(hl.tstr))
241241
for filter_name, filter_condition in filters.items()
242242
],
243243
)

gnomad/utils/sparse_mt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ def compute_coverage_stats(
976976

977977
# Annotate rows now
978978
return mt.select_rows(
979-
mean=hl.cond(hl.is_nan(mean_expr), 0, mean_expr),
979+
mean=hl.if_else(hl.is_nan(mean_expr), 0, mean_expr),
980980
median_approx=hl.or_else(hl.agg.approx_median(hl.or_else(mt.DP, 0)), 0),
981981
total_DP=hl.agg.sum(mt.DP),
982982
**{

gnomad/variant_qc/random_forest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def run_rf_test(
4545
)
4646

4747
mt = mt.annotate_rows(
48-
label=hl.cond(mt["feature1"] & (mt["feature2"] > 0), "TP", "FP")
48+
label=hl.if_else(mt["feature1"] & (mt["feature2"] > 0), "TP", "FP")
4949
)
5050
ht = mt.rows()
5151

0 commit comments

Comments
 (0)