美文网首页单细胞转录组
inferCNV安装心路历程

inferCNV安装心路历程

作者: 疯子眼中的世界yia | 来源:发表于2021-01-17 16:23 被阅读0次

infercnv 包的安装依赖于rjags,rjags包依赖于JAGS库文件,因此,首先需要安装JAGS。

windows 安装

1、下载应用程序 JAGS-4.3.0.exe, 直接安装就行
2、安装rjags以及infercnv,注意一下R版本安装没什么问题

BiocManager::install("rjags")
BiocManager::install("infercnv")

linux 安装

1、首先安装依赖的 JAGS

通过 conda 安装

$ conda install pkg-configure jags # 如果conda连接不了试着改一下镜像源
$ pkg-config --modversion jags # 测试jags安装
4.3.0
$ll /home/usrname/miniconda3/lib/JAGS/modules-4/ #查看JAGS库
total 1856
-rwxrwxr-x 2 181320 Oct 18 15:24 basemod.so
-rwxrwxr-x 2 559312 Oct 18 15:24 bugs.so
-rwxrwxr-x 2 74656 Oct 18 15:24 dic.so
-rwxrwxr-x 2 870784 Oct 18 15:24 glm.so
-rwxrwxr-x 2 33504 Oct 18 15:24 lecuyer.so
-rwxrwxr-x 2 127072 Oct 18 15:24 mix.so
-rwxrwxr-x 2 35008 Oct 18 15:24 msm.so

或者使用源码安装

$ mkdir /share/nas1/usrname/Softwares/JAGS-4.3.0
$ tar -zxf ./jags_4.3.0.orig.tar.gz
$ cd ./JAGS-4.3.0
$ ./configure --prefix=/share/nas1/usrname/Softwares/JAGS-4.3.0/ --libdir=/share/nas1/usrname/Softwares/JAGS-4.3.0/lib64
$ make
$ make install
$ ll /share/nas1/usrname/Softwares/JAGS-4.3.0
total 160
drwxr-xr-x 2 22 Jan  8 16:18 bin
drwxr-xr-x 3 22 Jan  8 16:18 include
drwxr-xr-x 4 297 Jan  8 16:18 lib64
drwxr-xr-x 2 31 Jan  8 16:18 libexec
drwxr-xr-x 3 21 Jan  8 16:18 share

2、安装 rjags 包

需要配置环境,否则安装 rjags 是会提示报错。

# 配置环境变量
$ export PKG_CONFIG_PATH=/home/usrname/miniconda3/bin/pkg-config
$ export LD_LIBRARY_PATH=/home/usrname/miniconda3/lib/JAGS:$LD_LIBRARY_PATH
$ export LD_LIBRARY_PATH=/home/usrname/miniconda3/lib:$LD_LIBRARY_PATH
$ source ~/.bashrc

启动R窗口,检查环境

> Sys.getenv("LD_LIBRARY_PATH") # 存在JAGS库路径
[1] "/share/nas2/genome/biosoft/R/3.6.1/lib64/R/lib:/usr/local/lib64:/usr/java/latest/jre/lib/amd64/server:/home/usrname/miniconda3/lib:/home/usrname/miniconda3/lib/JAGS:/home/usrname/mysql:/share/nas2/genome/biosoft/hdf5/current/lib/:....(省略)"

安装 rjags 包

# R窗口安装
install.packages('rjags', configure.args='--with-jags-include=/share/nas1/usrname/Softwares/JAGS-4.3.0/include/JAGS --with-jags-lib=/share/nas1/usrname/Softwares/JAGS-4.3.0/lib64/JAGS  --with-jags-modules=/share/nas1/usrname/Softwares/JAGS-4.3.0//lib64/JAGS/modules-4  --with-jags-bin=/share/nas1/usrname/Softwares/JAGS-4.3.0//bin')
# 命令行安装
$ R CMD INSTALL --configure-args='--enable-rpath' /share/nas1/usrname/rjags_4-4.tar.gz

哭死,到这里还是发生error (https://sourceforge.net/p/mcmc-jags/discussion/610037/thread/cb37075f/) ,怀疑是环境配置问题,但是不清楚怎么解决(暴风式哭泣(灬ꈍ ꈍ灬))

gcc -std=gnu99 -I"/share/nas2/genome/biosoft/R/3.6.1/lib64/R/include" -DNDEBUG -I/home/usrname/miniconda3/include/JAGS   -I/usr/local/include  -fpic  -g -O2  -c init.c -o init.o
g++ -std=gnu++11 -I"/share/nas2/genome/biosoft/R/3.6.1/lib64/R/include" -DNDEBUG -I/home/usrname/miniconda3/include/JAGS   -I/usr/local/include  -fpic  -g -O2  -c jags.cc -o jags.o
g++ -std=gnu++11 -I"/share/nas2/genome/biosoft/R/3.6.1/lib64/R/include" -DNDEBUG -I/home/usrname/miniconda3/include/JAGS   -I/usr/local/include  -fpic  -g -O2  -c parallel.cc -o parallel.o
g++ -std=gnu++11 -shared -L/share/nas2/genome/biosoft/R/3.6.1/lib64/R/lib -L/usr/local/lib64 -o rjags.so init.o jags.o parallel.o -L/home/usrname/miniconda3/lib -ljags -L/share/nas2/genome/biosoft/R/3.6.1/lib64/R/lib -lR
installing to /home/usrname/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-rjags/00new/rjags/libs
** R
** data
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘rjags’:
 .onLoad failed in loadNamespace() for 'rjags', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/home/usrname/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-rjags/00new/rjags/libs/rjags.so':
  /home/usrname/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-rjags/00new/rjags/libs/rjags.so: undefined symbol: _ZN4jags7Console12unloadModuleERKSs
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/usrname/R/x86_64-pc-linux-gnu-library/3.6/rjags’
# 报错
> library(rjags)
Error: package or namespace load failed for ‘rjags’:
 .onLoad failed in loadNamespace() for 'rjags', details:
  call: load.module("basemod", quiet = TRUE)
  error: File not found: /share/nas2/genome/biosoft/R/3.6.1/lib64/R/../JAGS/modules-4/basemod.so

当修改 export LD_LIBRARY_PATH=/share/nas1/usrname/Softwares/JAGS-4.3.0/lib64 后,又出现下面的错误:

> library(rjags)
Loading required package: coda
Error: package or namespace load failed for ‘rjags’:
 .onLoad failed in loadNamespace() for 'rjags', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/share/nas1/usrname/packages/3.6/rjags/libs/rjags.so':
  /share/nas1/usrname/packages/3.6/rjags/libs/rjags.so: undefined symbol: _ZN4jags7Console10setRNGnameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEj

发现确实是 JAGS 跟R 的运行环境问题,如果是root权限用户安装会轻松很多,最后还是成功安装上了。

> library(rjags)
Linked to JAGS 4.3.0
Loaded modules: basemod,bugs

3、加载infercnv

> BiocManager::install("infercnv")
> library(infercnv)

相关文章

网友评论

    本文标题:inferCNV安装心路历程

    本文链接:https://www.haomeiwen.com/subject/jcnaaktx.html