Thanks. When trying this method on my dataset, an error occurred.
>>> import hail as hl
>>> mt = hl.import_plink("/scratch/zhupy/ukb_imp_chr1_v3_pruned.bed",
... "/scratch/zhupy/ukb_imp_chr1_v3_pruned.bim",
... "/scratch/zhupy/ukb_imp_chr1_v3_pruned.fam")
Initializing Hail with default parameters...
2020-12-02 21:54:27 WARN NativeCodeLoader:62 - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Setting default log level to "WARN".
To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel).
2020-12-02 21:54:31 WARN Hail:37 - This Hail JAR was compiled for Spark 2.4.5, running with Spark 2.4.1.
Compatibility is not guaranteed.
Running on Apache Spark version 2.4.1
SparkUI available at http://cdr469.int.cedar.computecanada.ca:4040
Welcome to
__ __ <>__
/ /_/ /__ __/ /
/ __ / _ `/ / /
/_/ /_/\_,_/_/_/ version 0.2.60-de1845e1c2f6
LOGGING: writing to /scratch/zhupy/hail-20201202-1354-0.2.60-de1845e1c2f6.log
2020-12-02 21:54:55 Hail: INFO: Found 487409 samples in fam file.
2020-12-02 21:54:55 Hail: INFO: Found 1220764 variants in bim file.
>>> glm_result = hl.import_table("/home/zhupy/projects/def-kwalley/zhupy/hli/data/plink2.LDL.glm.linear.tsv",types={"BETA":hl.tfloat64}).select("BETA")
2020-12-02 21:55:04 Hail: INFO: Reading table without type imputation
Loading field 'CHROM' as type str (not specified)
Loading field 'POS' as type str (not specified)
Loading field 'ID' as type str (not specified)
Loading field 'REF' as type str (not specified)
Loading field 'ALT' as type str (not specified)
Loading field 'A1' as type str (not specified)
Loading field 'TEST' as type str (not specified)
Loading field 'OBS_CT' as type str (not specified)
Loading field 'BETA' as type float64 (user-supplied)
Loading field 'SE' as type str (not specified)
Loading field 'T_STAT' as type str (not specified)
Loading field 'P' as type str (not specified)
Loading field 'ERRCODE' as type str (not specified)
>>> WINDOW_SIZE = 1000
>>> WINDOW_DIFF = WINDOW_SIZE // 2
>>> mt = mt.annotate_entries(new_entry_value = mt.GT.n_alt_alleles() * glm_result[mt.row_key].table_value)
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/hail/table.py", line 1583, in index
return self._index(*exprs, all_matches=all_matches)
File "/usr/local/lib/python3.6/site-packages/hail/table.py", line 1654, in _index
return self._index(*exprs[0].values(), all_matches=all_matches)
File "/usr/local/lib/python3.6/site-packages/hail/table.py", line 1657, in _index
raise TableIndexKeyError(self.key.dtype, exprs)
hail.table.TableIndexKeyError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/site-packages/hail/table.py", line 375, in __getitem__
return self.index(*wrap_to_tuple(item))
File "/usr/local/lib/python3.6/site-packages/hail/table.py", line 1585, in index
raise ExpressionException(f"Key type mismatch: cannot index table with given expressions:\n"
hail.expr.expressions.base_expression.ExpressionException: Key type mismatch: cannot index table with given expressions:
Table key: <<<empty key>>>
Index Expressions: locus<GRCh37>, array<str>
I also couldn’t load the dataset that you mentioned.
>>> mt0 = hl.balding_nichols_model(1, 3, 10)
ERROR:root:Exception while sending command.
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/py4j/java_gateway.py", line 1159, in send_command
raise Py4JNetworkError("Answer from Java side is empty")
py4j.protocol.Py4JNetworkError: Answer from Java side is empty
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/py4j/java_gateway.py", line 985, in send_command
response = connection.send_command(command)
File "/usr/local/lib/python3.6/site-packages/py4j/java_gateway.py", line 1164, in send_command
"Error while receiving", e, proto.ERROR_ON_RECEIVE)
py4j.protocol.Py4JNetworkError: Error while receiving
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<decorator-gen-1715>", line 2, in balding_nichols_model
File "/usr/local/lib/python3.6/site-packages/hail/typecheck/check.py", line 614, in wrapper
return __original_func(*args_, **kwargs_)
File "/usr/local/lib/python3.6/site-packages/hail/methods/statgen.py", line 2443, in balding_nichols_model
.format(n_populations, n_samples, n_variants))
File "/usr/local/lib/python3.6/site-packages/hail/utils/java.py", line 168, in info
Env.backend().logger.info(msg)
File "/usr/local/lib/python3.6/site-packages/hail/backend/spark_backend.py", line 116, in info
self._log_pkg.info(msg)
File "/usr/local/lib/python3.6/site-packages/py4j/java_gateway.py", line 1257, in __call__
answer, self.gateway_client, self.target_id, self.name)
File "/usr/local/lib/python3.6/site-packages/hail/backend/py4j_backend.py", line 16, in deco
return f(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/py4j/protocol.py", line 336, in get_return_value
format(target_id, ".", name))
py4j.protocol.Py4JError: An error occurred while calling o0.info