How to use the hail.expr.types.dtype function in hail

To help you get started, we’ve selected a few hail examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hail-is / hail / hail / python / hail / ir / register_functions.py View on Github external
register_function("*", (dtype("array"),dtype("array"),), dtype("array"))
    register_function("*", (dtype("array"),dtype("?T"),), dtype("array"))
    register_function("*", (dtype("?T:numeric"),dtype("array"),), dtype("array"))
    register_function("*", (dtype("ndarray"),dtype("ndarray"),), dtype("ndarray"))
    register_function("*", (dtype("ndarray"),dtype("?T"),), dtype("ndarray"))
    register_function("*", (dtype("?T:numeric"),dtype("ndarray"),), dtype("ndarray"))
    register_function("intersection", (dtype("set"),dtype("set"),), dtype("set"))
    register_function("add", (dtype("set"),dtype("?T"),), dtype("set"))
    register_function("argmax", (dtype("array"),), dtype("int32"))
    register_function("//", (dtype("array"),dtype("array"),), dtype("array"))
    register_function("//", (dtype("array"),dtype("?T"),), dtype("array"))
    register_function("//", (dtype("?T:numeric"),dtype("array"),), dtype("array"))
    register_function("//", (dtype("ndarray"),dtype("ndarray"),), dtype("ndarray"))
    register_function("//", (dtype("ndarray"),dtype("?T"),), dtype("ndarray"))
    register_function("//", (dtype("?T:numeric"),dtype("ndarray"),), dtype("ndarray"))
    register_function("keySet", (dtype("dict"),), dtype("set"))
    register_function("qnorm", (dtype("float64"),), dtype("float64"))
    register_function("oneHotAlleles", (dtype("call"),dtype("int32"),), dtype("array"))
    register_function("dpois", (dtype("float64"),dtype("float64"),dtype("bool"),), dtype("float64"))
    register_function("dpois", (dtype("float64"),dtype("float64"),), dtype("float64"))
    register_function("ploidy", (dtype("call"),), dtype("int32"))
    register_function("||", (dtype("bool"),dtype("bool"),), dtype("bool"))
    register_function("ppois", (dtype("float64"),dtype("float64"),dtype("bool"),dtype("bool"),), dtype("float64"))
    register_function("ppois", (dtype("float64"),dtype("float64"),), dtype("float64"))
    register_function("log10", (dtype("float64"),), dtype("float64"))
    register_function("isHet", (dtype("call"),), dtype("bool"))
    register_function("isAutosomalOrPseudoAutosomal", (dtype("?T:locus"),), dtype("bool"))
    register_function("testCodeUnification", (dtype("?x:numeric"),dtype("?x:int32"),), dtype("?x"))
    register_seeded_function("rand_pois", (dtype("float64"),), dtype("float64"))
    register_seeded_function("rand_pois", (dtype("int32"),dtype("float64"),), dtype("array"))
    register_function("toFloat32", (dtype("str"),), dtype("float32"))
    register_function("toFloat32", (dtype("bool"),), dtype("float32"))
github hail-is / hail / hail / python / hail / expr / matrix_type.py View on Github external
def _from_json(json):
        return tmatrix(
            dtype(json['global']),
            dtype(json['col']),
            json['col_key'],
            dtype(json['row']),
            json['row_key'],
            dtype(json['entry']))
github hail-is / hail / hail / python / hail / ir / table_ir.py View on Github external
def regression_test_type(test):
    glm_fit_schema = dtype('struct{n_iterations:int32,converged:bool,exploded:bool}')
    if test == 'wald':
        return dtype(
            f'struct{{beta:float64,standard_error:float64,z_stat:float64,p_value:float64,fit:{glm_fit_schema}}}')
    elif test == 'lrt':
        return dtype(f'struct{{beta:float64,chi_sq_stat:float64,p_value:float64,fit:{glm_fit_schema}}}')
    elif test == 'score':
        return dtype('struct{chi_sq_stat:float64,p_value:float64}')
    else:
        assert test == 'firth', test
        return dtype(f'struct{{beta:float64,chi_sq_stat:float64,p_value:float64,fit:{glm_fit_schema}}}')
