omerwe / polyfun

PolyFun (POLYgenic FUNctionally-informed fine-mapping)
MIT License
85 stars 21 forks source link

Feature request: LD matrix as an R object #204

Open cdiazmun opened 1 month ago

cdiazmun commented 1 month ago

Dear developers,

Thank you very much for developing and mantaining polyfun.

I have been running susieR fine-mapper independently before trying it out within polyfun. The susieR team has a diagnostic pipeline to check the correctness of the analysis, in particular how well the external LD matrix fits the sample data (https://stephenslab.github.io/susieR/articles/susierss_diagnostic.html). To check this, one would need the LD matrix in a susieR compatible format. I tried to look up in the finemapper.py script to see how was the npz matrix handled and transformed, but my python knowledge is not enough to figure it out myself. Therefore, my question is if there would be an option to output the LD matrix as an R object as already exists for the main susie output (--susie-outfile).

Otherwise, could you let me know how to get this matrix myself?

I'm using the UKB LD matrices as suggested in your pipeline.

Thanks a lot and sorry for the bothering.

omerwe commented 1 month ago

HI @cdiazmun, unfortunately I don't have the bandwidth to work on this myself. However, I'm pretty sure that if you give ChatGPT-4 the code of the function load_ld_npz (found in https://github.com/omerwe/polyfun/blob/master/finemapper.py) and ask it to help you convert it to an R object, it can probably write suitable code for you to run. I would try this out as a first step.