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

Use of the pre-computed LD matrices #525

Open
SalemWerdyani opened this issue Dec 12, 2024 · 3 comments
Open

Use of the pre-computed LD matrices #525

SalemWerdyani opened this issue Dec 12, 2024 · 3 comments

Comments

@SalemWerdyani
Copy link

SalemWerdyani commented Dec 12, 2024

Hi Privé,

I am new to the LDperd2. It is a bit comfusing, following to match the target genetic data with the SumStat data, do I need to compute my LD matrices using the following code:

tmp <- tempfile(tmpdir = "file.size(corr$sbk) / 1024^3 ")

for (chr in 1:22) {
  
  # print(chr)
  
  ## indices in 'df_beta'
  ind.chr <- which(df_beta$chr == chr)
  ## indices in 'G'
  ind.chr2 <- df_beta$`_NUM_ID_`[ind.chr]
  
  corr0 <- snp_cor(G, ind.col = ind.chr2, size = 3 / 1000,
                   infos.pos = POS2[ind.chr2], ncores = NCORES)
  
  if (chr == 1) {
    ld <- Matrix::colSums(corr0^2)
    corr <- as_SFBM(corr0, tmp, compact = TRUE)
  } else {
    ld <- c(ld, Matrix::colSums(corr0^2))
    corr$add_columns(corr0, nrow(corr))
  }
}

I tried to run the above code for chr 22, but the system crashed.

If I want to use the pre-computed LD matrices, at what step can I use and what is the code?

Thank you,

@privefl
Copy link
Owner

privefl commented Dec 12, 2024

In the LDpred2 tutorial, there is an example R script using the pre-computed LD matrices.

@SalemWerdyani
Copy link
Author

Thank you, but it would be great if you can point to that example in your tutorial please.

@privefl
Copy link
Owner

privefl commented Dec 13, 2024

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

2 participants