1. 軟件準(zhǔn)備
anaconda安裝及使用請(qǐng)自行百度或關(guān)注生信技能樹(shù)驾荣、生信媛撑柔、沈夢(mèng)圓等公眾號(hào)進(jìn)行學(xué)習(xí)。
以下是我配置使用的一些命令展运。需要根據(jù)自己linux進(jìn)行微調(diào)活逆。
# 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
# 如果下載失敗(可能需要翻墻)拗胜,使用電腦創(chuàng)建doctor.py文件蔗候,并將code復(fù)制進(jìn)去。
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
運(yùn)行 doctor.py埂软,檢查學(xué)習(xí)本教程軟件是否已安裝好锈遥。如果出現(xiàn)報(bào)錯(cuò)信息,按照指示操作即可勘畔。
我的計(jì)算機(jī)報(bào)錯(cuò)所灸,所以我需要按照說(shuō)明操作。
如果在墻外炫七,可以直接使用以下命令自動(dòng)安裝需要的軟件爬立。
~/bin/doctor.py | bash
# 將~/bin添加至環(huán)境變量(如果用的Win10 Bash,使用以下命令不會(huì)報(bào)錯(cuò)万哪。)
export PATH=$PATH:/home/jshi/bin >> ./bashrc
在墻內(nèi)可以用以下辦法進(jìn)行安裝
# 下載或創(chuàng)建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文件內(nèi)容如下:
#!/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()