“生信星球(wx:babyfox2017)”的課程學(xué)習(xí)筆記。
conda相當(dāng)于App Store,通過conda進(jìn)行其他軟件的安裝。做生信安裝miniconda即可。
1.下載/安裝/激活miniconda
1. 在終端unman -a,確定系統(tǒng)類型及位數(shù)。

2. 下載miniconda
用搜索引擎搜索“miniconda 清華”,打開清華鏡像網(wǎng)站。

進(jìn)入頁(yè)面,找到miniconda下載界面。

進(jìn)入下載界面,找到符合系統(tǒng)要求的miniconda版本的最新版,右擊-復(fù)制鏈接。
注意,conda是裝在服務(wù)器中的,所以要看服務(wù)器的系統(tǒng)版本,和本地電腦系統(tǒng)無關(guān)。

進(jìn)入欲存儲(chǔ)路徑,這里是/home/bio01/biosoft,在終端用
wget命令,復(fù)制鏈接內(nèi)容,回車,即開始下載miniconda。
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py38_4.8.2-Linux-x86_64.sh

- .sh是腳本,可運(yùn)行軟件,我理解為安裝包。即便后面安裝出現(xiàn)問題,只要安裝包在,就可以重新開始安裝。
3. 安裝miniconda
命令bash Miniconda3-py38_4.8.2-Linux-x86_64.sh,即bash+腳本名稱,回車后,安裝開始,讓寫yes就yes,讓Enter就Enter。License Agreement里有好多東西,不用看,一直按Enter向下就可以了。
bio01@VM-0-10-ubuntu:~/biosoft$ bash Miniconda3-py38_4.8.2-Linux-x86_64.sh
Welcome to Miniconda3 4.8.2
In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>
===================================
End User License Agreement - Anaconda Individual Edition
===================================
Copyright 2015-2020, Anaconda, Inc.
All rights reserved under the 3-clause BSD License:
This End User License Agreement (the "Agreement") is a legal agreement between you and Anaconda
, Inc. ("Anaconda") and governs your use of Anaconda Individual Edition (which was formerly kno
wn as Anaconda Distribution).
Subject to the terms of this Agreement, Anaconda hereby grants you a non-exclusive, non-transfe
rable license to:
* Install and use the Anaconda Individual Edition (which was formerly known as Anaconda Distr
ibution),
* Modify and create derivative works of sample source code delivered in Anaconda Individual E
dition; and
* Redistribute code files in source (if provided to you by Anaconda as source) and binary for
ms, with or without modification subject to the requirements set forth below.
直到出現(xiàn)問yes/no時(shí),輸入yes。后面依然是Enter。

