1. 在清华镜像安装miniconda
搜索“miniconda 清华镜像”,然后进入下载页面
打开terminal,用uname -a
看自己的电脑是64位还是32位
登录服务器(昨天的账号密码)
tips:输入时可以试试自动补全功能,在home目录下,打出
cd b
,按Tab就可以自动补齐文件名(引用自生信星球)
根据情况复制下载链接miniconda linux 64位安装包
wget
+复制的下载链接,开始下载
Last login: Tue Mar 10 11:14:17 2020 from 58.249.112.84
bio18@VM-0-10-ubuntu:~$ cd b
-bash: cd: b: No such file or directory
bio18@VM-0-10-ubuntu:~$ cd biosoft/
bio18@VM-0-10-ubuntu:~/biosoft$ wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2019.10-MacOSX-x86_64.sh
--2020-03-11 11:32:02-- https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2019.10-MacOSX-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: 444796542 (424M) [application/octet-stream]
Saving to: ‘Anaconda3-2019.10-MacOSX-x86_64.sh’
da3-2019.10-MacOSX- 28%[====> ] 120.24M 2.88MB/s eta 83s
下载完之后发现自己下成了Anaconda,重新下载miniconda
bio18@VM-0-10-ubuntu:~/biosoft$ wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-latest-Linux-x86_64.sh
--2020-03-11 11:36:08-- 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: 71785000 (68M) [application/octet-stream]
Saving to: ‘Miniconda3-latest-Linux-x86_64.sh’
t-Linux-x86_64.sh 38%[======> ] 26.02M 3.20MB/s eta 11s
bio18@VM-0-10-ubuntu:~/biosoft$ bash Miniconda3-latest-Linux-x86_64.sh
Welcome to Miniconda3 4.7.12
In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>
===================================
Miniconda End User License Agreement
Thank you for installing Miniconda3!
source ~/.bashrc
激活conda!
然后输入conda
如果出现大段代码说明激活成功,如果没有的话,将文件夹删除,重新安装激活
sh是脚本(就是一个程序,后台的代码)文件的后缀,也就是说其实这是一个下载的脚本,如果你安装失败了,这个脚本是不需要重新下载的,还是可以用的(引用自生信星球)
conda commands available from other packages:
env
将下列4行代码粘贴到命令行,然后回车
(base) bio18@VM-0-10-ubuntu:~/biosoft$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
(base) bio18@VM-0-10-ubuntu:~/biosoft$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
(base) bio18@VM-0-10-ubuntu:~/biosoft$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
(base) bio18@VM-0-10-ubuntu:~/biosoft$ conda config --set show_channel_urls yes
现在就算可以使用了
2.使用Conda下载软件(以数据质控软件fastqc为例)
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.2.0 py37_0 defaults
ca-certificates 2019.10.16 0 defaults
certifi 2019.9.11 py37_0 defaults
cffi 1.13.0 py37h2e261b9_0 defaults
chardet 3.0.4 py37_1003 defaults
conda 4.7.12 py37_0 defaults
conda-package-handling 1.6.0 py37h7b6447c_0 defaults
cryptography 2.8 py37h1ba5d50_0 defaults
idna 2.8 py37_0 defaults
libedit 3.1.20181209 hc058e9b_0 defaults
libffi 3.2.1 hd88cf55_4 defaults
libgcc-ng 9.1.0 hdf63c60_0 defaults
libstdcxx-ng 9.1.0 hdf63c60_0 defaults
ncurses 6.1 he6710b0_1 defaults
openssl 1.1.1d h7b6447c_3 defaults
pip 19.3.1 py37_0 defaults
pycosat 0.6.3 py37h14c3975_0 defaults
pycparser 2.19 py37_0 defaults
pyopenssl 19.0.0 py37_0 defaults
pysocks 1.7.1 py37_0 defaults
python 3.7.4 h265db76_1 defaults
readline 7.0 h7b6447c_5 defaults
requests 2.22.0 py37_0 defaults
ruamel_yaml 0.15.46 py37h14c3975_0 defaults
setuptools 41.4.0 py37_0 defaults
six 1.12.0 py37_0 defaults
sqlite 3.30.0 h7b6447c_0 defaults
tk 8.6.8 hbc83047_0 defaults
tqdm 4.36.1 py_0 defaults
urllib3 1.24.2 py37_0 defaults
wheel 0.33.6 py37_0 defaults
xz 5.2.4 h14c3975_4 defaults
yaml 0.1.7 had09818_2 defaults
zlib 1.2.11 h7b6447c_3 defaults
conda search fastqc
搜索安装包
(base) bio18@VM-0-10-ubuntu:~/biosoft$ conda search fastqc
Loading channels: /
conda install fastqc -y
安装软件,-y是自动安装,如果不写-y的话,手动打yes也可
(base) bio18@VM-0-10-ubuntu:~/biosoft$ conda install fastqc -y
Collecting package metadata (current_repodata.json): done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.7.12
latest version: 4.8.2
Please update conda by running
默认安装最新版本,但是有的软件新版本bug比较多,可能需要用到老版本
如果要指定版本号,可以用conda install fastqc=0.11.7
(引用自生信星球)
conda remove fastqc -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
3. 按照项目要求,制定不同的环境
生信实战中,需要分析转录组、基因组组装、重测序等多个项目。
每一个项目都需要不同的软件,另外软件之间的结合也是需要版本要求的,比如A项目你需要用a软件V 1.0版本,但是处理B项目又需要用到a软件的V 1.5版本,怎么办?
--别想了,办法就是分身!!按照你的项目,定制不同的分身,安装不同的软件,互不干扰。这个分身就是不同的“conda environment”(引用自生信星球)
conda info --envs
查看目前的环境,带*
的是默认环境
# conda environments:
#
base * /home/bio18/miniconda3 #可以看到现在只有一个环境
conda create -n rna-seq python=3 fastqc trimmomatic -y
以处理转录组数据为例,先建立一个名叫rna-seq的conda环境,然后指定python版本是3,安装软件fastqc、trimmomatic(这两个可以一步完成)-y自动安装
(base) bio18@VM-0-10-ubuntu:~/biosoft$ conda create -n
usage: conda create [-h] [--clone ENV] [-n ENVIRONMENT | -p PATH] [-c CHANNEL]
[--use-local] [--override-channels]
[--repodata-fn REPODATA_FNS] [--strict-channel-priority]
[--no-channel-priority] [--no-deps | --only-deps]
[--no-pin] [--copy] [-C] [-k] [--offline] [-d] [--json]
[-q] [-v] [-y] [--download-only] [--show-channel-urls]
[--file FILE] [--no-default-packages] [--dev]
[package_spec [package_spec ...]]
conda create: error: argument -n/--name: expected one argument
可以看到conda create -n
是创建一个新的环境,并且要在后面接上名字
(base) bio18@VM-0-10-ubuntu:~/biosoft$ conda create -n rna-seq python=3 fastqc trimmomatic -y
Collecting package metadata (current_repodata.json): done
Solving environment: done #后面指明语言和下载软件可以和上一步一起进行
在看一下目前有哪些环境,多了一个rna-seq
# conda environments:
#
base * /home/bio18/miniconda3
rna-seq /home/bio18/miniconda3/envs/rna-seq #创建了一个叫rna-seq的环境,放在envs目录中
但是默认环境还是base,要激活新的conda环境
conda activate rna-seq
激活rna-seq环境
(base) bio18@VM-0-10-ubuntu:~/biosoft$ conda activate rna-seq
(rna-seq) bio18@VM-0-10-ubuntu:~/biosoft$ fastqc #可以看见前面括号中变为了rna-seq,说明进入了新的环境,在这里输入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)
conda deactivate
返回到base环境
(rna-seq) bio18@VM-0-10-ubuntu:~/biosoft$ conda deactivate
(base) bio18@VM-0-10-ubuntu:~/biosoft$ #可以看到前面变为base