omerwe / polyfun

PolyFun (POLYgenic FUNctionally-informed fine-mapping)
MIT License
96 stars 22 forks source link

susie_rss has replaced susie_suff_stat? finemapper.py calling error #167

Closed devibole closed 1 year ago

devibole commented 1 year ago

Hi Omer,

I am trying to run a rather simple and straightforward code (emailing you my R file right now) using Polyfun for Fine-mapping with SuSiE, using pre-computed summary LD information from the UK Biobank, and am having errors where finemapper.py calls susieR. First, I got, susie_suff_stat() no longer accepts bhat value, susie_rss() now accepts this.

I did try to modify the finemapper.py file to take susierss() but for some of my phenotype summary stats I got [WARNING] R[write to console]: IBSS algorithm did not converge in 100 iterations! Please check consistency between summary statistics and LD matrix or [WARNING] R[write to console]: Residual variance is negative._

My guess is this is a susie update that needs to be incorporated into Polyfun?

Hope you can help with this!

Best,

Devika

omerwe commented 1 year ago

@devibole did you install SuSiE as part of PolyFun? This should install SuSiE v0.11.92, where susie_suff_stat should work as intended.

In any case, your issue seems to be the same as the one discussed here: #112. Can you please try the solution proposed there? (passing --susie-resvar 1)?

devibole commented 1 year ago

Hi Omer,

Thank you for your response! I do believe I installed SuSiE as part of Polyfun. Just to be safe, I started over using the Polyfun lock environment as well as the --susie-resvar 1 but still got the IBSS did not converge error.

(polyfun-lock) [godboledd@cn4276 polyfun]$ python finemapper.py --ld "/data/t2d/ld" --sumstats "/data/t2d/sumstats_align_snpvar" --n "343992" --chr 2 --start 27719900 --end 27746463 --method susie --susie-resvar 1 --max-num-causal 10 --out "/data/t2d/functrigl.gz"

[INFO] Loading sumstats file... [INFO] Loaded sumstats for 10620 SNPs in 0.12 seconds [INFO] cffi mode is CFFI_MODE.ANY [DEBUG] Looking for R home with: R RHOME [INFO] R home found: /gpfs/gsfs12/users/godboledd/conda/envs/polyfun-lock/lib/R [DEBUG] Looking for LD_LIBRARY_PATH with: /gpfs/gsfs12/users/godboledd/conda/envs/polyfun-lock/lib/R/bin/Rscript -e cat(Sys.getenv("LD_LIBRARY_PATH")) [INFO] R library path: [INFO] LD_LIBRARY_PATH: [DEBUG] cffi mode is InterfaceType.API [INFO] Default options to initialize R: rpy2, --quiet, --no-save [INFO] R is already initialized. No need to initialize. [INFO] Loading LD file /data/t2d/ld [INFO] Done in 7.29 seconds [INFO] Starting functionally-informed SuSiE fine-mapping for chromosome 2 BP 27719900-27746463 (90 SNPs) [INFO] Using susieR::susie_suff_stat() [INFO] Done in 0.65 seconds [INFO] Using rpy2 version 3.5.6 [INFO] Writing fine-mapping results to /data/t2d/functrigl.gz [WARNING] R[write to console]: Warning message:

[WARNING] R[write to console]: In (function (bhat, shat, R, n, var_y, XtX, Xty, yty, X_colmeans = NA, : [WARNING] R[write to console]:

[WARNING] R[write to console]: IBSS algorithm did not converge in 100 iterations! Please check consistency between summary statistics and LD matrix.

omerwe commented 1 year ago

@devibole there seems to be some kind of mismatch between your LD matrix and the summary statistics. There's no easy way to solve these issues, as SuSiE technically expects an LD matrix that's 100% consistent with the summary statistics (i.e., does not come from an LD reference panel --- see Table 3 in the PolyFun paper for details). However, I suggest some potential workarounds in issue #56, maybe one of these will work for you. Please let me know if one of these helped.

omerwe commented 1 year ago

@devibole can I close the issue?

devibole commented 1 year ago

Makes sense, trying these solutions. Thanks for the help!