2020-04-19
今天的内容:
linux软件的安装
除说明外,本文引用内容均来自:微信公众号生信星球
记录下有意思的东西:
- 安装miniconda
Miniconda 是一个 Anaconda 的轻量级替代,默认只包含了 python 和 conda,但是可以通过 pip 和 conda 来安装所需要的包。
清华的miniconda镜像地址
错误示范:
bio01@VM-0-10-ubuntu:~$ cd biosoft
bio01@VM-0-10-ubuntu:~/biosoft$ wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py38_4.8.2-MacOSX-x86_64.sh #下载
bio01@VM-0-10-ubuntu:~/biosoft$ ls
Miniconda3-py38_4.8.2-MacOSX-x86_64.sh
bio01@VM-0-10-ubuntu:~/biosoft$ bash Miniconda3-py38_4.8.2-MacOSX-x86_64.sh #安装
Miniconda3-py38_4.8.2-MacOSX-x86_64.sh: line 405: /home/bio01/biosoft/:home/bio01/bashrc/conda.exe: cannot execute binary file: Exec format error #此时我意识到下载错了版本
正解:
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py38_4.8.2-Linux-x86_64.sh
bash Miniconda3-py38_4.8.2-Linux-x86_64.sh
Thank you for installing Miniconda3!
bio01@VM-0-10-ubuntu:~$ source ~/.bashrc # 激活环境变量
(base) bio01@VM-0-10-ubuntu:~$ conda
(base) bio01@VM-0-10-ubuntu:~$ conda deactivate
bio01@VM-0-10-ubuntu:~$
- 添加镜像
# 使用清华镜像
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
3.0 conda基本命令
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.
3.1 conda list
查看当前所有软件列表
bio01@VM-0-10-ubuntu:~$ conda list
# packages in environment at /home/bio01/miniconda3:
#
# Name Version Build Channel
_libgcc_mutex 0.1 main defaults
asn1crypto 1.3.0 py38_0 defaults
ca-certificates 2020.1.1 0 defaults
certifi 2019.11.28 py38_0 defaults
cffi 1.14.0 py38h2e261b9_0 defaults
chardet 3.0.4 py38_1003 defaults
conda 4.8.2 py38_0 defaults
3.2 conda search
搜索软件
bio01@VM-0-10-ubuntu:~$ conda search fastqc
3.3
conda install
安装软件
conda install fastqc -y #自动安装最新版 可以去掉-y 手动
conda install fastqc=0.11.7 -y #选择版本号的安装
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
3.4 conda remove fastqc -y
卸载软件
Q: 请问不想用了怎么卸得畅快轻松?
A :首先 rm -rf ~/miniconda3
B: 环境变量中去掉conda, vi ~/bash_profile 删除conda路径,退出保存
【有个小技巧:vim 中移动光标比如到第9行,使用dd就可以快速删除整行】
生信小白第三天
3.5 conda enviroment
bio01@VM-0-10-ubuntu:~$ conda info --envs
# conda environments:
#
/home/bio01/biosoft/:/home/bio01/bashrc
base * /home/bio01/miniconda3 #标*为默认环境
conda create -n rna-seq python=3 fastqc trimmomatic -y #建立一个名叫rnaseq的conda环境,然后指定python版本是3,安装软件fastqc、trimmomatic(这两个可以一步完成)
bio01@VM-0-10-ubuntu:~$ conda info --envs #查看环境
# conda environments:
#
/home/bio01/biosoft/:/home/bio01/bashrc
base * /home/bio01/miniconda3
RNA-seq /home/bio01/miniconda3/envs/RNA-seq
bio01@VM-0-10-ubuntu:~$ conda activate RNA-seq #因默认环境依然是miniconda3,故需要激活rna-seq的环境变量
(RNA-seq) bio01@VM-0-10-ubuntu:~$ conda info --envs
# conda environments:
#
/home/bio01/biosoft/:/home/bio01/bashrc
base /home/bio01/miniconda3
RNA-seq * /home/bio01/miniconda3/envs/RNA-seq
(RNA-seq) bio01@VM-0-10-ubuntu:~$ fastqc #检测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)