Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seeking advice about error: XtX is not a symmetric matrix #49

Open
Jesson-mark opened this issue Jan 2, 2024 · 1 comment
Open

Seeking advice about error: XtX is not a symmetric matrix #49

Jesson-mark opened this issue Jan 2, 2024 · 1 comment

Comments

@Jesson-mark
Copy link

Hi everyone,
I'm using mvSuSiE to do fine-mapping for two highly correlated traits (rg=0.6, estimated by LDSC) in UKBB at one 1Mb region.

Before running mvSuSiE , I performed the single-trait fine-mapping using SuSiE for each of the two traits at the same region and got some credible sets for these two traits.

Then I want to perform multi-trait fine-mapping for these two traits. I followed the vignette to prepare inputs for mvSuSiE.
Using the criteria: INFO<0.9, MAF<0.01 and P < 1, I got 2636 SNPs in this region and extracted in-sample LD for these SNPs.
Then I used the prior as specified in the vignette, with the code:

prior <- create_mixture_prior(list(matrices = simdata$par$U,
                                    weights = simdata$par$w),
                                null_weight = 0)

As for the estimate of residual variance, I also followed the codes in that vignette:

null_markers <- which(apply(abs(Z),1,max) < 2)
length(null_markers)

Z_null <- Z[null_markers,]
Vest <- cov(Z_null)
Vest

These codes filtered 922 null markers and the Vest is:

          trait1    trait2
trait1 1.6847297 0.4521737
trait2 0.4521737 0.8353627

Then I used the following codes to run mvSuSiE:

num_snps <- nrow(df) # number of snps used to perform fine-mapping
R <- load_R(ldfile, num_snps = num_snps) # load LD matrix

N <- 450000
tolerance <- 0.01

fit_rss <- mvsusie_rss(Z = Z, R = R, N = N,
                       prior_variance = prior,
                       residual_variance = Vest,
                       estimate_prior_variance = TRUE,
                       tol = tolerance)

However, mvsusie_rss exited with an error: Error in initialize(...) : XtX is not a symmetric matrix.

Does anyone could give some advice about why this error occured?

Any advice will help!
Thanks for your reply!

@Jesson-mark
Copy link
Author

Hi everyone,
I have resolved the error above and figured out the reason. It is because the rownames and colnames of LD matrix are not same.

However, I have another question about the esidual variance matrix.
I noticed that in your preprint paper, the esidual variance matrix of UKBB is estimated using 1,950 SNPs (2 SNPs with small z-scores were selected from each of the 975 fine-mapping regions). Is there only 2 SNPs at each region with small z-scores or you just selected 2 SNPs with the two smallest z-scores among each region?

I wonder if one could use all genome-wide SNPs with small z-scores (e.g. absolute z-score less than 1 or 2) or all SNPs with z-scores equaling to zero to estimate the esidual variance matrix. I also wonder if there is a suggestive minimum number of SNPs that could give an reasonable estimate of the esidual variance matrix.

Any advice will help!
Thanks for your reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant