sgkit icon indicating copy to clipboard operation
sgkit copied to clipboard

How to read plink data in practice!

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

Sorry, I want to read the data in plin format, but the reading is always wrong. Could you please provide me with a reading template?

import sgkit as sg sg.io.plink.read_plink(path='/home/8_sgkit/00_plink', bed_path='1003_maf.0.01.bed', bim_path='1003_maf.0.01.bim', fam_path='1003_maf.0.01.fam', )

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'sgkit.io' has no attribute 'plink'

K-zhangfengwei avatar May 04 '23 08:05 K-zhangfengwei

Try

from sgkit.io.plink import read_plink
read_plink(...)

tomwhite avatar May 04 '23 09:05 tomwhite

Thank you very much. It worked

K-zhangfengwei avatar May 04 '23 09:05 K-zhangfengwei

Great - I think we need to add something to the docs.

tomwhite avatar May 04 '23 09:05 tomwhite

sorry, 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 05:05 K-zhangfengwei