Hello Hail team,
I have two different Matrix tables (MTs). The name of MTs are mt and allmt.
The reference genome of allmt is “GRCh37” and that of mt is “hs37d5” which is kind of GRCh37.
What I wanted to do is as below.
allmt = allmt.annotate_rows(MAF_tommo = mt.rows()[allmt.row_key].info.AF,
AC_tommo = mt.rows()[allmt.row_key].info.AC,
AN_tommo = mt.rows()[allmt.row_key].info.AN)
However, the code generated error messages as below.
-------------------------------------------------------------------------
TableIndexKeyError Traceback (most recent call last)
~/miniconda3/envs/hail/lib/python3.7/site-packages/hail/table.py in index(self, all_matches, *exprs)
1777 try:
-> 1778 return self._index(*exprs, all_matches=all_matches)
1779 except TableIndexKeyError as err:
~/miniconda3/envs/hail/lib/python3.7/site-packages/hail/table.py in _index(self, all_matches, *exprs)
1848 and isinstance(exprs[0], StructExpression)):
-> 1849 return self._index(*exprs[0].values(), all_matches=all_matches)
1850
~/miniconda3/envs/hail/lib/python3.7/site-packages/hail/table.py in _index(self, all_matches, *exprs)
1851 if not is_interval:
-> 1852 raise TableIndexKeyError(self.key.dtype, exprs)
1853
TableIndexKeyError:
During handling of the above exception, another exception occurred:
ExpressionException Traceback (most recent call last)
<ipython-input-49-3a9bf305d4d1> in <module>
----> 1 allmt = allmt.annotate_rows(MAF_tommo = mt.rows()[allmt.row_key].info.AF,
2 AC_tommo = mt.rows()[allmt.row_key].info.AC,
3 AN_tommo = mt.rows()[allmt.row_key].info.AN)
~/miniconda3/envs/hail/lib/python3.7/site-packages/hail/table.py in __getitem__(self, item)
374
375 try:
--> 376 return self.index(*wrap_to_tuple(item))
377 except TypeError as e:
378 raise TypeError("Table.__getitem__: invalid index argument(s)\n"
~/miniconda3/envs/hail/lib/python3.7/site-packages/hail/table.py in index(self, all_matches, *exprs)
1778 return self._index(*exprs, all_matches=all_matches)
1779 except TableIndexKeyError as err:
-> 1780 raise ExpressionException(f"Key type mismatch: cannot index table with given expressions:\n"
1781 f" Table key: {', '.join(str(t) for t in err.key_type.values()) or '<<<empty key>>>'}\n"
1782 f" Index Expressions: {', '.join(str(e.dtype) for e in err.index_expressions)}")
ExpressionException: Key type mismatch: cannot index table with given expressions:
Table key: locus<hs37d5>, array<str>
Index Expressions: locus<GRCh37>, array<str>
I think this error is because of the different reference genome.
Could you let me know if there are some ways to solve this problem?
Thanks in advance.