How to Extract list of all SNPs from bed file using Python

265 views Asked by At

I'm dealing with GWAS data, I'm trying to Extract a list of all SNPs and their Values from the Bed file with Additive and dominance components using Python. Please help with the Python command to Extract all SNP id and their Values

>>> G = read_plink1_bin("Obesity_Send.bed", verbose=False)

Output:

xarray.DataArray'genotype'sample: 522variant: 2655566

    Array   Chunk
Bytes   5.16 GiB    2.04 MiB
Shape   (522, 2655566)  (522, 1024)
Count   10376 Tasks 2594 Chunks
Type    float32 numpy.ndarray

Coordinates:
sample (sample) object '6' '74' '421' ... '433' '371' '47'
variant (variant) <U14 'variant0' ... 'variant2655565'
fid (sample) object '6' '74' '421' ... '433' '371' '47'
iid (sample) object '6' '74' '421' ... '433' '371' '47'
father (sample) object '0' '0' '0' '0' ... '0' '0' '0' '0'
mother (sample) object '0' '0' '0' '0' ... '0' '0' '0' '0'
gender (sample) object '2' '2' '2' '2' ... '1' '2' '2' '1'
trait (sample) object '2' '2' '2' '2' ... '-9' '-9' '-9'
chrom (variant) object '0' '0' '0' '0' ... '26' '26' '26'
snp (variant) object '200610-10' ... '200610-37'
cm (variant) float64 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0
pos (variant) int32 0 0 0 0 ... 16390 16391 16399 16482
a0 (variant) object '0' '0' '0' 'G' ... 'A' 'A' 'G' 'G'
a1 (variant) object 'A' 'A' 'A' 'A' ... 'G' 'G' 'A' 'A'

Desired Dataframe :

1. List of all SNPs with iid
2. Their allele values i.e a0 & a1
0

There are 0 answers