MRCIEU / ieugwasr

R interface to the IEU GWAS database API
https://mrcieu.github.io/ieugwasr/
Other
67 stars 23 forks source link

Anyone use this to calculate LD matrix for coloc-susie? Is there a bug in ld_matrix_local? #66

Open laleoarrow opened 2 months ago

laleoarrow commented 2 months ago

Here is my code for this susie-coloc, but the ld matrix seems a bit unusual as indicated by warning from susie:

In susie_suff_stat(XtX = XtX, Xty = Xty, n = n, yty = (n - 1) *  :
  IBSS algorithm did not converge in 100 iterations!
                  Please check consistency between summary statistics and LD matrix.
                  See https://stephenslab.github.io/susieR/articles/susierss_diagnostic.html

my code

x = out[[1]]
x = as.data.frame(x) # list can trans into a matrix directly but df would be just fine
# dim(x)
colnames(x)
x = TwoSampleMR::format_data(x, type = "exposure",
                             # phenotype_col = "Phenotype",
                             snp_col = "snp",
                             chr_col = "chr",
                             pos_col = "position",
                             effect_allele_col = "A1",
                             other_allele_col = "A2",
                             # eaf_col = "EAF",
                             beta_col = "beta",
                             # se_col = "SE",
                             pval_col = "pvalues",
                             min_pval = 1e-400
                             )
ld <- ieugwasr::ld_matrix_local(
  x$SNP,
  bfile = bfile,
  plink_bin = plinkbinr::get_plink_exe(),
  with_alleles = T
)
x2 = harmonise_ld_dat(x, ld)
susie_fit = susie_rss(x2$x$z.exposure, x2$ld, n=500) # unusual result, can not converge