privefl / paper-ldpred2

Paper discribing LDpred2
https://doi.org/10.1093/bioinformatics/btaa1029
16 stars 12 forks source link

Calculating genome-wide correlation matrix for new LD reference #13

Closed Janina24 closed 2 years ago

Janina24 commented 2 years ago

Dear Dr. Privé, I´m trying to work with the newly provided LD reference data.

The example code from your tutorial works well when using the HapMap3 variants with LD blocks calculating corr_chr. How has this code to be adjusted when using the new HapMap+ variants (only a genome-wide .map file available)

for (chr in 1:22) {

  cat(chr, ".. ", sep = "")

  ## indices in 'df_beta'
  ind.chr <- which(df_beta$chr == chr)
  ## indices in 'map_ldref'
  ind.chr2 <- df_beta$`_NUM_ID_`[ind.chr]
  ## indices in 'corr_chr'
  ind.chr3 <- match(ind.chr2, which(map_ldref$chr == chr))

  **corr_chr <- readRDS(paste0("ld-ref/LD_chr", chr, ".rds"))[ind.chr3, ind.chr3]**

  if (chr == 1) {
    corr <- as_SFBM(corr_chr, tmp)
  } else {
    corr$add_columns(corr_chr, nrow(corr))
  }
}

Thanks for your help!

privefl commented 2 years ago

I'll update the example script tomorrow morning.

privefl commented 2 years ago

Please check the new example R script from the tutorial.

Janina24 commented 2 years ago

One more question: for this new set of HapMap3+ variants do I need the LD_with_blocks_chr.rds files used for previous HapMap variants?

privefl commented 2 years ago

Either the previous HapMap3 set, or the new HapMap3+, the code should not have to change.

Janina24 commented 2 years ago

Thanks for your reply! Always helpful :)