Biostar入门学习笔记(1):软件准备

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()
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 161,601评论 4 369
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 68,367评论 1 305
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 111,249评论 0 254
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 44,539评论 0 217
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,967评论 3 295
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,929评论 1 224
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 32,098评论 2 317
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,825评论 0 207
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,609评论 1 249
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,796评论 2 253
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,282评论 1 265
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,603评论 3 261
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,277评论 3 242
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,159评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,959评论 0 201
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 36,079评论 2 285
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,874评论 2 277

推荐阅读更多精彩内容