1. 软件准备
anaconda安装及使用请自行百度或关注生信技能树、生信媛、沈梦圆等公众号进行学习。
以下是我配置使用的一些命令。需要根据自己linux进行微调。
# download doctor.py script from a terminal:
mkdir -p ~/bin
curl http://data.biostarhandbook.com/install/doctor.py > ~/bin/doctor.py
chmod +x ~/bin/doctor.py
# 如果下载失败(可能需要翻墙),使用电脑创建doctor.py文件,并将code复制进去。
cd ~/bin
vim doctor.py
# paste code from doctor.py here
# press "ESC", then enter":wq!" to save and quit vim editor.
chmod +x ./doctor.py
运行 doctor.py,检查学习本教程软件是否已安装好。如果出现报错信息,按照指示操作即可。
我的计算机报错,所以我需要按照说明操作。
如果在墙外,可以直接使用以下命令自动安装需要的软件。
~/bin/doctor.py | bash
# 将~/bin添加至环境变量(如果用的Win10 Bash,使用以下命令不会报错。)
export PATH=$PATH:/home/jshi/bin >> ./bashrc
在墙内可以用以下办法进行安装
# 下载或创建conda.txt
curl http://data.biostarhandbook.com/install/conda.txt
# or
# paste the package names.
# http://data.biostarhandbook.com/install/conda.txt
# "ESC", then ":wq!" to save changes.
cat conda.txt | xargs conda install -c bioconda -y
# 添加Anaconda清华镜像
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
# conda删除镜像
# conda config --remove channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/'
# 下载安装EMBOSS-6.6.0
$ mkdir -p ~/biosoft/emboss && cd
$ ~/biosoft/emboss
$ wget ftp://emboss.open-bio.org/pub/EMBOSS/EMBOSS-6.6.0.tar.gz
$ tar -zxvf EMBOSS-6.6.0.tar.gz
$ cd EMBOSS-6.6.0
$ ./configure
$ make
$ cp ./bwa /usr/local/bin/
#下载安装subread
mkdir -p ~/biosoft/subread && cd ~/biosoft/subread
wget https://ayera.dl.sourceforge.net/project/subread/subread-1.5.3/subread-1.5.3-Linux-x86_64.tar.gz
tar -zxvf subread-1.5.3-Linux-x86_64.tar.gz
附:doctor.py文件内容如下:
#!/usr/bin/env python
#
# Licensed under the Biostar Handbook license.
#
from __future__ import print_function, unicode_literals
import os
import re
import subprocess
import sys
from os.path import expanduser
from sys import platform
PY3 = True if (sys.version_info > (3, 0)) else False
def regexp_check(pattern, text):
return re.search(pattern, text, re.MULTILINE)
def more_recent(pattern, text):
version = text.strip()
return version >= pattern
# A list of tools to check.
TOOLS = [
# Name, pattern, required, match_func
('bwa', '', True, regexp_check),
('datamash --version', '', True, regexp_check),
('fastqc --version', '', True, regexp_check),
('hisat2', '', True, regexp_check),
('seqret --version', '', True, regexp_check),
('subread-align', '', True, regexp_check),
('featureCounts', '', True, regexp_check),
('R --version', '3.\d', True, regexp_check),
('efetch -version', '5.60', True, more_recent),
('esearch -version', '5.60', True, more_recent),
('samtools --version', '1.3', True, more_recent),
('fastq-dump -version', '2.8.0', True, more_recent),
('wonderdump', '', False, regexp_check),
('global-align.sh', '', False, regexp_check),
('local-align.sh', '', False, regexp_check),
]
def bash_check():
bashrc = expanduser("~/.bashrc")
bashprofile = expanduser("~/.bash_profile")
def path_check():
errors = 0
# The PATH variable
paths = os.environ.get('PATH').split(':')
bindir = expanduser("~/bin")
#
# We need ~/bin to be in the PATH
#
if bindir not in paths:
errors += 1
print("# The ~/bin folder is not in your PATH!")
return errors
def tool_check(tools):
errors = 0
print("# Checking {} symptoms...".format(len(tools)))
for cmd, pattern, required, callback in tools:
args = cmd.split()
try:
proc = subprocess.Popen(args, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
stdout, stderr = proc.communicate()
except OSError as exc:
if required:
word = cmd.split()[0]
print("# Missing program: {}".format(word))
errors += 1
else:
print("# Optional program not found: {}".format(cmd))
continue
stdout = stdout.decode('utf-8')
stderr = stderr.decode('utf-8')
output = stdout + stderr
if pattern:
if not callback(pattern, output):
print("# Version {} mismatch for: {}".format(pattern, cmd))
errors += 1
continue
return errors
FIXME = """
# Install everything:
curl http://data.biostarhandbook.com/install/conda.txt | xargs conda install -y
# A chronic case of Entrez Direct?
mkdir -p ~/src
curl ftp://ftp.ncbi.nlm.nih.gov/entrez/entrezdirect/edirect.zip > ~/src/edirect.zip
unzip -o ~/src/edirect.zip -d ~/src
echo 'export PATH=~/src/edirect:$PATH' >> ~/.bashrc
source ~/.bashrc
"""
def fixme():
print (FIXME)
def health_check():
errors = 0
errors += path_check()
errors += tool_check(tools=TOOLS)
if errors:
if errors == 1:
print("# Your system shows 1 error.")
else:
print("# Your system shows {} errors.".format(errors))
print("# See also: doctor.py --fixme")
else:
print("# You are doing well!")
if __name__ == '__main__':
if '--fixme' in sys.argv:
fixme()
else:
print("# Doctor! Doctor! Give me the news.")
health_check()