YangLabHKUST / MR-APSS

Mendelian Randomization accounting for Pleiotropy and Sample Structure using genome-wide summary statistics
42 stars 10 forks source link

[BUG]Prompting for non-conformable arguments when using MRAPSS::est_paras #4

Open WangYe661 opened 5 months ago

WangYe661 commented 5 months ago

Prompting for non-conformable arguments when using MRAPSS::est_paras.

Are the matrices multiplied in the correct dimension and order?

here is the code and output to repeat the problem.

library(MRAPSS)
library(TwoSampleMR)
IV=extract_instruments(c("ieu-a-27"),p1=5e-5)%>%
  MRAPSS::format_data(snp_col = "SNP",b_col = "beta.exposure",se_col = "se.exposure",
                      A1_col = "effect_allele.exposure",A2_col = "other_allele.exposure",
                      p_col = "pval.exposure",n=26836)
out=extract_outcome_data(IV$SNP,outcomes ="ebi-a-GCST90018808")%>%
  MRAPSS::format_data(snp_col = "SNP",b_col = "beta.outcome",se_col = "se.outcome",
                      A1_col = "effect_allele.outcome",A2_col = "other_allele.outcome",
                      p_col = "pval.outcome",n=470002)
MRAPSS::est_paras(IV,out,ldscore.dir = "data/eur_w_ld_chr")
Merge dat1 and dat2 by SNP ...
Harmonize the direction of SNP effects of exposure and outcome
Read in LD scores ... 
Add LD scores to the harmonized data set...                                                                                                         
The Harmonized data set will also be used for MR analysis 

Begin estimation of C and Omega using LDSC ...
Estimate heritability for trait 1 ...
Error in t(weighted.LD[from[i]:to[i], ]) %*% weighted.chi[from[i]:to[i],  : 
  non-conformable arguments
hxh0928 commented 1 month ago

MRAPSS uses genome-wide summary statistics as input to estimate the background parameters using LDSC. The use of only summary statistics of extracted IVs will lead to errors.