jean997 / cause

R package for CAUSE
https://jean997.github.io/cause/
52 stars 15 forks source link

res<-cause(X=X,variants =top_vars,param_ests = params ) Error: Not all `variants` are in data. #44

Open umbrellaling opened 9 months ago

umbrellaling commented 9 months ago

Hi, I got warnings when fitting results. X_clump <- X %>% rename(rsid = snp, pval = p1) %>% ieugwasr::ld_clump(dat = ., clump_r2 = r2_thresh, clump_p = pval_thresh, plink_bin = genetics.binaRies::get_plink_binary(), pop = "EUR") library(ieugwasr) a <- tophits(id="ieu-a-2", clump=0) head(a) b <- ld_clump( dplyr::tibble(rsid=a$rsid, pval=a$p, id=a$id) ) devtools::install_github("explodecomputer/genetics.binaRies") genetics.binaRies::get_plink_binary() colnames(X)[1]<-c("rsid") colnames(X)[4]<-c("pval") ld_clump(dat = X,clump_r2 = 0.01,clump_p = 1e-3,pop = "EUR", plink_bin = genetics.binaRies::get_plink_binary(), bfile = "/Users/unbrella/Desktop/1kg.v3/EUR") X_clump<-ld_clump(dat = X,clump_r2 = 0.01,clump_p = 1e-3,pop = "EUR", plink_bin = genetics.binaRies::get_plink_binary(), bfile = "/Users/unbrella/Desktop/1kg.v3/EUR") res<-cause(X=X,variants =top_vars,param_ests = params ) Error: Not all variants are in data. Please help to sovle this problem,thank you !!

jean997 commented 9 months ago

This error means that there are variants in your top_vars list that are not in X. I don's see in your code where top_vars came from but hopefully that helps.

umbrellaling commented 9 months ago

This error means that there are variants in your top_vars list that are not in X. I don's see in your code where top_vars came from but hopefully that helps.

Hi jean997, here is my code to get top_vars "top_vars <- X_clump$rsid",when I merge top_vars and X data, it's completely all "variants" are in data, but when I rerun "es<-cause(X=X,variants =top_vars,param_ests = params )" I still got this Error: Not all variants are in data.

jean997 commented 9 months ago

Try

all(top_vars %in% X$snp)

If that gives FALSE you have found the problem. Otherwise let me know.