bvilhjal / ldpred

MIT License
96 stars 57 forks source link

keyError: 'raw_snps' #151

Open jielab opened 4 years ago

jielab commented 4 years ago

hi, there:

please see the error message. I saw a few users asked this question since last year. Someone said to change line 121 in coord_genotypes.py. but could not even find where that file is. I simply run "pip install ldpred" without git clone anything.

Can someone please let me know how to fix this. I thought that LDpred is a quite mature software since it is widely cited. I just installed ldpred today, so I assume that i got the latest version.

Best regards, jie

捕获

PradoVarathan commented 4 years ago

I had a similar error but installing ldpred version 1.0.10 solved this issue. Apparently, the author's had made a change in that coordination python file for the latest version. Try doing pip install ldpred==1.0.10

jielab commented 4 years ago

Thanks, Pradeep!

The version that I used was from yesterday, version 1.0.11, even newer than 1.0.10. I will try the 1.0.10 version anyway then. Can I get in touch with you since you run this successfully. My email is jiehuang001@gmail.com.

Thanks! Jie

PradoVarathan commented 4 years ago

I had the same error for the first step and I completed all the steps, but since I had a large dataset, I had to switch to LDPred2. But sure, if I am able to resolve it, I can try!

jielab commented 4 years ago

Thanks, Pradeep!

I removed 1.0.11 and install ldpred==1.0.10, now it worked!

You said that you switch to LDpred2 because your data is large. I also wanted to try LDpred2. I was looking at this page https://privefl.github.io/bigsnpr/articles/LDpred2.html, but wondered how could these R scripts deal with larger dataset?

So, did you make your large data work, by following the exact steps on this page https://privefl.github.io/bigsnpr/articles/LDpred2.html? Or there might be some similar fixes like that one, that you could share?

Thanks! Jie

PradoVarathan commented 4 years ago

Glad to help!

I am still working on the scripts by submitting into a server with more computation power since it takes a lot of memory with larger datasets. I am still in the process but will surely let you know in case of any issues I come up with. Yes, I did follow the exact steps as provided in the instructional page in LDPred2.

jielab commented 4 years ago

Hi, Pradeep: I am now installing LDpred-2. Please see the screenshot below, I got some error messages.

Can you please let me know how to fix this?

Thank you & best regards, jie

捕获

PradoVarathan commented 4 years ago

Hi! Try installing bigstatsr seperately prior to installing bigsnpr. Also, LDPred2 has a seperate github page and raising issues there would be helpful for future users too! Thanks!

bbitarello commented 3 years ago

I am having the same error. I want to use 1.10.11 because it fixed other issues. Did anyone find a solution for this: KeyError: 'raw_snps'?

buutrg commented 3 years ago

In the ldpred/coord_genotypes.py you can edit the data_keys in def filter_coord_data(cd, filter_mask) with: data_keys = ['raw_snps_ref', 'snp_stds_ref', 'snp_means_ref', 'freqs_ref', 'ps', 'ns', 'positions', 'nts', 'sids','betas','log_odds']

Initially I see the dictionary object's key was initiated with raw_snps_ref not raw_snps

coord_data_dict = {'chrom': 'chrom_%d' % chrom, 
                           'raw_snps_ref': raw_snps, 
                           'snp_stds_ref': snp_stds, 
                           'snp_means_ref': snp_means, 
                           'freqs_ref': freqs,
                           'ps': ps,
                           'ns': ns,
                           'positions': positions,
                           'nts': nts,
                           'sids': sids,
                           'betas': betas,
                           'log_odds': log_odds}

Hope this helps!