github hail-is / hail / hail / python / hail / ir / register_functions.py View on Github external
register_function("toInt64", (dtype("str"),), dtype("int64"))
    register_function("testCodeUnification2", (dtype("?x"),), dtype("?x"))
    register_function("contains", (dtype("str"),dtype("str"),), dtype("bool"))
    register_function("contains", (dtype("interval"),dtype("?T"),), dtype("bool"))
    register_function("entropy", (dtype("str"),), dtype("float64"))
    register_function("filtering_allele_frequency", (dtype("int32"),dtype("int32"),dtype("float64"),), dtype("float64"))
    register_function("gqFromPL", (dtype("array"),), dtype("int32"))
    register_function("startswith", (dtype("str"),dtype("str"),), dtype("bool"))
    register_function("ceil", (dtype("float32"),), dtype("float32"))
    register_function("ceil", (dtype("float64"),), dtype("float64"))
    register_function("json", (dtype("?T"),), dtype("str"))
    register_function("strip", (dtype("str"),), dtype("str"))
    register_function("firstMatchIn", (dtype("str"),dtype("str"),), dtype("array"))
    register_function("isEmpty", (dtype("interval"),), dtype("bool"))
    register_function("~", (dtype("str"),dtype("str"),), dtype("bool"))
    register_function("mkString", (dtype("set"),dtype("str"),), dtype("str"))
    register_function("mkString", (dtype("array"),dtype("str"),), dtype("str"))
    register_function("dosage", (dtype("array"),), dtype("float64"))
    register_function("upper", (dtype("str"),), dtype("str"))
    register_function("overlaps", (dtype("interval"),dtype("interval"),), dtype("bool"))
    register_function("downcode", (dtype("call"),dtype("int32"),), dtype("call"))
    register_function("inXPar", (dtype("?T:locus"),), dtype("bool"))
    register_function("format", (dtype("str"),dtype("?T:tuple"),), dtype("str"))
    register_function("pnorm", (dtype("float64"),), dtype("float64"))
    register_function("is_infinite", (dtype("float32"),), dtype("bool"))
    register_function("is_infinite", (dtype("float64"),), dtype("bool"))
    register_function("isHetRef", (dtype("call"),), dtype("bool"))
    register_function("isMitochondrial", (dtype("?T:locus"),), dtype("bool"))
    register_function("hamming", (dtype("str"),dtype("str"),), dtype("int32"))
    register_function("end", (dtype("interval"),), dtype("?T"))
    register_function("start", (dtype("interval"),), dtype("?T"))
    register_function("inXNonPar", (dtype("?T:locus"),), dtype("bool"))
github hail-is / hail / hail / python / hail / ir / register_functions.py View on Github external
def register_functions():
    from hail.expr.types import dtype

    register_function("flatten", (dtype("array>"),), dtype("array"))
    register_function("difference", (dtype("set"),dtype("set"),), dtype("set"))
    register_function("median", (dtype("set"),), dtype("?T"))
    register_function("median", (dtype("array"),), dtype("?T"))
    register_function("uniqueMinIndex", (dtype("array"),), dtype("int32"))
    register_function("mean", (dtype("array"),), dtype("float64"))
    register_function("toFloat32", (dtype("?T:numeric"),), dtype("float32"))
    register_function("uniqueMaxIndex", (dtype("array"),), dtype("int32"))
    register_function("toSet", (dtype("array"),), dtype("set"))

    def array_floating_point_divide(arg_type, ret_type):
        register_function("/", (arg_type, hl.tarray(arg_type),), hl.tarray(ret_type))
        register_function("/", (hl.tarray(arg_type),arg_type), hl.tarray(ret_type))
        register_function("/", (hl.tarray(arg_type),hl.tarray(arg_type)), hl.tarray(ret_type))
    array_floating_point_divide(hl.tint32, hl.tfloat32)
    array_floating_point_divide(hl.tint64, hl.tfloat32)
    array_floating_point_divide(hl.tfloat32, hl.tfloat32)
    array_floating_point_divide(hl.tfloat64, hl.tfloat64)
