I ran into a situation today (trying to output some representative HomRef genotypes so I could look at allele balance behavior for those calls) where the ability to downsample samples would have been nice. I did use the downsamplevariants function, too.
Hey Kyle! You can do this now. Jon added a function in the expr language pcoin(p)
which will give you a random flip of a coin with probability p
.
This will keep 10% (approximately) of samples:
vds.filter_samples_expr('pcoin(.1)')
Cool! That’s useful. Thanks for the update.