在ubuntu18.04上安装拷贝数变异检测工具TitanCNA踩坑记录

一、写在前面

1:在自己电脑上安装ubuntu系统遇到的坑就不说了(引导问题,显卡不兼容问题,检测不到显卡,触摸板无法使用,两个shift健只有一个能用,伴随的就是一次次的卡死和强制重启…心疼我的硬盘)。
2:之前有在实验室服务器上尝试安装过TitanCNA,但是这个R package因为各种包的依赖问题而需要root权限去处理。。。。。
3:写博文的目的纯粹是做记录用,作为一个十足的菜鸟,还没资格交流

二、R版本转换

TitanCNA(http://www.bioconductor.org/packages/devel/bioc/html/TitanCNA.html#since)在这里提供的安装方式非常简单
并且要求R version>4.0

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")

# The following initializes usage of Bioc devel
BiocManager::install(version='devel')

BiocManager::install("TitanCNA")

1:那么此时第一个问题便出现了,我在刚开始安装R的时候使用的是

apt-get install r-base

所以自动给我安装了3.6版本…明明最新的是4.0.2版本…。没办法,首先想到的是在winodws上使用过的直接升级的方法

installed.packages("installr")
library(installr)
update(R)

结果第一步报错说"installr" are not available for R.
既然如此那么我就直接卸载后再安装最新版咯,那么如何卸载和安装呢,这里也踩坑了

apt-get remove r-base

这个方法并不能够卸载R,正确的方法是

sudo apt-get autoremove r-base-core

那么最新版本的R如何安装呢!在R的官网找到linux版本R的下载位置后看一下readme里面的内容
在这里插入图片描述
Note, to install R 4.0 packages, a different sources.list entry is needed. See below for details.
在这里插入图片描述按照说明文档里面的操作添加新的下载地址到source.list中去

sudo sh -c "echo deb http://mirror.bjtu.edu.cn/cran/bin/linux/ubuntu precise/ >>/etc/apt/sources.list
#更新源
sudo apt-get install r-base-core
#顺便补充一下如何安装指定版本的R?在卸载原有的R之后
#比如要安装 注意与系统版本对应r-base-core-dbg_4.0.0-1.1804.0_amd64.deb
sudo apt-get install r-base-core-dbg=4.0.0-1.1804.0_amd64.deb

2:在安装好R之后开始按照bioconductor里面的方式使用BiocManager去安装TitanCNA:踩坑之路开始
在经过一个多小时的下载与安装之后,报错开始

ERROR: dependencies ‘GenomeInfoDb’, ‘GenomicRanges’, ‘SummarizedExperiment’, ‘Rsamtools’ are not available for package ‘GenomicAlignments’
* removing ‘/home/huen/R/x86_64-pc-linux-gnu-library/4.0/GenomicAlignments’
ERROR: dependencies ‘curl’, ‘httr’ are not available for package ‘BiocFileCache’
* removing ‘/home/huen/R/x86_64-pc-linux-gnu-library/4.0/BiocFileCache’
ERROR: dependencies ‘XML’, ‘httr’, ‘openssl’, ‘BiocFileCache’ are not available for package ‘biomaRt’
* removing ‘/home/huen/R/x86_64-pc-linux-gnu-library/4.0/biomaRt’
ERROR: dependencies ‘GenomeInfoDb’, ‘GenomicRanges’, ‘RCurl’, ‘rtracklayer’, ‘biomaRt’ are not available for package ‘GenomicFeatures’
* removing ‘/home/huen/R/x86_64-pc-linux-gnu-library/4.0/GenomicFeatures’
ERROR: dependencies ‘GenomeInfoDb’, ‘GenomicRanges’, ‘SummarizedExperiment’, ‘Rsamtools’, ‘rtracklayer’, ‘BSgenome’, ‘GenomicFeatures’, ‘Rhtslib’ are not available for package ‘VariantAnnotation’
* removing ‘/home/huen/R/x86_64-pc-linux-gnu-library/4.0/VariantAnnotation’
ERROR: dependencies ‘GenomicRanges’, ‘VariantAnnotation’, ‘GenomeInfoDb’ are not available for package ‘TitanCNA’
* removing ‘/home/huen/R/x86_64-pc-linux-gnu-library/4.0/TitanCNA’

The downloaded source packages are in/tmp/RtmpBn5uY9/downloaded_packages’
There were 16 warnings (use warnings() to see them)
> library(TitanCNA)
Error in library(TitanCNA) : 不存在叫‘TitanCNA’这个名字的程辑包 



根据报错信息,我想重新安装一下报错里面的第一个宝GenomicAligments,在经过十几分钟的下载后报错
hfile_libcurl.c:45:10: fatal error: curl/curl.h: 没有那个文件或目录,通过网上学习发现是因为缺少了libcurl这个依赖库,那么就安装他,需要注意的是ubuntu使用的是libcurl4-openssl-dev

apt-get install libcurl4-openssl-dev

在安装好这个库之后总算是可以继续安装了,在重新运行TitanCNA的安装后不一会er又报错
ERROR: configuration failed for package ‘XML’
上网查了之后发现是因为缺少libxml2这个库,那么安装之

apt install libxml2-dev
#检查是否安装成功
xml2-config --cflags
#-I/usr/include/libxml2

继续重新安装TitanCNA,当然 又报错咯

1: In install.packages(...) :
  installation of package ‘openssl’ had non-zero exit status
2: In install.packages(...) :
  installation of package ‘httr’ had non-zero exit status
3: In install.packages(...) :
  installation of package ‘BiocFileCache’ had non-zero exit status
4: In install.packages(...) :
  installation of package ‘biomaRt’ had non-zero exit status
5: In install.packages(...) :
  installation of package ‘GenomicFeatures’ had non-zero exit status
6: In install.packages(...) :
  installation of package ‘VariantAnnotation’ had non-zero exit status
7: In install.packages(...) :
  installation of package ‘TitanCNA’ had non-zero exit status
  #单独 安装openssl
  
tools/version.c:1:10: fatal error: openssl/opensslv.h: 没有那个文件或目录
``
如此看来是系统缺少openssl这个库咯,那就去查如何安装,参考https://blog.csdn.net/yang_yulin_/article/details/99728500大神的操作

```powershell
#下载安装包
wget https://www.openssl.org/source/openssl-1.1.1c.tar.gz
#解压
tar -zxvf openssl-1.1.1c.tar.gz
#编译安装
cd openssl-1.1.1c
./config
make
make install
#安装之后使用which可以找到openssl,但是允许openssl时报错定位有问题 继续操作
#先备份
mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl /usr/include/openssl.bak
#再设置配置
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
 
ln -s /usr/local/openssl/include/openssl /usr/include/openssl
 
echo "/usr/local/openssl/lib" >> /etc/ld.so.conf
 
ldconfig -v
#搞定

此时回到R中安装openssl成功
继续重新安装TitanCNA
其实很多需要的包都已经下载到了/tmp/RtmpBn5uY9/downloaded_packages中,使用biocManager::install又会重新下载。。但实在懒得弄了

成功了

三级标题

四级标题

五级标题
六级标题
©️2020 CSDN 皮肤主题: 1024 设计师:上身试试 返回首页