利用bioconda 安裝生物信息軟件
通過conda安裝軟件,首先從官網(wǎng)查找該軟件是否被conda支持;若可以:
輸入以下的命令進行安裝:conda install -y fastqc(軟件名)
使用which softname
或者find -name softname
可以查看軟件位置
安裝指定版本的軟件
conda install softname=1.0
1.0代指版本
先使用conda search softname
參看當先版本。
使用conda建立環(huán)境
conda可以建立不同的環(huán)境,每種環(huán)境單獨存在,互不干擾。
最好為不同的處理和軟件建立不同的環(huán)境conda官網(wǎng)說明
- 建立一個新環(huán)境
conda create -n myenv
#參數(shù)-n代表設(shè)置環(huán)境名稱,myenv是具體的環(huán)境名,可以替換成自己想要的名稱- 建立一個新環(huán)境,同時指定該壞境中python的版本(看軟件的要求)
conda create -n myenv python=2.7
- 還可以建立環(huán)境的同時安裝軟件
conda create -n myenv
conda create -n myenv Scipy=0.15.0
- 環(huán)境建立成功后,會提示環(huán)境的激活和關(guān)閉的方法 #要記住
source activate myenv
deactivate myenv
- 查看已有的環(huán)境
conda info --envs
- 刪除某個環(huán)境
conda remove -n myenv --all
- 或者更加粗暴
rm -rf ~/miniconda3/envs/myenv/
#該路徑是要刪除的環(huán)境所在的路徑
在這里我想分享一下之前自己遇到的一個BUG;# 與軟件以及Python版本密切相關(guān)(雖然到現(xiàn)在我也不知道是為什么,但是希望我給出的方案能夠幫到和我一樣情況的小白)
- 非root
- 權(quán)限不足
- 報錯 ImportError
- Python中的包
deeptools-ImportError.png
當時遇到這個問題,查了一些網(wǎng)上的資料,并沒有解決;于是請教了一位老師,給出的點撥是:是服務(wù)器的依賴庫有問題;導致的軟件沒發(fā)使用。
現(xiàn)在仔細的檢查報錯的信息,發(fā)現(xiàn)
__init__.py
的標識;補充一點知識點:__init__.py
是Python中package的標識。
報錯情況:
(chipseq) [yangjy@GSCG01 ~]$ bamCoverage -h
Traceback (most recent call last):
File "/home/yangjy/miniconda3/envs/chipseq/bin/bamCoverage", line 6, in <module>
from deeptools import writeBedGraph
File "/home/yangjy/miniconda3/envs/chipseq/lib/python2.7/site-packages/deeptools/writeBedGraph.py", line 8, in <module>
from deeptools.countReadsPerBin import getCoverageOfRegion, getSmoothRange
File "/home/yangjy/miniconda3/envs/chipseq/lib/python2.7/site-packages/deeptools/countReadsPerBin.py", line 7, in <module>
import bamHandler
File "/home/yangjy/miniconda3/envs/chipseq/lib/python2.7/site-packages/deeptools/bamHandler.py", line 3, in <module>
import pysam
File "/home/yangjy/miniconda3/envs/chipseq/lib/python2.7/site-packages/pysam/__init__.py", line 5, in <module>
from pysam.libchtslib import *
ImportError: libhts.so.2: cannot open shared object file: No such file or directory
正常情況:
(deeptools) [yangjy@GSCG01 ~]$ bamCoverage -h
usage: An example usage is:$ bamCoverage -b reads.bam -o coverage.bw
This tool takes an alignment of reads or fragments as input (BAM file) and generates a coverage track (bigWig or bedGraph) as output. The coverage is
calculated as the number of reads per bin, where bins are short consecutive counting windows of a defined size. It is possible to extended the length of
the reads to better reflect the actual fragment length. *bamCoverage* offers normalization by scaling factor, Reads Per Kilobase per Million mapped reads
(RPKM), counts per million (CPM), bins per million mapped reads (BPM) and 1x depth (reads per genome coverage, RPGC).
Required arguments:
--bam BAM file, -b BAM file
BAM file to process (default: None)
Output:
--outFileName FILENAME, -o FILENAME
Output file name. (default: None)
--outFileFormat {bigwig,bedgraph}, -of {bigwig,bedgraph}
Output file type. Either "bigwig" or "bedgraph". (default: bigwig)
Optional arguments:
--help, -h show this help message and exit
--scaleFactor SCALEFACTOR
The computed scaling factor (or 1, if not applicable) will be multiplied by this. (Default: 1.0)
Read coverage normalization options:
--effectiveGenomeSize EFFECTIVEGENOMESIZE
The effective genome size is the portion of the genome that is mappable. Large fractions of the genome are stretches of NNNN that
should be discarded. Also, if repetitive regions were not included in the mapping of reads, the effective genome size needs to be
adjusted accordingly. A table of values is available here:
http://deeptools.readthedocs.io/en/latest/content/feature/effectiveGenomeSize.html . (default: None)
Read processing options:
--extendReads [INT bp], -e [INT bp]
This parameter allows the extension of reads to fragment size. If set, each read is extended, without exception. *NOTE*: This
feature is generally NOT recommended for spliced-read data, such as RNA-seq, as it would extend reads over skipped regions.
*Single-end*: Requires a user specified value for the final fragment length. Reads that already exceed this fragment length will
not be extended. *Paired-end*: Reads with mates are always extended to match the fragment size defined by the two read mates.
Unmated reads, mate reads that map too far apart (>4x fragment length) or even map to different chromosomes are treated like
single-end reads. The input of a fragment length value is optional. If no value is specified, it is estimated from the data (mean
of the fragment size of all mate reads). (default: False)
...........................
注:這里使用的是deeptools軟件
可以注意到兩個的conda環(huán)境不同;報錯時我激活的是chipseq的conda環(huán)境;而正常時 我激活的是deeptools的conda環(huán)境----------這中間經(jīng)歷了什么呢?
- 首先,我使用conda重新安裝了deeptools;
- 嘗試剛剛的命令,同樣的報錯
- 老師讓我查看了deeptools的版本
(chipseq) [yangjy@GSCG01 ~]$ conda list deeptools
# packages in environment at /home/yangjy/miniconda3/envs/chipseq:
#
# Name Version Build Channel
deeptools 1.5.9.1 0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
#重點來了:Version = 1.5.9.1
而最新的deeptools有:
(chipseq) [yangjy@GSCG01 ~]$ conda search deeptools
Loading channels: done
# Name Version Build Channel
deeptools 1.5.8.2 0 anaconda/cloud/bioconda
deeptools 1.5.9.1 0 anaconda/cloud/bioconda
deeptools 2.0.0 py27_0
.......................... 此處省略x.x.x版本 。。。en........
deeptools 3.4.2 py_0 anaconda/cloud/bioconda
deeptools 3.4.3 py_0 anaconda/cloud/bioconda
deeptools 3.5.0 py_0 anaconda/cloud/bioconda
所以我的版本是最低的;
- 于是我使用了
conda update deeptools
,but=====>
怎么也更新不了???
update deeptools
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(chipseq) [yangjy@GSCG01 ~]$ conda list deeptools
#
# Name Version Build Channel
deeptools 1.5.9.1 0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
- 再更新(重復(fù)了三次)還是一樣的版本,還是不能
bamCoverage -h
正常的顯示。 - 隨后,使用
conda install deeptools=3.5.0
#指定安裝版本;
but----it still Version = 1.5.9.1;
bug
(chipseq) [yangjy@GSCG01 ~]$ conda install deeptools=3.5.0
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: -
Found conflicts! Looking for incompatible packages. failed
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:
Specifications:
- deeptools=3.5.0 -> python[version='>=3']
Your python: python=2
If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.
報錯信息解讀:
- 處理環(huán)境,失敗 ;關(guān)于 Solving environment: failed with initial frozen solve,有提供的資料
- UnsatisfiableError:與已有環(huán)境中的python不兼容
細節(jié)就在這里:
-deeptools = 3.5.0-> python [version = '> = 3']
意思安裝deeptools = 3.5.0需要python的版本大于3以上;而我現(xiàn)在chipseq環(huán)境中的python = 2
注意,除非明確指定,否則conda不會將python版本更改為其他版本。(也就是我建立的chipseq指定了python的版本)
了解了這些信息,于是,總結(jié)下來 - (1)python的版本與軟件版本的兼容性(管理Python)
- (2)使用
conda search package_name --info
來查看你想要安裝的軟件的配置細節(jié)。 - (3)查看當前環(huán)境的Python版本:
(chipseq) [yangjy@GSCG01 ~]$ python --version #chipseq環(huán)境的Python版本
Python 2.7.15
(deeptools) [yangjy@GSCG01 ~]$ python --version #deeptools環(huán)境的Python版本
Python 3.8.6
- 所以,最后怎么處理上面的bug呢?
創(chuàng)建一個新的conda環(huán)境并安裝deeptools
conda create -n deeptools deeptools=3.5.0 python=3.8.6
激活這個環(huán)境conda activate deeptools
嘗試bamCoverage -h
參考網(wǎng)站:
biostars