I’m interested in using Hail to run a GWAS on the genotype difference between two pairs of individuals, and I wonder if there’s a way to subtract a person’s allele count at a locus by the corresponding allele count of another person at the same locus? I tried to subtract a number from mt.GT.n_alt_alleles(), but it returned SyntaxError: can’t assign to function call. May I ask for some suggestion? Thanks!
where you fill in the … with whatever you want to subtract. Then later on you just use mt.adjusted_n_alt_alleles instead of mt.GT.n_alt_alleles(). You’re creating a new entry field that reflects what you want, and then using that in your analysis.
hail.expr.expressions.base_expression.ExpressionException: Cannot combine expressions from different source objects.
Found fields from 1 objects:
<hail.matrixtable.MatrixTable object at 0x7fdc5b152a20>: [‘GT’]
May I ask for some suggestions about this? Thanks!
You can’t subtract two entry fields from two different matrix tables – the way to do this is with a join. The syntax below is shorthand for MatrixTable.index_entries, which conceptually does a lookup in mt2 per entry of mt1.