github hail-is / hail / hail / python / hail / ir / register_functions.py View on Github external
register_function("//", (dtype("ndarray"),dtype("ndarray"),), dtype("ndarray"))
    register_function("//", (dtype("ndarray"),dtype("?T"),), dtype("ndarray"))
    register_function("//", (dtype("?T:numeric"),dtype("ndarray"),), dtype("ndarray"))
    register_function("keySet", (dtype("dict"),), dtype("set"))
    register_function("qnorm", (dtype("float64"),), dtype("float64"))
    register_function("oneHotAlleles", (dtype("call"),dtype("int32"),), dtype("array"))
    register_function("dpois", (dtype("float64"),dtype("float64"),dtype("bool"),), dtype("float64"))
    register_function("dpois", (dtype("float64"),dtype("float64"),), dtype("float64"))
    register_function("ploidy", (dtype("call"),), dtype("int32"))
    register_function("||", (dtype("bool"),dtype("bool"),), dtype("bool"))
    register_function("ppois", (dtype("float64"),dtype("float64"),dtype("bool"),dtype("bool"),), dtype("float64"))
    register_function("ppois", (dtype("float64"),dtype("float64"),), dtype("float64"))
    register_function("log10", (dtype("float64"),), dtype("float64"))
    register_function("isHet", (dtype("call"),), dtype("bool"))
    register_function("isAutosomalOrPseudoAutosomal", (dtype("?T:locus"),), dtype("bool"))
    register_function("testCodeUnification", (dtype("?x:numeric"),dtype("?x:int32"),), dtype("?x"))
    register_seeded_function("rand_pois", (dtype("float64"),), dtype("float64"))
    register_seeded_function("rand_pois", (dtype("int32"),dtype("float64"),), dtype("array"))
    register_function("toFloat32", (dtype("str"),), dtype("float32"))
    register_function("toFloat32", (dtype("bool"),), dtype("float32"))
    register_function("isAutosomal", (dtype("?T:locus"),), dtype("bool"))
    register_function("isPhased", (dtype("call"),), dtype("bool"))
    register_function("isHomVar", (dtype("call"),), dtype("bool"))
    register_function("corr", (dtype("array"),dtype("array"),), dtype("float64"))
    register_function("log", (dtype("float64"),dtype("float64"),), dtype("float64"))
    register_function("log", (dtype("float64"),), dtype("float64"))
    register_function("foobar2", (), dtype("int32"))
    register_function("approxEqual", (dtype("float64"),dtype("float64"),dtype("float64"),dtype("bool"),dtype("bool"),), dtype("bool"))
    register_function("plDosage", (dtype("array"),), dtype("float64"))
    register_function("includesEnd", (dtype("interval"),), dtype("bool"))
    register_function("position", (dtype("?T:locus"),), dtype("int32"))
    register_seeded_function("rand_unif", (dtype("float64"),dtype("float64"),), dtype("float64"))
