Sample specific number of columns/rows

Is it possible to sample a specific number of columns instead of sampling with a probability (sample_cols), which gives slightly different number of columns depending on the seed.

If not - it could be a neat and simple feature to add.

You could do this by annotating with a column index, generating a set of indices that is the correct size, and then filtering columns to only those within that set.

So something like:

desired_columns = ... # Some regular python or hail expression that generates the list of column indices you want
column_set = hl.set(desired_columns)
mt = mt.add_col_index()
mt = mt.filter_cols(column_set.contains(mt.col_idx))

Thank you John. That is also my current solution. It could simply be a nice to have - like the sample_cols().