Hello there!
I already did linear regression, and get a corresponded matrix table for further polygenic score calculation per individual. My MatrixTable has the next structure:
mt.describe()
----------------------------------------
Global fields:
None
----------------------------------------
Column fields:
's': str
----------------------------------------
Row fields:
'locus': locus<GRCh37>
'cvas': struct {
beta: str,
pval: str
}
----------------------------------------
Entry fields:
'GT': call
Then I want to sum over all variants and calculate (n_non_ref_counts * beta) for each individual.
mt = mt.annotate_rows(whole_dataset = 1)
mts = mt.group_rows_by(summary_stat = mt.whole_dataset)\
.aggregate(risk_score = mt.GT.n_alt_alleles()*hl.float(mt.cvas.beta))
but I get next to an error:
ExpressionException: scope violation: 'GroupedMatrixTable.aggregate_entries' expects an expression indexed by ['column']
Found indices ['column', 'row'], with unexpected indices ['row']. Invalid fields:
'GT' (indices ['column', 'row'])
'cvas' (indices ['row'])
'GroupedMatrixTable.aggregate_entries' supports aggregation over axes ['column', 'row'], so these fields may appear inside an aggregator function.