【R包安装】TwoSampleMR 两样本孟德尔随机化

在Linux中安装R包TwoSampleMR

  • 用devtools直接安装报错
  • 解决办法

用devtools直接安装报错

library(devtools)
devtools::install_github("MRCIEU/TwoSampleMR")

#configure: error: Header file gmp.h not found; maybe use --with-gmp-include=INCLUDE_PATH
#ERROR: configuration failed for package ‘gmp’
#* removing ‘/public/home/wx2022/miniconda3/envs/MR_r4.1.2/lib/R/library/gmp’
#ERROR: dependency ‘gmp’ is not available for package ‘arrangements’
#* removing ‘/public/home/wx2022/miniconda3/envs/MR_r4.1.2/lib/R/library/arrangements’
#ERROR: dependency ‘nloptr’ is not available for package ‘lme4’
#* removing ‘/public/home/wx2022/miniconda3/envs/MR_r4.1.2/lib/R/library/lme4’
#ERROR: dependencies ‘gmp’, ‘arrangements’ are not available for package ‘iterpc’
#* removing ‘/public/home/wx2022/miniconda3/envs/MR_r4.1.2/lib/R/library/iterpc’
#ERROR: dependency ‘lme4’ is not available for package ‘meta’
#* removing ‘/public/home/wx2022/miniconda3/envs/MR_r4.1.2/lib/R/library/meta’
#ERROR: dependency ‘iterpc’ is not available for package ‘MendelianRandomization’
#* removing ‘/public/home/wx2022/miniconda3/envs/MR_r4.1.2/lib/R/library/MendelianRandomization’

解决办法

根据报错,依次安装依赖包,不能直接在R中安装的包(可能是因为版本不对)可以用conda安装。

conda install -c conda-forge r-gmp
conda install -c conda-forge r-nloptr
install.packages("arrangements")
install.packages("lme4")
install.packages("iterpc")
install.packages("meta")
install.packages("MendelianRandomization")

安装好依赖包以后就能成功安装TwoSampleMR包了

devtools::install_github("MRCIEU/TwoSampleMR")

library(TwoSampleMR)
#TwoSampleMR version 0.5.6
#[>] 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

library以后显示上面的信息就说明安装成功了

你可能感兴趣的:(R语言,Linux,r语言,linux)