github hail-is / hail / hail / python / hail / ir / register_functions.py View on Github external
register_function("triangle", (dtype("int32"),), dtype("int32"))
    register_function("Interval", (dtype("?T"),dtype("?T"),dtype("bool"),dtype("bool"),), dtype("interval"))
    register_function("contig", (dtype("?T:locus"),), dtype("str"))
    register_function("Call", (dtype("bool"),), dtype("call"))
    register_function("Call", (dtype("str"),), dtype("call"))
    register_function("Call", (dtype("int32"),dtype("bool"),), dtype("call"))
    register_function("Call", (dtype("int32"),dtype("int32"),dtype("bool"),), dtype("call"))
    register_function("Call", (dtype("array"),dtype("bool"),), dtype("call"))
    register_function("qchisqtail", (dtype("float64"),dtype("float64"),), dtype("float64"))
    register_function("binomTest", (dtype("int32"),dtype("int32"),dtype("float64"),dtype("int32"),), dtype("float64"))
    register_function("qpois", (dtype("float64"),dtype("float64"),), dtype("int32"))
    register_function("qpois", (dtype("float64"),dtype("float64"),dtype("bool"),dtype("bool"),), dtype("int32"))
    register_function("is_finite", (dtype("float32"),), dtype("bool"))
    register_function("is_finite", (dtype("float64"),), dtype("bool"))
    register_function("inYPar", (dtype("?T:locus"),), dtype("bool"))
    register_function("contingency_table_test", (dtype("int32"),dtype("int32"),dtype("int32"),dtype("int32"),dtype("int32"),), dtype("struct{p_value: float64, odds_ratio: float64}"))
    register_function("toInt32", (dtype("bool"),), dtype("int32"))
    register_function("toInt32", (dtype("str"),), dtype("int32"))
    register_function("foobar1", (), dtype("int32"))
    register_function("toFloat64", (dtype("str"),), dtype("float64"))
    register_function("toFloat64", (dtype("bool"),), dtype("float64"))
    register_function("dbeta", (dtype("float64"),dtype("float64"),dtype("float64"),), dtype("float64"))
    register_function("Locus", (dtype("str"),), dtype("?T:locus"))
    register_function("Locus", (dtype("str"), dtype("int32"),), dtype("?T:locus"))
    register_function("LocusAlleles", (dtype("str"),), dtype("struct{locus: ?T, alleles: array}"))
    register_function("LocusInterval", (dtype("str"),dtype("bool"),), dtype("interval"))
    register_function("LocusInterval", (dtype("str"),dtype("int32"),dtype("int32"),dtype("bool"),dtype("bool"),dtype("bool"),), dtype("interval"))
    register_function("globalPosToLocus", (dtype("int64"),), dtype("?T:locus"))
    register_function("locusToGlobalPos", (dtype("?T:locus"),), dtype("int64"))
    register_function("liftoverLocus", (dtype(f"?T:locus"), dtype('float64'),), dtype(f"struct{{result:?U:locus,is_negative_strand:bool}}"))
    register_function("liftoverLocusInterval", (dtype(f"interval"), dtype('float64'),), dtype(f"struct{{result:interval,is_negative_strand:bool}}"))
    register_function("min_rep", (dtype("?T:locus"),dtype("array"),), dtype("struct{locus: ?T, alleles: array}"))
