基本的安装软件
先了解一下基本方法,之后就用conda
-
分为几类
第一类是二进制可执行程序,google找到软件下载地址,
wget,解压即可第二类C源码程序,需要编译,一般是
./configure,make,make install或者直接make,但是非常容易报错,比如作业题第11题,在下载samtools之后,为了编译和安装我先后装了gcc,zlib,libbzip2,每一个的装法还都不太一样,这个时候已经濒临崩溃了,但是系统残忍地告诉我,还是缺库。看来conda真是个好东西。遇到的一些安装代码:
sudo apt-get installyum install``wget
另外我注意到Jimmy老师的 生物信息学常见1000个软件的安装代码!中经常出现这样的配置方法:
./configure --prefix=/home/jianmingzeng/biosoft/myBin,而不是简单的./configure。一查才知,--prefix选项是配置安装的路径,如果不配置该选项,安装后可执行文件默认放在/usr/local/bin,库文件默认放在/usr/local/lib,配置文件默认放在/usr/local/etc,其它的资源文件放在/usr /local/share,比较凌乱。而设置该选项就可以把所有文件放进指定路径,使用和卸载都更方便。-
安装之后,为了调用方便,可以
把绝对路径赋值给一个变量,然后用
$变量名调用alias 变量=绝对路径,这样可以不加$调用放进环境变量:
echo 'export PATH=/home/user/biosoft/myBin/bin:$PATH' >> ~/.bashrc。相当于把export PATH="$PATH:绝对路径"这句话放到.bashrc的末尾。最后source ~/.bashrc使更改生效
另外的一些点
平时调用的
ls其实不是他本来的样子,而是自动补加了选项--color=auto.bz2文件用tar xvfj解压(这个可以在有需求的时候google)
学习软件的用法
首先找到example,里面会有示例数据
然后看帮助文档中的usage,看多了就容易看懂
包管理工具
- 从复杂的依赖关系中解脱出来
conda
优点
第三方软件齐全,安装方便
多环境管理,避免冲突
不需要权限
基本命令
添加镜像源:
conda config -add conda config --show查看已有环境:
conda env -info搜索:
conda search创建新环境:
conda create -n env_name -prefix python=2 bwa删除环境:
conda remove -n env_name -allconda cheatsheet
下载和安装conda
非常不幸,19年4月清华和中科大的镜像先后挂了,好在我有VPN,官方源下载依旧很快
找到下载链接,
wgetbash是否加入环境变量,选择加入
使用conda
-
添加频道(镜像)
首先执行
conda config --set show_channel_urls yes,生成~/.condarc文件;然后用vim把里面的内容替换成下面这段话:
<pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="" cid="n82" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); --select-text-bg-color: #36284e; --select-text-font-color: #fff; font-size: 0.9rem; line-height: 1.71429em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(218, 218, 218); position: relative !important; margin-bottom: 3em; margin-left: 2em; padding-left: 1ch; padding-right: 1ch; width: inherit; color: rgb(31, 9, 9); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">channels:
- defaults
show_channel_urls: true
default_channels: - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
-
https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud</pre>
-
搜索看看想装的软件是否可用
conda search 软件名或者在bioconda搜索来看看这个软件是否存在
先搞个小环境保险
conda create -n 环境名 python=2 bwa这一步完成了创建小环境-安装python2-安装bwa三个操作常规安装
conda install 软件名,可以加-y参数,一会儿就不用确认安装了指定安装版本
conda install 软件名=版本号以后再进入这个子环境
conda activate 环境名退出当前环境
conda deactivate不在安装软件的环境内,如何调用软件?软链接!
ln -s ~/miniconda3/bin/软件名 ~/.local/bin
环境变量
-
查看当前环境变量
envexport
显示变量值:
echo $变量名PATH存放命令的查找路径HOME家目录位置SHELL当前使用的shell环境RANDOM显示随机值export可以创建环境变量 但如果要每次重启都保留需要修改配置文件~/.bashrc