Skip to content

Commit

Permalink
Some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvittal committed Feb 27, 2024
1 parent b6abd2b commit 7e5741c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions hail/python/hail/expr/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3279,10 +3279,6 @@ def corr(x, y) -> Float64Expression:
return _func("corr", tfloat64, x, y)


_base_regex = "^([ACGTNM])+$"
_symbolic_regex = r"(^\.)|(\.$)|(^<)|(>$)|(\[)|(\])"


@typecheck(ref=expr_str, alt=expr_str)
@ir.udf(tstr, tstr)
def numeric_allele_type(ref, alt) -> Int32Expression:
Expand All @@ -3301,6 +3297,8 @@ def numeric_allele_type(ref, alt) -> Int32Expression:
The values of :class:`.AlleleType` are not stable and thus should not be
relied upon across hail versions.
"""
_base_regex = "^([ACGTNM])+$"
_symbolic_regex = r"(^\.)|(\.$)|(^<)|(>$)|(\[)|(\])"
return hl.bind(
lambda r, a: hl.if_else(
r.matches(_base_regex),
Expand Down Expand Up @@ -3330,6 +3328,15 @@ def numeric_allele_type(ref, alt) -> Int32Expression:
)


@deprecated(version='0.2.129', reason="Replaced by the public numeric_allele_type")
@typecheck(ref=expr_str, alt=expr_str)
def _num_allele_type(ref, alt) -> Int32Expression:
"""Provided for backwards compatibility, don't use it in new code, or
within the hail library itself
"""
return numeric_allele_type(ref, alt)


@typecheck(ref=expr_str, alt=expr_str)
def is_snp(ref, alt) -> BooleanExpression:
"""Returns ``True`` if the alleles constitute a single nucleotide polymorphism.
Expand Down

0 comments on commit 7e5741c

Please sign in to comment.