Variant_qc, AC, AF allele order

Hello!

Can someone please clarify whether the order of elements in the array at mt.variant_qc.AC and mt.variant_qc.AF produced by hl.variant_qc has any significance?

The docs simply say that there is one element for each allele in the array. I would like to extract the AC and AF for the alternate allele.

Yes the order is exactly the same as the order in the alleles array. Assuming you’ve imported a VCF with import_vcf or used the VDS combiner, your alleles array will have the reference allele in position 0, the first alternative in position 1, etc.

You can extract the AC for the first alternate like this:

mt = mt.annotate_rows(
    AC_first_alt = mt.AC[1]
)

Great! Thank you!

1 Like