Running impute_sex

Hey, I have a problem when running impute_sex. Can you help me on this ?
Here is what I get as output:

---------------------------------------------------------------------------
ExpressionException                       Traceback (most recent call last)
~/anaconda3/envs/hail/lib/python3.7/site-packages/hail/expr/expressions/expression_typecheck.py in check(self, x, caller, param)
     76         try:
---> 77             return self.coerce(to_expr(x))
     78         except ExpressionException as e:

~/anaconda3/envs/hail/lib/python3.7/site-packages/hail/expr/expressions/base_expression.py in to_expr(e, dtype)
    206         return e
--> 207     return cast_expr(e, dtype)
    208 

~/anaconda3/envs/hail/lib/python3.7/site-packages/hail/expr/expressions/base_expression.py in cast_expr(e, dtype)
    211     if not dtype:
--> 212         dtype = impute_type(e)
    213     x = _to_expr(e, dtype)

~/anaconda3/envs/hail/lib/python3.7/site-packages/hail/expr/expressions/base_expression.py in impute_type(x)
    157         if len(x) == 0:
--> 158             raise ExpressionException("Cannot impute type of empty list. Use 'hl.empty_array' to create an empty array.")
    159         ts = {impute_type(element) for element in x}

ExpressionException: Cannot impute type of empty list. Use 'hl.empty_array' to create an empty array.

The above exception was the direct cause of the following exception:

TypecheckFailure                          Traceback (most recent call last)
~/anaconda3/envs/hail/lib/python3.7/site-packages/hail/typecheck/check.py in check_all(f, args, kwargs, checks, is_method)
    540                         arg = args[i]
--> 541                         args_.append(checker.check(arg, name, arg_name))
    542                     # passed as keyword

~/anaconda3/envs/hail/lib/python3.7/site-packages/hail/expr/expressions/expression_typecheck.py in check(self, x, caller, param)
     78         except ExpressionException as e:
---> 79             raise TypecheckFailure from e
     80 

TypecheckFailure: 

The above exception was the direct cause of the following exception:

TypeError                                 Traceback (most recent call last)
<ipython-input-381-6636ce6405c8> in <module>
----> 1 imputed_sex = hl.impute_sex(mt.GT)

<decorator-gen-1558> in impute_sex(call, aaf_threshold, include_par, female_threshold, male_threshold, aaf)

~/anaconda3/envs/hail/lib/python3.7/site-packages/hail/typecheck/check.py in wrapper(__original_func, *args, **kwargs)
    612     def wrapper(__original_func, *args, **kwargs):
    613         args_, kwargs_ = check_all(__original_func, args, kwargs, checkers, is_method=is_method)
--> 614         return __original_func(*args_, **kwargs_)
    615 
    616     return wrapper

~/anaconda3/envs/hail/lib/python3.7/site-packages/hail/methods/statgen.py in impute_sex(call, aaf_threshold, include_par, female_threshold, male_threshold, aaf)
    146     rg = mt.locus.dtype.reference_genome
    147     mt = hl.filter_intervals(mt,
--> 148                              hl.map(lambda x_contig: hl.parse_locus_interval(x_contig, rg), rg.x_contigs),
    149                              keep=True)
    150     if not include_par:

<decorator-gen-934> in map(f, collection)

~/anaconda3/envs/hail/lib/python3.7/site-packages/hail/typecheck/check.py in wrapper(__original_func, *args, **kwargs)
    611     @decorator
    612     def wrapper(__original_func, *args, **kwargs):
--> 613         args_, kwargs_ = check_all(__original_func, args, kwargs, checkers, is_method=is_method)
    614         return __original_func(*args_, **kwargs_)
    615 

~/anaconda3/envs/hail/lib/python3.7/site-packages/hail/typecheck/check.py in check_all(f, args, kwargs, checks, is_method)
    565                                     expected=checker.expects(),
    566                                     found=checker.format(arg)
--> 567                                 )) from e
    568         elif param.kind == param.VAR_POSITIONAL:
    569             # consume the rest of the positional arguments

TypeError: map: parameter 'collection': expected expression of type set<any> or array<any> or ndarray<any>, found list: []

can you share the script where you’re using this?

Also, what reference genome are you using?

my_rg =hl.ReferenceGenome("hg38", ["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","X","Y","MT"], {"1": 248956422, "2": 242193529, "3": 198295559, "4": 190214555, "5": 181538259,"6": 170805979, "7": 159345973, "8": 145138636, "9": 138394717, "10": 133797422,"11": 135086622, "12": 133275309, "13": 114364328, "14": 107043718, "15": 101991189,"16": 90338345, "17": 83257441, "18": 80373285, "19": 58617616, "20": 64444167, "21": 46709983, "22": 50818468, "X": 156040895, "Y": 57227415, "MT": 16569})

hl.import_vcf('my_vcf.vcf', reference_genome=my_rg).write('my_mt.mt', overwrite=True)

mt = hl.read_matrix_table('my_mt.mt')

imputed_sex = hl.impute_sex(mt.GT)