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

Susie with sparse LD matrices #225

Open
nlapier2 opened this issue Apr 22, 2024 · 3 comments
Open

Susie with sparse LD matrices #225

nlapier2 opened this issue Apr 22, 2024 · 3 comments

Comments

@nlapier2
Copy link

nlapier2 commented Apr 22, 2024

This is perhaps an atypical usage of susie-rss, but it would be nice if it were able to natively handle sparse LD matrices, e.g. from the Matrix library in R.

For example,

zscores = 1:5
R = diag(5)
N = 10000
library(susieR)
res = susie_rss(zscores, R, n=N)

runs just fine, but then

library(Matrix)
Rs = Matrix(R, sparse=T)
res = susie_rss(zscores, Rs, n=N)

yields

Error: Not compatible with requested type: [type=S4; target=double].

I ran into this issue when attempting to run susie on an LD matrix with a block diagonal structure (because it spanned multiple loci) that I was trying to exploit for faster computation and lower memory usage.

Incidentally, I seem to have been able to use sparse matrices in the cTWAS version of susie(-rss) -- not sure why.

@pcarbo
Copy link
Member

pcarbo commented Apr 23, 2024

@nlapier2 It appears that susie_rss does not currently support "R" being a sparse matrix.

As a temporary workaround, what about running susie_rss separately on each of the blocks?

@jhchung
Copy link

jhchung commented May 8, 2024

A separate, but related question when using sparse LD matricies.

If there are a lot of null entries (e.g getting ld from a precomputed LD reference with minimum R2 cutoffs), i usually set these to 0. How does the credible set purity calculation take this into account? If it takes the upper triangle, will that mean the minimum purity will be 0?

i think this is related to issue #122

@pcarbo
Copy link
Member

pcarbo commented May 9, 2024

@jhchung Correct; if SNPs i, j are in the same CS and R[i,j] = 0, then the minimum correlation of the CS will be zero.

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

3 participants