agg_table.describe()
--------------------------------------------------------
Type:
dict<struct {
gene: str,
pheno: str
}, struct {
non_miss: int64,
hom_ref: int64,
hom_var: int64,
het: int64
}>
--------------------------------------------------------
Source:
<hail.matrixtable.MatrixTable object at 0x7fcd265bd9d0>
Index:
[] (aggregated)
--------------------------------------------------------
Includes aggregation with index []
(Aggregation index may be promoted based on context)
--------------------------------------------------------
Then I try to extract data from the agg_table:
value = agg_table.get(hl.struct(gene=hl.literal('GENE_NAME'), pheno='case'))\
.get('het')
value
<Int64Expression of type int64>
But if I use any function I gen an error:
value.collect()
NotImplementedError: cannot convert aggregated expression to table
how could I get individual values from this data,
You’ve stumbled into a weird part of our interface where the error messages get a bit confusing!
The hl.agg.xxx functions always must be used inside a Table or MatrixTable method such as annotate, annotate_rows, aggregate. Note that agg_table.describe() indicates that age_table is an expression that is (aggregated).
The second approach gives you the two-dimensional structure you seek. Are you sure you’re using exactly what I posted above? Count_where should not return a dictionary.