sgkit icon indicating copy to clipboard operation
sgkit copied to clipboard

Subset the samples?

Open K-zhangfengwei opened this issue 2 years ago • 1 comments

I wanted to use sgkit to select some individuals from all samples, but the code in the references I looked for didn't work.

reference: [https://pystatgen.github.io/sgkit/latest/how_do_i.html#id10]

ds.sel(samples=ds.sample_id.isin(['Li_01', 'Li_02', 'Li_03',]))

KeyError: 'Indexing with a boolean dask array is not allowed. This will result in a dask array of unknown shape. Such arrays are unsupported by Xarray.Please compute the indexer first using .compute()'

K-zhangfengwei avatar May 05 '23 06:05 K-zhangfengwei

Can you try this as a workaround:

ds.sel(samples=ds.sample_id.isin(['Li_01', 'Li_02', 'Li_03',]).values)

Maybe this was due to a recent change - will look into it.

benjeffery avatar May 05 '23 09:05 benjeffery