Annotate_rows in Hail0.2 VS annotate_variants_expr(expr) in Hail0.1


I am re-building Hail0.1 qc script with Hail0.2.
I searched doc, but not sure about this:

In hail0.1, we tried to “Replace INFO field allele count with the corrected variant qc allele count value”
vds.annotate_variants_expr(‘ = va.qc.AC’)

In hail0.2, I try to do the same thing via: mt.annotate_rows([0] = mt.variant_qc.AC[0],[1] = mt.variant_qc.AC[1]), I am not 100% sure whether this command line will do what I need?

Any help are welcome. Thanks.

The annotate_rows command doesn’t work quite like this.

mt.annotate_rows([0] = mt.variant_qc.AC[0],[1] = mt.variant_qc.AC[1])

You can only annotate “fields” and you can only update one level of field at a time. Try this:

    info = = mt.variant_qc.AC)

Unfortunately, this is more verbose than the 0.1 syntax. My apologies! We have not yet discovered a succinct way to write this in Python 3.

The advantage of this style of syntax is that a Python IDE (such as PyCharm) can tell you what operations are available when you write! You should get a tooltip that lists all the available options.

1 Like