github hail-is / hail / hail / python / hail / ir / register_functions.py View on Github external
register_function("append", (dtype("array"),dtype("?T"),), dtype("array"))
    register_function("[:*]", (dtype("str"),dtype("int32"),), dtype("str"))
    register_function("[:*]", (dtype("array"),dtype("int32"),), dtype("array"))
    register_function("remove", (dtype("set"),dtype("?T"),), dtype("set"))
    register_function("[]", (dtype("str"),dtype("int32"),), dtype("str"))
    register_function("indexArray", (dtype("array"),dtype("int32"),), dtype("?T"))
    register_function("[]", (dtype("dict"),dtype("?key"),), dtype("?value"))
    register_function("dictToArray", (dtype("dict"),), dtype("array"))
    register_function("%", (dtype("array"),dtype("array"),), dtype("array"))
    register_function("%", (dtype("array"),dtype("?T"),), dtype("array"))
    register_function("%", (dtype("?T:numeric"),dtype("array"),), dtype("array"))
    register_function("%", (dtype("ndarray"),dtype("ndarray"),), dtype("ndarray"))
    register_function("%", (dtype("ndarray"),dtype("?T"),), dtype("ndarray"))
    register_function("%", (dtype("?T:numeric"),dtype("ndarray"),), dtype("ndarray"))
    register_function("dict", (dtype("array"),), dtype("dict"))
    register_function("dict", (dtype("set"),), dtype("dict"))
    register_function("keys", (dtype("dict"),), dtype("array"))
    register_function("min", (dtype("array"),), dtype("?T"))
    register_function("nanmin", (dtype("array"),), dtype("?T"))
    register_function("min", (dtype("?T"),dtype("?T"),), dtype("?T"))
    register_function("nanmin", (dtype("?T"),dtype("?T"),), dtype("?T"))
    register_function("min_ignore_missing", (dtype("?T"),dtype("?T"),), dtype("?T"))
    register_function("nanmin_ignore_missing", (dtype("?T"),dtype("?T"),), dtype("?T"))
    register_function("sum", (dtype("array"),), dtype("?T"))
    register_function("toInt64", (dtype("?T:numeric"),), dtype("int64"))
    register_function("contains", (dtype("dict"),dtype("?key"),), dtype("bool"))
    register_function("contains", (dtype("array"),dtype("?T"),), dtype("bool"))
    register_function("contains", (dtype("set"),dtype("?T"),), dtype("bool"))
    register_function("-", (dtype("array"),dtype("?T"),), dtype("array"))
    register_function("-", (dtype("array"),dtype("array"),), dtype("array"))
    register_function("-", (dtype("?T:numeric"),dtype("array"),), dtype("array"))
    register_function("-", (dtype("ndarray"),dtype("ndarray"),), dtype("ndarray"))
github hail-is / hail / hail / python / hail / ir / register_functions.py View on Github external
register_function("[*:*]", (dtype("str"),dtype("int32"),dtype("int32"),), dtype("str"))
    register_function("[*:*]", (dtype("array"),dtype("int32"),dtype("int32"),), dtype("array"))
    register_function("+", (dtype("array"),dtype("array"),), dtype("array"))
    register_function("+", (dtype("array"),dtype("?T"),), dtype("array"))
    register_function("+", (dtype("?T:numeric"),dtype("array"),), dtype("array"))
    register_function("+", (dtype("ndarray"),dtype("ndarray"),), dtype("ndarray"))
    register_function("+", (dtype("ndarray"), dtype("?T"),), dtype("ndarray"))
    register_function("+", (dtype("?T:numeric"),dtype("ndarray"),), dtype("ndarray"))
    register_function("**", (dtype("array"),dtype("array"),), dtype("array"))
    register_function("**", (dtype("array"),dtype("?T"),), dtype("array"))
    register_function("**", (dtype("?T:numeric"),dtype("array"),), dtype("array"))
    register_function("**", (dtype("ndarray"),dtype("ndarray"),), dtype("ndarray"))
    register_function("**", (dtype("ndarray"),dtype("?T"),), dtype("ndarray"))
    register_function("**", (dtype("?T:numeric"),dtype("ndarray"),), dtype("ndarray"))
    register_function("append", (dtype("array"),dtype("?T"),), dtype("array"))
    register_function("[:*]", (dtype("str"),dtype("int32"),), dtype("str"))
    register_function("[:*]", (dtype("array"),dtype("int32"),), dtype("array"))
    register_function("remove", (dtype("set"),dtype("?T"),), dtype("set"))
    register_function("[]", (dtype("str"),dtype("int32"),), dtype("str"))
    register_function("indexArray", (dtype("array"),dtype("int32"),), dtype("?T"))
    register_function("[]", (dtype("dict"),dtype("?key"),), dtype("?value"))
    register_function("dictToArray", (dtype("dict"),), dtype("array"))
    register_function("%", (dtype("array"),dtype("array"),), dtype("array"))
    register_function("%", (dtype("array"),dtype("?T"),), dtype("array"))
    register_function("%", (dtype("?T:numeric"),dtype("array"),), dtype("array"))
    register_function("%", (dtype("ndarray"),dtype("ndarray"),), dtype("ndarray"))
    register_function("%", (dtype("ndarray"),dtype("?T"),), dtype("ndarray"))
    register_function("%", (dtype("?T:numeric"),dtype("ndarray"),), dtype("ndarray"))
    register_function("dict", (dtype("array"),), dtype("dict"))
    register_function("dict", (dtype("set"),), dtype("dict"))
    register_function("keys", (dtype("dict"),), dtype("array"))
    register_function("min", (dtype("array"),), dtype("?T"))
