TwosampleMR
Liangping Cheng
12 三月, 2024
学习使用TwosampleMR
首先是安装必要的包,有的网络是打不开github的所以需要魔法帮忙下载,下载好了之后就能在自己的目录下安装了。
#install.packages("devtools")
#devtools::install_local("TwoSampleMR-master.zip")
#devtools::install_local("MRInstruments-master.zip")
加载R包,获取数据
You can also embed plots, for example:
## TwoSampleMR version 0.5.10
## [>] New: Option to use non-European LD reference panels for clumping etc
## [>] Some studies temporarily quarantined to verify effect allele
## [>] See news(package='TwoSampleMR') and https://gwas.mrcieu.ac.uk for further details
## API: public: http://gwas-api.mrcieu.ac.uk/
## OpenGWAS updates:
## Date: 2024-03-07
## [>] There is exceptional load on the OpenGWAS servers.
## [>] Urgent infrastructure development being performed.
## [>] The servers will be unavailable for approximately 48 hrs.
## [>] See other options for analysis: https://mrcieu.github.io/gwasvcf/.
## Extracting data for 65 SNP(s) from 1 GWAS(s)
## Harmonising Cheese intake || id:ukb-b-1489 (ukb-b-1489) and Coronary heart disease || id:ieu-a-7 (ieu-a-7)
## Removing the following SNPs for being palindromic with intermediate allele frequencies:
## rs1024853, rs26579
## Analysing 'ukb-b-1489' on 'ieu-a-7'
## id.exposure id.outcome outcome
## 1 ukb-b-1489 ieu-a-7 Coronary heart disease || id:ieu-a-7
## 2 ukb-b-1489 ieu-a-7 Coronary heart disease || id:ieu-a-7
## 3 ukb-b-1489 ieu-a-7 Coronary heart disease || id:ieu-a-7
## 4 ukb-b-1489 ieu-a-7 Coronary heart disease || id:ieu-a-7
## 5 ukb-b-1489 ieu-a-7 Coronary heart disease || id:ieu-a-7
## exposure method nsnp b
## 1 Cheese intake || id:ukb-b-1489 MR Egger 62 0.1342111
## 2 Cheese intake || id:ukb-b-1489 Weighted median 62 -0.4300205
## 3 Cheese intake || id:ukb-b-1489 Inverse variance weighted 62 -0.4360602
## 4 Cheese intake || id:ukb-b-1489 Simple mode 62 -0.5269452
## 5 Cheese intake || id:ukb-b-1489 Weighted mode 62 -0.4311161
## se pval
## 1 0.4309722 7.565649e-01
## 2 0.1306445 9.964392e-04
## 3 0.1022658 2.008084e-05
## 4 0.3037105 8.778662e-02
## 5 0.2724922 1.187931e-01
## id.exposure id.outcome outcome
## 1 ukb-b-1489 ieu-a-7 Coronary heart disease || id:ieu-a-7
## 2 ukb-b-1489 ieu-a-7 Coronary heart disease || id:ieu-a-7
## exposure method Q Q_df
## 1 Cheese intake || id:ukb-b-1489 MR Egger 81.96134 60
## 2 Cheese intake || id:ukb-b-1489 Inverse variance weighted 84.49375 61
## Q_pval
## 1 0.03135632
## 2 0.02492620
## Analysing 'ukb-b-1489' on 'ieu-a-7'
## id.exposure id.outcome outcome
## 1 ukb-b-1489 ieu-a-7 Coronary heart disease || id:ieu-a-7
## exposure
## 1 Cheese intake || id:ukb-b-1489
## method nsnp b
## 1 Inverse variance weighted (multiplicative random effects) 62 -0.4360602
## se pval
## 1 0.1022658 2.008084e-05
## id.exposure id.outcome outcome
## 1 ukb-b-1489 ieu-a-7 Coronary heart disease || id:ieu-a-7
## exposure egger_intercept se pval
## 1 Cheese intake || id:ukb-b-1489 -0.009837988 0.007225505 0.1784265
## $`ukb-b-1489.ieu-a-7`
## Warning: Using linewidth for a discrete variable is not advised.
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_errorbarh()`).
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_point()`).
##
## attr(,"split_type")
## [1] "data.frame"
## attr(,"split_labels")
## id.exposure id.outcome
## 1 ukb-b-1489 ieu-a-7
## $`ukb-b-1489.ieu-a-7`
##
## attr(,"split_type")
## [1] "data.frame"
## attr(,"split_labels")
## id.exposure id.outcome
## 1 ukb-b-1489 ieu-a-7
## $`ukb-b-1489.ieu-a-7`
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_errorbarh()`).
## Removed 1 row containing missing values or values outside the scale range
## (`geom_point()`).
##
## attr(,"split_type")
## [1] "data.frame"
## attr(,"split_labels")
## id.exposure id.outcome
## 1 ukb-b-1489 ieu-a-7
## $`ukb-b-1489.ieu-a-7`
##
## attr(,"split_type")
## [1] "data.frame"
## attr(,"split_labels")
## id.exposure id.outcome
## 1 ukb-b-1489 ieu-a-7
Note that the echo = FALSE
parameter was added to the code chunk to prevent printing of the R code that generated the plot.