MRCIEU / TwoSampleMR

R package for performing 2-sample MR using MR-Base database
https://mrcieu.github.io/TwoSampleMR
Other
429 stars 176 forks source link

[BUG]: mv_extract_exposures_local return empty data frame #355

Open Xuemin-Wang opened 2 years ago

Xuemin-Wang commented 2 years ago

Hi TwoSampleMR developers and users,

Describe the bug (required)

I'm using TwoSampleMR_0.5.6 (installed by remotes::install_github("MRCIEU/TwoSampleMR"). While using mv_extract_exposures_local, I can see that some variants were removed during the clumping process but there are still a few independent variants remained. However, the data frame returned was empty (0 row).

Here is the code to extract variants. exposure_dat <- mv_extract_exposures_local( c("lead_snps_exp1.txt", "lead_snps_exp2.txt"), sep = "\t", phenotype_col = "trait", snp_col = "snp", beta_col = "beta", se_col = "se", eaf_col = "eaf", effect_allele_col = "ea", other_allele_col = "oa", pval_col = "p", min_pval = 1e-200, log_pval = FALSE, pval_threshold = 5e-8, clump_r2 = 0.001, clump_kb = 10000, harmonise_strictness = 2 )

Here are the log info: WARNING: Experimental function API: public: http://gwas-api.mrcieu.ac.uk/ Please look at vignettes for options on running this locally if you need to run many instances of this command. Clumping 9xiwQa, 6 variants, using EUR population reference Removing 2 of 6 variants due to LD with other variants or absence from LD reference panel Please look at vignettes for options on running this locally if you need to run many instances of this command. Clumping 6eiNCK, 13 variants, using EUR population reference Removing 2 of 13 variants due to LD with other variants or absence from LD reference panel Please look at vignettes for options on running this locally if you need to run many instances of this command. Clumping 1, 15 variants, using EUR population reference Removing 2 of 15 variants due to LD with other variants or absence from LD reference panel

The data frame returned was empty. dim(exposure_dat) [1] 0 9

sessionInfo() R version 4.1.0 (2021-05-18) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19043)

Matrix products: default

locale: [1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252 LC_MONETARY=English_Australia.1252 [4] LC_NUMERIC=C LC_TIME=English_Australia.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] TwoSampleMR_0.5.6 remotes_2.4.0 data.table_1.14.2
[4] dplyr_1.0.7 MendelianRandomization_0.5.1

loaded via a namespace (and not attached): [1] colorspace_2.0-3 rjson_0.2.21 ellipsis_0.3.2
[4] rprojroot_2.0.3 XVector_0.32.0 GenomicRanges_1.42.0
[7] rstudioapi_0.13 MatrixModels_0.5-0 bit64_4.0.5
[10] AnnotationDbi_1.54.1 fansi_0.5.0 xml2_1.3.3
[13] codetools_0.2-18 splines_4.1.0 cachem_1.0.6
[16] robustbase_0.93-9 ieugwasr_0.1.5 knitr_1.33
[19] jsonlite_1.8.0 Rsamtools_2.8.0 dbplyr_2.1.1
[22] png_0.1-7 compiler_4.1.0 httr_1.4.3
[25] assertthat_0.2.1 Matrix_1.4-1 fastmap_1.1.0
[28] lazyeval_0.2.2 cli_3.0.1 iterpc_0.4.2
[31] htmltools_0.5.2 quantreg_5.86 prettyunits_1.1.1
[34] tools_4.1.0 gmp_0.6-2 gtable_0.3.0
[37] glue_1.4.2 GenomeInfoDbData_1.2.6 rappdirs_0.3.3
[40] Rcpp_1.0.8.2 Biobase_2.52.0 vctrs_0.3.8
[43] Biostrings_2.58.0 arrangements_1.1.9 conquer_1.0.2
[46] rtracklayer_1.52.1 iterators_1.0.13 xfun_0.25
[49] stringr_1.4.0 ps_1.6.0 lifecycle_1.0.1
[52] restfulr_0.0.13 XML_3.99-0.9 DEoptimR_1.0-9
[55] zlibbioc_1.38.0 scales_1.2.0 BSgenome_1.60.0
[58] VariantAnnotation_1.40.0 hms_1.1.1 MatrixGenerics_1.4.3
[61] parallel_4.1.0 SummarizedExperiment_1.20.0 SparseM_1.81
[64] yaml_2.2.1 curl_4.3.2 memoise_2.0.1
[67] ggplot2_3.3.6 biomaRt_2.48.3 stringi_1.7.3
[70] RSQLite_2.2.14 S4Vectors_0.28.1 BiocIO_1.2.0
[73] nortest_1.0-4 foreach_1.5.1 gwasvcf_0.1.0
[76] GenomicFeatures_1.44.2 BiocGenerics_0.40.0 filelock_1.0.2
[79] pkgbuild_1.2.0 BiocParallel_1.26.2 shape_1.4.6
[82] GenomeInfoDb_1.26.7 rlang_1.0.2 pkgconfig_2.0.3
[85] matrixStats_0.62.0 bitops_1.0-7 evaluate_0.15
[88] lattice_0.20-44 purrr_0.3.4 GenomicAlignments_1.28.0
[91] htmlwidgets_1.5.4 processx_3.5.2 bit_4.0.4
[94] tidyselect_1.1.2 plyr_1.8.6 magrittr_2.0.1
[97] R6_2.5.1 IRanges_2.24.1 generics_0.1.2
[100] DelayedArray_0.18.0 DBI_1.1.2 withr_2.5.0
[103] pillar_1.7.0 survival_3.2-11 KEGGREST_1.32.0
[106] RCurl_1.98-1.6 tibble_3.1.3 crayon_1.5.1
[109] utf8_1.2.2 BiocFileCache_2.0.0 plotly_4.9.4.1
[112] rmarkdown_2.10 progress_1.2.2 grid_4.1.0
[115] callr_3.7.0 blob_1.2.3 mr.raps_0.2
[118] digest_0.6.27 tidyr_1.2.0 stats4_4.1.0
[121] munsell_0.5.0 glmnet_4.1-3 viridisLite_0.4.0

Many thanks, patrick

xuqiang9042 commented 2 years ago

I have the same bugs

LIUCHANYUAN1 commented 2 years ago

I have the same bugs

Shicheng-Guo commented 2 years ago

hopefully, it will be solved soon.

1667857557 commented 2 years ago

same problem

ruislab commented 2 years ago

I met the same problem before. I am not sure if my observation is correct but it looks like the mv function in TwosampleMR only keeps shared SNPs in exposures. Thus, if the SNP was in exposure1 but not exposure 2, it would be excluded.

LIUCHANYUAN1 commented 2 years ago

Yes, I think this is the reason for this problem.

------------------ 原始邮件 ------------------ 发件人: "MRCIEU/TwoSampleMR" @.>; 发送时间: 2022年9月27日(星期二) 中午11:10 @.>; 抄送: "Chanyuan @.**@.>; 主题:  Re: [MRCIEU/TwoSampleMR] [BUG]: mv_extract_exposures_local 返回空数据帧(问题 #355)

我以前遇到过同样的问题。我不确定我的观察是否正确,但看起来 TwosampleMR 中的 mv 函数仅在曝光中保留共享的 SNP。因此,如果 SNP 在暴露 1 中但不在暴露 2 中,它将被排除在外。

— 直接回复此邮件,在 GitHub 上查看,或取消订阅。 您收到此消息是因为您发表了评论。Message ID: @.***>