先上今天的思维导图:
1. 了解conda
简单的说——linux的应用商店,除此之外还有几个概念。
- bioconda
- miniconda
- conda
- anaconda
以上四者区别,参考 关于bioconda, miniconda, conda, anaconda的区别
2. 安装miniconda
(1)进入网站
搜索“miniconda 清华”,进入。搜素得到链接为:https://mirror.tuna.tsinghua.edu.cn/help/anaconda/
(2)查看服务器
登录输入命令
uname -a
bio18@VM-0-10-ubuntu:~$ uname -a
Linux VM-0-10-ubuntu 4.15.0-54-generic #58-Ubuntu SMP Mon Jun 24 10:55:24 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
(3)安装最新版
进入(1)中页面,https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/
找到下载最新版,复制链接
在linux中,Windows复制——鼠标左键点一下,粘贴——右键;Mac直接cmd + c 复制,cmd + v 粘贴
进入到biosoft目录,安装
cd biosoft
复制链接
wget 刚刚复制的链接
bio18@VM-0-10-ubuntu:~/biosoft$ wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-latest-Linux-x86_64.sh
--2020-04-08 20:52:33-- https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-latest-Linux-x86_64.sh
Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193, 2402:f000:1:408:8100::1
Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 85055499 (81M) [application/octet-stream]
Saving to: ‘Miniconda3-latest-Linux-x86_64.sh’
Miniconda3-latest-L 100%[===================>] 81.12M 3.52MB/s in 21s
2020-04-08 20:52:55 (3.84 MB/s) - ‘Miniconda3-latest-Linux-x86_64.sh’ saved [85055499/85055499]
bio18@VM-0-10-ubuntu:~/biosoft$ bash Miniconda3-latest-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
>>>
===================================
根据提示完成安装
(4)激活conda
输入命令 source ~/.bashrc
Thank you for installing Miniconda3!
bio18@VM-0-10-ubuntu:~/biosoft$ source ~/.bashrc
可以输入conda来检查,因为其后没有加具体的东西,会出现大段提示,报错,则没有激活
(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
(来源:生信星球)
(base) bio18@VM-0-10-ubuntu:~/biosoft$ 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(base)
Ready!
2. conda基本操作
- 查看当前所有列表
conda list
(base) bio18@VM-0-10-ubuntu:~/biosoft$ conda list
# packages in environment at /home/bio18/miniconda3:
#
# Name Version Build Channel
_libgcc_mutex 0.1 main defaults
asn1crypto 1.3.0 py37_0 defaults
ca-certificates 2020.1.1 0 defaults
后面还很多
- 搜索软件
conda search fastqc
(base) bio18@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为例
- 安装软件
conda install fastqc -y
-y自动安装,没有则会出现问你可不可以
Collecting package metadata (current_repodata.json): done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.8.2
latest version: 4.8.3
Please update conda by running
$ conda update -n base -c defaults conda
## Package Plan ##
environment location: /home/bio18/miniconda3
自动安装最新
- 卸载软件
conda remove fasty -y
(base) bio18@VM-0-10-ubuntu:~/biosoft$ conda remove fastqc -y
Collecting package metadata (repodata.json): done
Solving environment: done
## Package Plan ##
environment location: /home/bio18/miniconda3
removed specs:
- fastqc
The following packages will be downloaded:
package | build
---------------------------|-----------------
_libgcc_mutex-0.1 | conda_forge 3 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
3. conda选修操作
(懒懒怕迷路)
- 查看conda当前环境
conda info --envs
(base) bio18@VM-0-10-ubuntu:~/biosoft$ conda info --envs
# conda environments:
#
base * /home/bio18/miniconda3
前面带*为默认
- 建立一个处理转录组的环境rna-seq,指定python版本是3,安装软件fastqc、trimmmomatic
conda create -n rna-seq python=3 fastqc trimmomatic -y
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: /home/bio18/miniconda3/envs/rna-seq
added / updated specs:
- fastqc
- python=3
- trimmomatic
The following packages will be downloaded:
package | build
---------------------------|-----------------
certifi-2020.4.5.1 | py38h32f6830_0 151 KB https://mirrors
- 检查环境
(base) bio18@VM-0-10-ubuntu:~/biosoft$ conda info --envs
# conda environments:
#
base * /home/bio18/miniconda3
rna-seq /home/bio18/miniconda3/envs/rna-seq
- 激活新环境
conda activate rna-seq
(base) bio18@VM-0-10-ubuntu:~/biosoft$ conda activate rna-seq
(rna-seq) bio18@VM-0-10-ubuntu:~/biosoft$ 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)
(rna-seq)在用户名前,输入fastqc,有提示——成功