Issues with annotating a MT with a HT

I have a Hail Table and a MatrixTable, both are keyed by “locus” and “alleles”. I am not sure if I am doing this right, but I am doing ht[mt.row_key], but the StructExpression contains the fields from the MatrixTable, instead of the Hail table. I had thought that it should have the ht fields instead, can I know how to resolve this?

That should be correct – annotating each should look like:

# annotate ht from mt row fields:
ht = ht.annotate(mt_fields = mt.index_rows(ht.key))

# annotate mt from ht row fields:
mt = mt.annotate_rows(ht_fields = ht.index(mt.row_key))

You can print the types of each as follows:

print(ht.index(mt.row_key).dtype)
print(mt.index_rows(ht.row_key).dtype)