1.首先系统安装软件
ubuntu 18.04 下载软件
apt-get install software
更改系统下载镜像,更换阿里源或者清华源
cp /etc/apt/sources.list /etc/apt/sources.list.bak
源文件内容如下:
修改为:
# 阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multivers
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
# 清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
修改完 保存并更新
apt-get update
apt-get upgrade
注意原文件中“bionic” 要与更换源的“bionic”一致,不然更新会出问题
R 相关下载与换源
- 安装包
install.packages("BiocInstaller") - 卸载已安装包
remove.packages("BiocInstaller") - 查看已加载包
(.packages()) - 卸除已加载包
detach("package:BiocInstaller") - 查看已安装的包
installed.packages() - 查看某个安装包提供的函数
help(package="BiocInstaller") - 查看某个函数属于哪个包
help("biocLite")
R包安装路径
.libPaths("~/R/lib") 如果不安装到默认路径,可以在此设置安装路径*
install.packages("ggplot2")
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("Logolas")
perl相关下载
perl模块安装:
perl -MCPAN -e 'install 模块'
cpan> install 模块
perl 安装模块换源
cpan[2]> o conf urllist
urllist
0 [[http://www.cpan.org/](http://www.cpan.org/)]
Type 'o conf' to view all configuration items
[http://mirrors.ustc.edu.cn/CPAN/](http://mirrors.ustc.edu.cn/CPAN/)
cpan[3]> o conf urllist push https:////[mirrors.aliyun.com/CPAN/](http://mirrors.aliyun.com/CPAN/)
Please use 'o conf commit' to make the config permanent!
cpan[4]> o conf commit
commit: wrote '/root/.cpan/CPAN/MyConfig.pm'
cpan[5]> o conf urllist
urllist
0 [[http://www.cpan.org/](http://www.cpan.org/)]
1 [[https://mirrors.aliyun.com/CPAN/](https://mirrors.aliyun.com/CPAN/)]
Type 'o conf' to view all configuration items
查找模块在哪个路径
/usr/bin/perldoc -l Bio::DB::GFF
在脚本中定义使用模块的路径
1.第一种办法:
use lib qw(绝对路径)
perl安装模块会到不同的路径中,缺哪个模块就去找到该模块的路径 ,没有的话在安装
2.第二种办法:
添加perl调用模块的路径到环境变量中
export PERL5LIB="/usr/share/perl5:/usr/local/lib/x86_64-linux-gnu/perl/5.26.1:$PERL5LIB"
o conf urllist # 查看cpan模块源
o conf urllist push https:////mirrors.aliyun.com/CPAN/ # 添加阿里云的源
o conf commit # 保存
3.python相关下载
pypi 镜像使用帮助
pypi 镜像每 5 分钟同步一次。
临时使用
pip install -i [https://pypi.tuna.tsinghua.edu.cn/simple](https://pypi.tuna.tsinghua.edu.cn/simple) some-package
注意,simple 不能少, 是 https 而不是 http
设为默认
升级 pip 到最新的版本 (>=10.0.0) 后进行配置:
pip install pip -U
pip config set global.index-url [https://pypi.tuna.tsinghua.edu.cn/simple](https://pypi.tuna.tsinghua.edu.cn/simple)
如果您到 pip 默认源的网络连接较差,临时使用本镜像站来升级 pip:
pip install -i [https://pypi.tuna.tsinghua.edu.cn/simple](https://pypi.tuna.tsinghua.edu.cn/simple) pip -U
光速安装python包
pip install matplotlib==1.5.1 -i [http://pypi.douban.com/simple](http://pypi.douban.com/simple) --trusted-host [pypi.douban.com](http://pypi.douban.com/)
pip install matplotlib -i https://[pypi.tuna.tsinghua.edu.cn/simple](http://pypi.tuna.tsinghua.edu.cn/simple)
删除python包
pip uninstall matplotlib
查看包的版本
pip show matplotlib
不同版本python之间 pip的用法
已有python2.7与python3,没有python3的pip,先安装pip
apt-get install python3-pip
python3.8 -m pip install biopython
安装biopython
if name == 'main' 解释:
当一个脚本直接运行时,一下内容都会被输出
当被当做模块使用是:
直接运行该脚本时,会运行脚本内所有内容,但是当被模块导入时,不会运行if name == 'main':下面的内容,一般后面会跟main()函数,这样写避免了运行其他脚本,import模块时因为模块名字和该脚本名称一样,导致运行内容不同。
4.shell相关下载
调用for循环批处理文件
for filename in ./seq/*_1.fq.gz
do
提取双端公共文件名,并输出检验
base=filename _1.fq.gz)
echo $base
多行fa序列变一行
awk '/^>/&&NR>1{print "";}{printf "%s",/^>/?0}' file.fa