美文网首页
CNVkit 安装和使用(一)

CNVkit 安装和使用(一)

作者: PETJO | 来源:发表于2021-03-25 18:08 被阅读0次

    1. Python2和Python3共存安装

    Linux系统自带python版本为 2.7.5,CNVkit推荐使用python3,因此,在Linux上安装Python 3.9.2 版本

    # Linux联网测试
    ping www.baidu.com
    
    PING www.wshifen.com (103.235.46.39) 56(84) bytes of data.
    64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=1 ttl=55 time=249 ms
    64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=2 ttl=55 time=249 ms
    64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=3 ttl=55 time=249 ms
    64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=4 ttl=55 time=249 ms
    
    # 下载和安装Python
    wget -c https://www.python.org/ftp/python/3.9.4/Python-3.9.4.tar.xz
    
    tar -Jxvf Python-3.9.4.tar.xz
    
    cd Python-3.9.4
    
    # 配置python3安装路径;python2路径为/usr/bin/python2
    ./configure prefix=/usr/local/python3
    
    # 编译安装python
    make && make install
    

    2. CNVKit安装

    # CNVkit安装方法1
    wget https://github.com/etal/cnvkit/archive/v0.9.7.zip
    unzip v0.9.7.zip
    cd cnvkit-0.9.7/
    
    # CNVkit安装方法2
    git clone https://github.com/etal/cnvkit
    cd cnvkit/
    /usr/local/python3/bin/pip3 install -e .
    
    # 测试安装是否成功
    /usr/local/python3/bin/python3 /opt/software/cnvkit-0.9.7/cnvkit.py -h
    /usr/local/python3/bin/python3 /opt/software/cnvkit/cnvkit.py -h
    
    # 报错
    缺少pandas.png

    3. 安装pandas库

    /usr/local/python3/bin/pip3 install pandas
    

    # 报错:pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

    缺少ssl.png

    3. 1 确认缺少ssl模块错误:

    在python shell import ssl同样提示找不到ssl模块

    证实缺少ssl.png

    3.2 解决缺少ssl模块问题:

    使用rpm -aq|grep openssl命令查询openssl是否正确安装。发现缺少openssl-devel包

    缺少level包.png
    # 安装openssl-devel包
    yum install -y openssl-devel
    
    openssl-devel 包安装成功.png

    3.3 测试问题是否解决

    # 重新编译安装python
    cd /opt/software/Python-3.9.2
    make clean 
    
    # 配置安装路径
    ./configure prefix=/usr/local/python3
    
    # 编译安装python
    make && make install
    
    # 重新安装pandas
    /usr/local/python3/bin/pip3 install pandas
    
    # pandas安装成功
    /usr/local/python3/bin/pip3 list
    
    pandas安装成功.png
    #在python shell中 import ssl同样找到ssl模块
    ssl 问题解决.png

    4. 安装Bio库

    # 成功安装pandas之后,测试CNVkit是否能正常运行,
    /usr/local/python3/bin/python3 /opt/software/cnvkit-0.9.7/cnvkit.py -h
    
    # 报错:ModuleNotFoundError: No module named 'Bio'
    Bio包报错.png

    4.1 解决缺少Bio库问题(此类报错解决原则缺什么补什么):

    # python安装Bio包
    /usr/local/python3/bin/pip3 install Bio
    
    # 仍然报错:ModuleNotFoundError: No module named 'Bio'

    4.2 继续解决缺少Bio包问题:发现Bio库的安装并不是pip install bio,而是biopython

    # 安装biopython
    /usr/local/python3/bin/pip3 install biopython
    
    # 还是报错:ModuleNotFoundError: No module named '_ctypes'
    _ctypes 报错_version.png
    # 搜索分析原因需要安装libffi-devel(参考:https://www.jianshu.com/p/b1f575c45e10)
    yum install libffi-devel -y
    
    # 重新编译安装python
    cd /opt/software/Python-3.9.2
    make clean 
    
    # 配置安装路径
    ./configure prefix=/usr/local/python3
    
    # 编译安装python
    make && make install
    
    # 重新安装 biopython
    /usr/local/python3/bin/pip3 install biopython
    
    # biopython安装成功
    biopython 安装成功.png

    5. 安装pysam、scipy、ReportLab、pyfaidx和pomegranate库

    # 成功安装biopython之后,测试CNVkit是否能正常运行,
    /usr/local/python3/bin/python3 /opt/software/cnvkit-0.9.7/cnvkit.py -h
    
    # 相同报错持续出现,不断安装即可:ModuleNotFoundError: No module named 'pysam' ;ModuleNotFoundError: No module named 'scipy'等等,不再复制了。
    pysam缺少.png 缺少scipy.png 缺少ReportLab.png 缺少pyfaidx.png 缺少pomegranate.png

    # 解决办法相同

    #[图片上传中...(pysam安装成功.png-48740c-1616666692869-0)]
    
    /usr/local/python3/bin/pip3 install pysam
    
    /usr/local/python3/bin/pip3 install scipy
    
    /usr/local/python3/bin/pip3 install ReportLab
    
    /usr/local/python3/bin/pip3 install pyfaidx
    
    /usr/local/python3/bin/pip3 install pomegranate
    
    pysam安装成功.png 成功安装scipy.png ReportLab安装成功.png 成功安装pyfaidx.png pomegranate安装成功.png

    6. 确认CNVkit安装成功

    CNVkit 安装成功.png

    7. 安装需要的 R依赖包,不安装的话CNVkit运行无法生成 .cns .pdf .png文件

    # 安装 R软件
    yum install R
    
    # 加载需要的R包
    > install.packages("BiocManager")
    > library(BiocManager)
    > BiocManager::install("DNAcopy")
    > q()
    

    相关文章

      网友评论

          本文标题:CNVkit 安装和使用(一)

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