最后出現(xiàn)Thank you ……即安裝成功。
==> For changes to take effect, close and re-open your current shell. <==
If you'd prefer that conda's base environment not be activated on startup,
set the auto_activate_base parameter to false:
conda config --set auto_activate_base false
Thank you for installing Miniconda3!
4. 激活
輸入命令source ~/.bashrc,回車。
再輸入conda,回車,出現(xiàn)一大堆信息,即為激活成功。
bio01@VM-0-10-ubuntu:~/biosoft$ source ~/.bashrc
(base) bio01@VM-0-10-ubuntu:~/biosoft$ conda
usage: conda [-h] [-V] command ...
conda is a tool for managing and deploying applications, environments and packages.
Options:
positional arguments:
command
clean Remove unused packages and caches.
config Modify configuration values in .condarc. This is modeled after the git
config command. Writes to the user .condarc file (/home/bio01/.condarc) by
default.
create Create a new conda environment from a list of specified packages.
help Displays a list of available conda commands and their help strings.
info Display information about current conda install.
init Initialize conda for shell interaction. [Experimental]
install Installs a list of packages into a specified conda environment.
list List linked packages in a conda environment.
package Low-level conda package utility. (EXPERIMENTAL)
remove Remove a list of packages from a specified conda environment.
uninstall Alias for conda remove.
run Run an executable in a conda environment. [Experimental]
search Search for packages and display associated information. The input is a
MatchSpec, a query language for conda packages. See examples below.
update Updates conda packages to the latest compatible version.
upgrade Alias for conda update.
optional arguments:
-h, --help Show this help message and exit.
-V, --version Show the conda version number and exit.
conda commands available from other packages:
env
5. 添加鏡像
# 使用清華鏡像
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
conda config --set show_channel_urls yes
到此為止,conda安裝并激活成功,可以開始使用。
2. Conda的使用
1. 查看當(dāng)前軟件列表
conda list
2. 搜索軟件
conda search 軟件名
(base) bio01@VM-0-10-ubuntu:~/biosoft$ conda search fastqc
Loading channels: done
# Name Version Build Channel
fastqc 0.10.1 0 anaconda/cloud/bioconda
fastqc 0.10.1 1 anaconda/cloud/bioconda
fastqc 0.11.2 1 anaconda/cloud/bioconda
fastqc 0.11.2 pl5.22.0_0 anaconda/cloud/bioconda
fastqc 0.11.3 0 anaconda/cloud/bioconda
fastqc 0.11.3 1 anaconda/cloud/bioconda
fastqc 0.11.4 0 anaconda/cloud/bioconda
fastqc 0.11.4 1 anaconda/cloud/bioconda
fastqc 0.11.4 2 anaconda/cloud/bioconda
fastqc 0.11.5 1 anaconda/cloud/bioconda
fastqc 0.11.5 4 anaconda/cloud/bioconda
fastqc 0.11.5 pl5.22.0_2 anaconda/cloud/bioconda
fastqc 0.11.5 pl5.22.0_3 anaconda/cloud/bioconda
fastqc 0.11.6 2 anaconda/cloud/bioconda
fastqc 0.11.6 pl5.22.0_0 anaconda/cloud/bioconda
fastqc 0.11.6 pl5.22.0_1 anaconda/cloud/bioconda
fastqc 0.11.7 4 anaconda/cloud/bioconda
fastqc 0.11.7 5 anaconda/cloud/bioconda
fastqc 0.11.7 6 anaconda/cloud/bioconda
fastqc 0.11.7 pl5.22.0_0 anaconda/cloud/bioconda
fastqc 0.11.7 pl5.22.0_2 anaconda/cloud/bioconda
fastqc 0.11.8 0 anaconda/cloud/bioconda
fastqc 0.11.8 1 anaconda/cloud/bioconda
fastqc 0.11.8 2 anaconda/cloud/bioconda
fastqc 0.11.9 0 anaconda/cloud/bioconda
3. 安裝軟件
conda install 軟件名 -y -y表示自動(dòng)安裝,不加-y就需要來回答一些yes/no的問題。
conda install 軟件名=版本號(hào) -y可指定安裝版本。
conda install fastqc=0.11.17
4. 卸載軟件
conda remove 軟件名 -y
3. conda環(huán)境
我們處理不同數(shù)據(jù)時(shí),可以創(chuàng)建不同的環(huán)境,使安裝的軟件、數(shù)據(jù)互相不影響。
1. 查看當(dāng)前環(huán)境
conda info --envs,可以看到現(xiàn)在只有一個(gè)默認(rèn)環(huán)境。
(base) bio01@VM-0-10-ubuntu:~/miniconda3$ conda info --envs
# conda environments:
#
base * /home/bio01/miniconda3
2. 新建一個(gè)環(huán)境
create -n 環(huán)境名 python= 版本 軟件名 軟件名 …… -y,創(chuàng)建環(huán)境,確定python版本,并安裝幾種軟件。

此時(shí),用conda info --envs查看信息,可以看到新增了一個(gè)rna-seq環(huán)境。
(base) bio01@VM-0-10-ubuntu:~/miniconda3$ conda info --envs
# conda environments:
#
base * /home/bio01/miniconda3
rna-seq /home/bio01/miniconda3/envs/rna-seq
3. 激活新環(huán)境
activate conda 環(huán)境名,root前出現(xiàn)新環(huán)境名。
再輸入fastqc,可以看到出現(xiàn)一些信息,說明新環(huán)境被激活,并且軟件可以使用。
(base) bio01@VM-0-10-ubuntu:~/miniconda3$ conda activate rna-seq
(rna-seq) bio01@VM-0-10-ubuntu:~/miniconda3$ fastqc
Exception in thread "main" java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
at java.desktop/java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:208)
at java.desktop/java.awt.Window.<init>(Window.java:548)
at java.desktop/java.awt.Frame.<init>(Frame.java:423)
at java.desktop/java.awt.Frame.<init>(Frame.java:388)
at java.desktop/javax.swing.JFrame.<init>(JFrame.java:180)
at uk.ac.babraham.FastQC.FastQCApplication.<init>(FastQCApplication.java:63)
at uk.ac.babraham.FastQC.FastQCApplication.main(FastQCApplication.java:338)