We pushed a change today that expanded expression Dict support. This means that you can produce keys other than strings with the index(...)
function, and with annotate_global_py
.
The return type of the counter
aggregator has also changed to be a Dict, rather than an array of structs with fields ‘key’ and ‘value’. Here’s an example of something this lets you do:
>>> from collections import Counter
>>> vds = hc.import_vcf('src/test/resources/sample2.vcf')
>>> counter = Counter(vds.query_variants(
>>> 'variants.flatMap(v => v.altAlleles).counter()')[0])
>>> print(counter.most_common(5))
[(AltAllele(C, T), 129L),
(AltAllele(G, A), 112L),
(AltAllele(C, A), 60L),
(AltAllele(A, G), 46L),
(AltAllele(T, C), 44L)]