-
Notifications
You must be signed in to change notification settings - Fork 243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ClassCastException when comparing hl.Locus to row key #13046
Comments
I've eventually reproduced this. I was a bit thrown that the error message in this issue is different to the one in the op. Here's my work so far: # create `variants` heterogeneous array as described in the op
variants = [["10", 123, "G", "C"], ["10", 456, "T", "A"]]
# not sure how the `mt` was created, but not sure it's important for the
# purposes of reproducing the failure
mt = hl.struct(
locus=hl.locus(contig='10', pos=60515, reference_genome='GRCh37'),
alleles=['C', 'T']
)
expr = hl.any(
lambda x:
(mt.locus.contig == hl.literal(x[0])) & \
(mt.locus.position == hl.literal(int(x[1]))) & \
(mt.alleles == hl.literal(x[2:])),
variants
)
hl.eval(expr) This fails in the call to
So, hail doesn't support heterogeneous arrays. Converting to a homogeneous array: variants = [("10", 123, ["G", "C"]), ("10", 456, ["T", "A"])]
expr = hl.any(
lambda x:
(mt.locus.contig == hl.literal(x[0])) & \
(mt.locus.position == hl.literal(int(x[1]))) & \
(mt.alleles == hl.literal(x[2])),
variants
)
hl.eval(expr) Leads to the following error (which looks like the bug!):
Note that the following works (removing the literal): # use homogeneous array type
variants = [("10", 123, ["G", "C"]), ("10", 456, ["T", "A"])]
# `x` is already an expression, with the literal array captured by `any`
expr = hl.any(
lambda x:
(mt.locus.contig == x[0]) & \
(mt.locus.position == x[1]) & \
(mt.alleles == x[2]),
variants
)
hl.eval(expr) |
I believe the code is behaving as designed. The error message, however, leaves a lot to be desired. A few take-aways:
Off the top of my head, a couple of ways to proceed:
|
Ah - I miss read the orignal forum post, something about scrollbars within scrollbars always confuses me. Onto the |
Not reproducable in main (3e0bb6f) |
Hmm. The ClassCastException in the linked comment does indeed seem not reproducible. I've asked for more detail from Simon https://discuss.hail.is/t/subset-matrix-table-to-a-medium-sized-list-of-variants/3362/9?u=danking |
What happened?
Details here: https://discuss.hail.is/t/subset-matrix-table-to-a-medium-sized-list-of-variants/3362/5
Version
0.2.105
Relevant log output
No response
The text was updated successfully, but these errors were encountered: