Galaxy的安装

具体可参考:http://wiki.galaxyproject.org/Admin/Config/Performance/ProductionServer

1. Galaxy的下载

安装Galaxy需要Python。Get Galaxy,点击:http://wiki.galaxyproject.org/Admin/Get%20Galaxy。先行产看Python的版本,并安装OpenSSL和Bzip2的 -dev 包

$ python --version
$ sudo yum install openssl* bzip2*
$ wget https://bitbucket.org/galaxy/galaxy-dist/get/tip.tar.bz2

要注意的是Galaxy的安装包在国内可能下载不了,需要其它途径获得。

2. Galaxy的安装

安装Galaxy推荐安装在Linux系统一个全新的用户目录下。该用户名为Galaxy, 并使用 clean Python interpreter.

# useradd galaxy
# cd /home/galaxy
# su galaxy
# tar jxf galaxy-dist-cea3ddf6cdda.tar.bz2
# mv galaxy-dist-cea3ddf6cdda galaxy-dist
# wget http://bitbucket.org/ianb/virtualenv/raw/tip/virtualenv.py
# /usr/bin/python2.6 virtualenv.py --no-site-packages galaxy_env
# sh ./galaxy_env/bin/activate
# cd galaxy-dist
# sh run.sh

运行run.sh即开启了Galaxy。第一此运行需要下载很多的eggs,需要一点点时间。

3. Galaxy的配置

3.1 Apache的proxy配置

默认情况下,galaxy只能在本机上访问,如需让远程用户通过网页来方法,则需要对Apache的配置文件进行修改。在 /etc/httpd/conf/httpd.conf 中加入如下语句:

######## For Galaxy ################
<proxy http://122.205.95.116:8080>
    Order deny,allow
#    Allow from all
    Allow from 122.205.*.*
</proxy>
# 以上设置能访问Galaxy的IP,仅限122.205的IP段的用户访问。

RewriteEngine on
#RewriteRule ^(.*) http://122.205.95.116:8080$1 [P]
RewriteRule ^/galaxy$ /galaxy/ [R]
RewriteRule ^/galaxy/static/style/(.*) /home/galaxy/galaxy-dist/static/june_2007_style/blue/$1 [L]
RewriteRule ^/galaxy/static/scripts/(.*) /home/galaxy/galaxy-dist/static/scripts/packed/$1 [L]
RewriteRule ^/galaxy/static/(.*) /home/galaxy/galaxy-dist/static/$1 [L]
RewriteRule ^/galaxy/favicon.ico /home/galxy/galaxy-dist/static/favicon.ico [L]
RewriteRule ^/galaxy/robots.txt /home/galaxy/galaxy-dist/static/robots.txt [L]
RewriteRule ^/galaxy(.*) http://122.205.95.116:8080$1 [P]
# 以上设置访问galaxy的网址为http://122.205.95.116:8080/galaxy,而不需要影响其它的apache服务。

<Location "/galaxy/">
   # Compress all uncompressed content.
    SetOutputFilter DEFLATE
    SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI \.(?:t?gz|zip|bz2)$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI /history/export_archive no-gzip dont-vary
    XSendFile on
    XSendFilePath /galaxy/
</Location>
# 以上设置以压缩方式传输文件,并使用第三方的apache模块来提高性能

<Location "/static">
    # Allow browsers to cache everything from /static for 6 hours
    ExpiresActive On
    ExpiresDefault "access plus 6 hours"
</Location>
# Galaxy的静态内容在client端缓存,提高访问速度。

其中需要使用的第三方apache模块mod_xsendfile.c需要下载后载进行安装。

需要开放8080端口.

# vi /etc/sysconfig/iptables
# /etc/init.d/iptables restart

需要设置Apache对galaxy文件夹的访问权限

# usermod -G galaxy apache
# id apache
# chmod 750 /home/galaxy

3.2 Galaxy的配置文件

Galaxy的配置文件为universe_wsgi.ini,先cp universe_wsgi.ini.sample universe_wsgi.ini,然后再修改该配置文件内容。
3.2.1. 修改developer settings.

debug = False
use_interactive = False
Disable filter-with = gzip

3.2.2. 使用web服务器的配置

[server:main]
host = 122.205.95.116

[filter:proxy-prefix]
use = egg:PasteDeploy#prefix
prefix = /galaxy

