ZikunY / CARMA

GWAS genetics Fine-mapping method
GNU General Public License v3.0
20 stars 7 forks source link

Error: pinv(): svd failed in some LD blocks #25

Closed teresa-sansan closed 2 months ago

teresa-sansan commented 2 months ago

Hi Zikun,

I have encountered this "Error: pinv(): svd failed" error in many chunks of my LD (around 50%). And I am not sure what is causing this. I used the printing.log=T tag, so I do have the S value.

There are 2783 SNPs in this chunk, and I was checking the S values that have this error. Most of them are big (i.e. S = 2685, S = 2699, S = 2761), however, there are also some smaller values like 453 and 303. And in some cases the big S value doesn't cause the error. (i.e. S = 2756, S = 2681)

Sometimes it gets to run for several iterations, but sometimes I get this error on the first run. I attached the log file for the sucessed run and the failed ones below.

image

Do you have any suggestions how I can solve this issue?

Thanks, Teresa

ZikunY commented 2 months ago

Hi Teresa,

The S values here, either larger or small, only represents the index of the variants considered to be causal by CARMA. For example, S = 2685 means that the 2685th SNP is considered to be causal at the moment of the computation.

There could be a number of reasons for this error message. I guess the starting point is to check,

  1. if is there any NA or Inf in the LD matrix?
  2. If the LD matrix is symmetric?

Please let me know if this could solve the problem. Thank you.

Best, Zikun

teresa-sansan commented 2 months ago

Hi Zikun,

Thanks for the suggestion. I looked into the ld matrix and I found a lot of them do have NaN, even in the blocks that ran successfully. However, the number of NaN failed regions is significantly higher than the success regions so this could be the cause that it failed.

I'll check what is causing the nan in the ld matrix and try removing them and see if this helps!

Thanks, Teresa

teresa-sansan commented 2 months ago

Hi Zikun,

It did work after I removed the nan in LD! I will close this issue for now.

Thanks again!

Best, Teresa

ZikunY commented 2 months ago

Glad it works! Horray!