github hail-is / hail / hail / python / hail / ir / register_functions.py View on Github external
register_function("Call", (dtype("array"),dtype("bool"),), dtype("call"))
    register_function("qchisqtail", (dtype("float64"),dtype("float64"),), dtype("float64"))
    register_function("binomTest", (dtype("int32"),dtype("int32"),dtype("float64"),dtype("int32"),), dtype("float64"))
    register_function("qpois", (dtype("float64"),dtype("float64"),), dtype("int32"))
    register_function("qpois", (dtype("float64"),dtype("float64"),dtype("bool"),dtype("bool"),), dtype("int32"))
    register_function("is_finite", (dtype("float32"),), dtype("bool"))
    register_function("is_finite", (dtype("float64"),), dtype("bool"))
    register_function("inYPar", (dtype("?T:locus"),), dtype("bool"))
    register_function("contingency_table_test", (dtype("int32"),dtype("int32"),dtype("int32"),dtype("int32"),dtype("int32"),), dtype("struct{p_value: float64, odds_ratio: float64}"))
    register_function("toInt32", (dtype("bool"),), dtype("int32"))
    register_function("toInt32", (dtype("str"),), dtype("int32"))
    register_function("foobar1", (), dtype("int32"))
    register_function("toFloat64", (dtype("str"),), dtype("float64"))
    register_function("toFloat64", (dtype("bool"),), dtype("float64"))
    register_function("dbeta", (dtype("float64"),dtype("float64"),dtype("float64"),), dtype("float64"))
    register_function("Locus", (dtype("str"),), dtype("?T:locus"))
    register_function("Locus", (dtype("str"), dtype("int32"),), dtype("?T:locus"))
    register_function("LocusAlleles", (dtype("str"),), dtype("struct{locus: ?T, alleles: array}"))
    register_function("LocusInterval", (dtype("str"),dtype("bool"),), dtype("interval"))
    register_function("LocusInterval", (dtype("str"),dtype("int32"),dtype("int32"),dtype("bool"),dtype("bool"),dtype("bool"),), dtype("interval"))
    register_function("globalPosToLocus", (dtype("int64"),), dtype("?T:locus"))
    register_function("locusToGlobalPos", (dtype("?T:locus"),), dtype("int64"))
    register_function("liftoverLocus", (dtype(f"?T:locus"), dtype('float64'),), dtype(f"struct{{result:?U:locus,is_negative_strand:bool}}"))
    register_function("liftoverLocusInterval", (dtype(f"interval"), dtype('float64'),), dtype(f"struct{{result:interval,is_negative_strand:bool}}"))
    register_function("min_rep", (dtype("?T:locus"),dtype("array"),), dtype("struct{locus: ?T, alleles: array}"))
    register_function("locus_windows_per_contig", (dtype("array>"),dtype("float64"),), dtype("tuple(array, array)"))
    register_function("toBoolean", (dtype("str"),), dtype("bool"))
    register_seeded_function("rand_bool", (dtype("float64"),), dtype("bool"))
    register_function("pchisqtail", (dtype("float64"),dtype("float64"),), dtype("float64"))
    register_seeded_function("rand_cat", (dtype("array"),), dtype("int32"))
    register_function("inYNonPar", (dtype("?T:locus"),), dtype("bool"))
    register_function("+", (dtype("str"),dtype("str"),), dtype("str"))