[app:main]
filter-with = proxy-prefix
cookie_path = /galaxy

4. Galaxy依赖的软件

Galaxy的框架搭建起来后,需要依赖很多的软件和工具,才能正常运行。而这些软件和工具是Galaxy所不能完全提供的。
Tool Dependencies请点击:http://wiki.galaxyproject.org/Admin/Tools/Tool%20Dependencies

NGS数据的质量评估和reads的处理

1. 基因组测序和转录测序的NGS数据处理策略

从测序公司拿到数据后,首先需要对数据进行预处理,主要分两步走:

1.1 QC(reads的质量控制)

Quality Control,即过滤低质量reads,低质量的reads有如下几种:
含有Primer/Adaptor的reads
含有过多non-ATCG碱基N的reads
测序质量较低的碱基数占的比例过高的reads

需要将这些reads完全过滤掉,才能用于下一步的分析。

1.2 对reads进行trim处理

如果进行基因组组装,则不需要进行该步骤。如果是需要进行转录组的分析,则必须要该步骤。

本步骤从3’端来对reads进行trim,来控制reads中低质量碱基的比例。直到trim的read长度低于一定的数时,则完全舍弃该read。

2. NGS数据的QC软件

2.1 NGSQC toolkit

该软件的citation:Patel RK, Jain M (2012). NGS QC Toolkit: A toolkit for quality control of next generation sequencing data. PLoS ONE, 7(2): e30619.

该软件的官网:http://www.nipgr.res.in/ngsqctoolkit.html

该软件解压缩后包括4个文件夹和1个PDF格式的manual文件。manual文件是详细的说明;4个文件夹中都是使用perl编写的用于QC的程序。按其重要程度决定先后,其介绍如下:

2.1.1 QC文件夹中包含了4支perl程序,用于454 reads或Illumina reads的QC,分别为:

IlluQC.pl 用于Illumina reads的QC。默认情况下去除掉含有primer/adaptor的reads和低质量的reads,并给出统计结果和6种图形结果。默认设置 (‘-s’ 参数) 碱基质量低于20的为低质量碱基;默认设置 ( ‘-l’ 参数)低质量碱基在reads中比例 >30% 的为低质量reads。程序运行例子:

$ perl $NGSQCHome/QC/IlluQC_PRLL.pl -pe r1.fq r2.fq 2 5 -p 8 -l 70 -s 20

IlluQC_PRLL.pl 和上一个程序没有多大区别,只是多了 ‘-c’ 参数来进行并行计算,增加程序速度。

454QC.pl 对454 reads进行QC。
454QC_PRLL.pl 和上一个程序一眼个,只是多了 ‘-c’ 参数来进行并行计算,增加程序速度。
454QC_PE.pl 对paired-end测序的454 reads进行QC。

2.1.2 TrimingReads文件夹包含3支程序,用于reads的trimming,分别为:

AmbiguityFiltering.pl 对含有non-ATCG的reads进行trimming的程序。有4种(4选1)trim方法:允许最大non-ATCG数目;允许最大的non-ATCG比例(例子如下);从5’端trim掉含N的序列;从3’端trim掉含N的序列。加上个通用的参数:低于一定长度的reads被cutoff掉。

$ perl $NGSQCHome/Trimming/AmbiguityFiltering.pl -i r1.fq -irev r2.fq -p 2 -n 50

TrimmingReads.pl 有3种(3选1)trim方法:对所有read从5’端trim掉制定数目的碱基;对所有reads从3’端trim掉指定数目的碱基;从3’端trim掉质量低于指定值的碱基(例子如下)。加上个通用的参数:低于一定长度的reads被cutoff掉。

$ perl $NGSQCHome/Trimming/TrimmingReads.pl  -i r1.fq -irev r2.fq -q 13 -n 50

HomopolymerTrimming.pl

2.1.3 Statistics文件夹中2支程序,用于进行N50统计等

N50Stat.pl 用于统计fasta文件的N50
AvgQuality.pl 用于统计454文件的reads质量

2.1.4 Formt-converter文件夹中程序运用于不同格式文件的转换,其中含有4个perl程序,分别为:

FastqTo454.pl、FastqToFasta.pl、SangerFastqToIlluFastq.pl、SolexaFastqToIlluFastq.pl