USB安装64位的CentOS6.4

一、方法1

1. 官网下载系统安装包

2. 将DVD1包烧录至U盘

在windows系统下可以使用Ultraiso

3. 替换vesamenu.c32文件

此步骤为关键的步骤,若不进行,则会在U盘引导计算机时,启动后卡在下面的界面:Press the key to begin the installation process。

使用CentOS6.0版本的vesamenu.c32文件替换U盘中syslinux/目录下的vesamenu.c32文件,即可。

4. 镜像文件

64位的镜像文件较大,需要将DVD1文件复制到一个可以容纳该文件的文件系统中。使用Ultraiso烧录的U盘为fat文件系统,不能装入镜像文件;常用的windows下NTFS文件系统不能被centos识别。推荐另外找快容量较大的U盘或移动硬盘,格式换成linux系统识别的ext4文件系统。然后将DVD1文件复制到ext4文件系统的磁盘根目录下;同时提取iso文件中的image文件夹到该磁盘根目录下。

此步骤也关键,否则,“定位在 Hard drive 上, directory holding image”此关就过不去了。

参考自:http://blog.chinaunix.net/uid-22566367-id-3346333.html,可以在该站点下载到 vesamenu.c32.zip

此方法本人使用来一次,发现安装完毕后没能引导进入系统。推荐第二种方法,一次性成功。

二、方法2

方法来自:如何利用Usb盘安装CentOS操作系统20111208

1. 准备好CentOS镜像和容量足够的U盘,8G以上为宜

2. 在Linux上对U盘进行分区和文件系统创建

以下方法将U盘分成两个区:第一个区大小150M,用于fat32文件系统;第二个分区大小为剩下的所有部分,用于ext2文件系统。

# fdisk /dev/sdb
m    帮助命令
d    删除磁盘分区,如果有已经存在多个分区,多次该命令
n    新建分区
p    选择分区为主分区
1    第一个分区
  回车选择分区起始为默认的磁柱1开始
+150M    选择第一个分区大小为150M
t    分区的文件系统类型
l    列出所有的文件系统类型
b    选择文件系统为fat32

n    新建分区
p    选择分区为主分区
2    第二个分区
  回车选择分区起始为默认的磁柱开始
  回车选择分区结束区为最后的磁柱末

a    选择启动分区
1    以第一分区为启动分区
w    写入分区格式

分区完后,对分区进行格式化:

# mkfs.vfat -n BOOT /dev/sdb1
# mkfs.ext2 -m 0 -b 4096 -L DATA /dev/sdb2

以上第2个命令可能需要等待很长时间。

3. 挂在U盘分区并拷入文件

3.1 在默认情况下,重新插上U盘,则会自动将U盘分区挂载到了/media目录下。若默认情况下不挂载,则手动挂载如下:

# mkdir /media/BOOT /media/DATA
# mount /dev/sdb1 /media/BOOT
# mount /dev/sdb2 /media/DATA
# mount -ro loop CentOS-6.4-x86_64-bin-DVD1.iso /mnt

以上命令中也将CentOS6.4的镜像文件挂载到了/mnt中。

接下来需要将镜像文件中的isolinux文件夹拷贝到U盘的第一分区中,并稍作修改,并让第一分区作为启动分区,用来启动CentOS的安装界面;将镜像文件拷贝到U盘第二分区,支持整个系统的安装,同时将镜像中的images/install.img拷贝到U盘第二分区,用于系统的安装。

# cp CentOS-6.4-x86_64-bin-DVD1.iso /media/DATA/
# mkdir /media/DATA/images
# cp /mnt/images/install.img /media/DATA/images/

# yum install syslinux
# syslinux -s /dev/sdb1    配置syslinux在U盘第一分区
# dd if=/usr/share/syslinux/mbr.bin of=/dev/sdb    写入MBR

# cp /mnt/isolinux/ /media/BOOT/syslinux
# mv /media/BOOT/syslinux/isolinux.cfg /media/BOOT/syslinux/syslinux.cfg
# rm -f /media/BOOT/syslinux/isolinux.bin

# umount /mnt
# umount /media/BOOT
# umount /media/DATA

至此,CentOS的U盘启动安装盘作好了,可以用于CentOS系统的安装。不需要像第一个方法中变更vesamenu.c32文件,这样可能是导致安装完毕后无法正常引导系统的原因。

需要注意的是,我是将第二分区内的镜像文件和images文件夹一起放在了centos文件夹下面;这样按如何利用Usb盘安装CentOS操作系统20111208中所述,则需要修改/media/BOOT/syslinux/syslinux.cfg文件,在文件中加入下述的斜体字部分。好处是让第二分区在进行正常文件存放时更整洁。

append initrd=initrd.img repo=hd:sdb2:/centos

同时,在安装过程中我卡在了“定位在 Hard drive 上, directory holding image”这一关卡上。首先硬盘驱动里面只有/dev/sda,没有/dev/sdb。于是我换了个USB插口,就能显示了(可能是USB口原因,或需要重新插拔U盘)。然后在下面的横线中出现的”/images/install.img”前面手动加上“/centos”,于是正确定位到了该文件(默认情况下不需要加“/centos”)。

NGS数据的Error correction方法

参考自文献:Yang X,Chockalingam SP,Aluru S. A survey of error-correction methods for next-generation sequencing. Brief. Bioinformatics 2013;14:56-66.

现在进行error-correciton的算法有三种: k-spectrum-based、Suffix tree/array based 和 MSA based。本文对以下软件使用真实数据进行了评估:HSHREC、Reptile、Quake、SOAPec、HiTEC、ECHO、Coral(只有第一个和最后一个,共2个软件用于454和ion数据的评估;所有软件都用于了Illumina数据的评估)。

该文献的结果表明:适用于Illumina数据的软件(我个人认为的优先顺序)是 Reptile、HiTEC(在2*100的数据中结果最好) 和 ECHO。Reptile的参数选择比其它两个软件要麻烦很多;HiTEC不适合处理有‘N’的或不同长度reads。适用于454和ion数据的软件是Coral。

以上是对基因组的测序reads进行修正的方法,而新出了一个对RNA-Seq数据进行修正的软件:SEECER。其文献为:Probabilistic error correction for RNA sequencing。文中结果表示,以上对基因组reads进行修正的方法对RNA-Seq reads的修正效果不好。

以下是这几个软件的安装与使用方法:

1. HiTEC

HiTEC的下载网页:http://www.csd.uwo.ca/~ilie/HiTEC/。根据其安装源码包内的说明文件,HiTEC的安装需要先行安装gsl library,然后修改Makefile文件,最后进行make。

HiTEC的参数比较简单,运行方法如下:

$ ./hitec <inputReads> <correctedReads> \
  <GenomeLength> <per-base error rate>

$ ./hitec S.aureusReads.fasta \
S.aureusCorrectedReads.fasta 2820462 1

输入fasta或fastq文件,给定一个大致的基因组大小和碱基错误率,则会运行,并将结果输出到指定文件中。

HiTEC将忽略那些含有碱基 “N” 的reads,这些reds不会在输出文件中显示。输出结果为fasta文件,fasta的头被更换了,变成了从0开始的数字。

2. ECHO

ECHO的下载网页:http://uc-echo.sourceforge.net/。根据其安装源码包内的说明文件,ECHO的安装需要有GCC,Python,SciPy和NumPy,使用yum安装即可。ECHO的运行也比较简单:

$ python ErrorCorrection.py -b 2000000 --nh 256 \
  --ncpu 6 -o output/5Mreads.fastq 5Mreads.fastq

生成了结果文件和HiTEC一样,生成fasta文件,fasta的头被更换了,变成了从0开始的数字。

3. reptile

reptile的下载网页:http://aluru-sun.ece.iastate.edu/doku.php?id=reptile

reptile的使用说明相比前两个软件,更加完整。其使用说明参考软件包中的readme文件和网页的turorial。以下为reptile使用实例:

3.1 将fastq文件转换成fa文件和q文件

对象为名为reads.fastq的文件,位于当前工作目录。reads.fastq为使用NGSQC-toolkit过滤掉低质量reads和含有N的reads后的文件。

$ $reptileHome/utils/fastq-converter-v2.0.pl ./ ./ 1

结果生成reads.fa和reads.q文件。这两个文件都为fast格式,fasta头为从0开始按顺序排列的数字,内容分别为序列和质量。

3.2 seq-analy配置文件参数调整

copy一个范本的seq-analy配置文件和Reptile配置文件。

$ cp $reptileHome/utils/seq-analy/config-example seq-analy-config
$ cp $reptileHome/src/config-example reptile-config

将该配置文件修改如下:

IFlag                   1
BatchSize               1000000
InFaFile                ./reads.fa
IQFile                  ./reads.q
KmerLen                 24
OKmerHistFile           ./kmerhist
QHistFile               ./qualhist
OKmerCntFile    
MaxErrRate              0.02
QThreshold              73
MaxBadQPerKmer          4
QFlag                   1

修改好输入和输出文件路径后,运行程序:

$ $reptileHome/utils/seq-analy/seq-analy seq-analy-config

以上命令执行后生成根据配置文件信息输出./kmerhist和./qualhist两个文件。

继续修改seq-analy-config配置文件信息:
1. reads长度为35bp的时候,MaxBadQPerKmer的值设为4-6;reads长度为100+bp的时候,MaxBadQPerKmer的值设为6-10.
2. KmerLen可以按自己的意愿设置,可以保留为默认的24.
3. 查看./qualhist文件信息,找出第三列累计频率 >=0.8 的那一行对应的碱基质量对应的ASCII值,作为QThreshold的值;同时找出第三列累计频率 <= 0.2 的那一行对应的碱基质量对应的ASCII值,作为下一步 Reptile配置文件中 Qlb 参数的值。 修改完seq-analy-config配置文件后,继续运行“seq-analy seq-analy-config”,直到不用继续修改为止;如果当前不用修改,则进入下一步。

3.3 Reptile配置文件参数调整

对范本Reptile配置文件修改,修改读取文件和输出文件,如下:

InFaFile                ./reads.fa
QFlag                   1
IQFile                  ./reads.q
OErrFile                ./reads.errors
BatchSize               1000000 
KmerLen                 12
hd_max                  1
Step                    12
ExpectSearch            16 
T_ratio                 0.5

######## The following parameters need to be tuned to specific dataset ########

QThreshold              73
MaxBadQPerKmer          4
Qlb                     62
T_expGoodCnt            16
T_card                  6

通时,对上数的一些参数进行修改:
1. T_expGoodCnt,设置为./kmerhist第三列累计频率最接近0.95的一行的第一列的值的2倍;
2. T_card,设置为./kmerhist第二列中第二大的值的一行所对应的第一列的值;
3. KmerLen,设置为 >= (seq-analy最终的配置文件中该参数的值的一半);
4. QThreshold, 和seq-analy最终的配置文件中该值的设置一致;
5. Qlb, 设置为./qualhist文件中,第三列累计频率 <= 0.2 的那一行对应的碱基质量对应的ASCII值; 6. MaxBadQPerKmer,和seq-analy最终的配置文件中该值的设置一致; 7. step 设置为【(seq-analy最终的配置文件中KmerLen值) - (本reptile参数文件中KmerLen的值)】的值

3.4 运行Reptile

$ $reptileHome/src/reptile-v1.1 reptile-config

生成了配置文件中设定的结果文件./reads.errors。该文件格式为:

ReadID ErrNum [pos to from qual] [pos to from qual] …

第一列是read ID; 第二列为该read错误的碱基数; 对每一个错误的碱基,有4个值给出来:该错误碱基的位置(pos)、新的修正后的碱基(to)、原来的错误的碱基(from) 和 该位点碱基质量对应的ASCII值(qual)。

3.5 生成修正后的fasta文件

$ $reptileHome/utils/reptile_merger/reptile_merger \
  ./reads.fa ./reads.errors out.fa

Velvet的安装和使用

1. Velvet的安装

Velvet用于基因组的de novo组装,支持各种原始数据,包括Illumina的short reads和454的long reads。

首先下载velvet的安装包,直接使用make命令来编译,即可获得可执行主程序velveth和velvetg。安装如下:

$ wget http://www.ebi.ac.uk/~zerbino/velvet/velvet_1.2.10.tgz
$ tar zxf velvet_1.2.10.tgz
$ cd velvet_1.2.10
$ make 'CATEGORIES=10' 'MAXKMERLENGTH=57' 'LONGSEQUENCES=1' \
  'OPENMP=1' 'BUNDLEDZLIB=1'

值得注意的是,make后有多种参数,需要对velvet软件进行需要的设置:

CATEGORIES=10: 默认情况下velvet只能输入 2 groups of short reads,此处设置为10. 如果有多个文库或多种类型的原始数据,需要相应增加该值的大小。该值越大,耗内存越大。

MAXKMERLENGTH=57: 最大的Kmer长度,默认情况下该值为 31, 一般de novo组装基因组,31 是不够的,故需要增大该值。组装过程中kmer越大,越耗内存。

BIGASSEMBLY=1: 当超过 2.2G 的reads用于组装基因组的时候,需要设置该值。实际上很少会有如此之多的reads用于基因组组装,可以不用设置该值。设置该值后,会消耗更多的内存。

LONGSEQUENCES=1: 当组装出的contigs长度超过 32kb 长的时候,需要设置该值。会消耗跟多内存。

OPENMP=1:打开多线程运行。需要设置环境变量 OMP_NUM_THREADS 和 OMP_THREAD_LIMIT。 Velvet最多使用 OMP_NUM_THREADS+1 或 OMP_THREAD_LIMIT 个线程。也值哟部分的velvet算法支持多线程运行,不会造成运行时间的线性减少。

BUNDLEDZLIB=1: 默认velvet使用系统自带的zlib,如果系统没有zlib,则需要加入该参数来使用velvet源码包中自带的zlib。

在上述 make 编译完 Velvet 后,继续velvet的使用

2. 使用velveth来准备数据

velveth接受输入的文件,产生一个hash表。生成两个文件:Sequences和Roadmaps。velveth用法为:

$ velveth
$ velveth output_directory hash_length \
  -file_format -read_type filename1 filename2 ... \
  [-file_format -read_type filename1 filename2 ...]

在不带参数情况下,直接运行velveth会给出其帮助文件。而其参数如下:

output_directory:输出文件夹的路径

hash_length: 设置Kmer的大小。该值3点要求:1.必须为奇数;2.必须小于或等于编译velvet时设置的MAXKMERLENGTH值;3.必须小于reads的长度。

file_format: 支持的格式有fasta(默认)、fastq、bam等。

reads_type: short(默认)、shortpaired、short2、shortpaired2 … short10、shortpaired10、long、longPaired。 默认情况下short reads只保留了2个通道。在之前设置中将CATEGORIES值设置为10,则velvet最多支持10种不同类型的short reads数据。long支持长的reads,比如sanger测序数据和454测序数据。 如果reads_type一致,则同一个reads_type下可以有多个文件。

filename1: reads的文件名。如果是成对的reads,则需要将两个reads文件合并成一个文件。Velvet安装文件夹中提供了这样的一个文件。

一个velveth的例子。对5个Illumina测序的结果和一个454测序的结果使用velvet进行组装:

$ velveth output/ 31 \
  -shortPaired -fastq fragment1.reads.fastq \
  -shortPaired2 -fastq fragment2.reads.fastq \
  -shortPaired3 -fastq jumping1.reads.fastq \
  -shortPaired4 -fastq jumping2.reads.fastq \
  -long -fastq 454.fasta

3. 使用velvetg来进行基因组组装

velvetg是vlevet软件的进行de Bruijin图构建和操作的核心。在命令行下直接键入命令velvetg,这样描述:velvetg – de Bruijn graph construction, error removal and repeat resolution。其使用方法如下:

$ velvetg
$ velvetg directory [options]

$ velvetg output -exp_cov auto -cov_cutoff auto \
  -shortMatePaired3 yes -shortMatePaired4 yes \
  -clean yes -scaffolding yes -amos_file yes

velvetg的具体参数如下:

directory 工作的目录名,即为上一步骤velveth中的输出文件夹。

-cov_cutoff <float|auto> default: no removal
设置最低kmer覆盖度的值。默认下会生成很多nodes,而有些nodes很短,覆盖度较低,需要去除掉。auto则自动设置该值,是该值为所有nodes的kmer覆盖度值的median值的1/2。

-exp_cov <float|auto> default: no long or paired-end read resolution。
期望的kmer覆盖度。如果设置了auto,则该值为所有nodes的kmer覆盖度值的median值; 该值设置为auto,则同时自动设置-cov_cutoff为auto。如果对杂合基因组进行组装时,设置auto,却很难进行预测,组装结果肯定不好。auto适用于标准的基因组测序。

-long_cov_cutoff <float> default: no removal
移除低long-read覆盖度的nodes。

-ins_length <interger>
成对的short reads间的distance的期望值,即插入片段的平均长度。

-ins_length* <interger>
*代表第*组shortPaired reads, 和 velveth 中的参数相对应。

-ins_length_long <interger>
和前两个参数一样,代表longPaired reads的插入片段长度。

-ins_length*_sd <interger>
此时’*’代表’nothing、2、3…、long’等,和上面的3个参数相匹配;该值设置插入片段长度的标准差。有关插入片段长度和sd的如果不设置,velvet则会自动计算。velvet是将成对的reads比对到组装出来的nodes上,最后计算出一个insert size 和sd。这样做的话,可能估算的不准确,需要看velvet的运行输出信息,检测其预算是否准确。

-scaffolding <yes|no> defautl: yes
是否要使用paired end信息进行scaffolds组装

-max_branch_length <integer> default: 100
处理气泡(bubble)的参数。默认下,如果两条序列超过了100bp的位点处的kmer不一致,则将这两条序列分开成单独的contigs。

-max_divergence <float> default: 0.2
在一个bubble内两条branches最大的差异率(分母为较长的branch的长度)。

-max_gap_count <integer> default: 3
在一个bubble内两条branches比对结果中,运行的最大gap数。该参数和上两个参数为重要的参数,能很大程度上影响组装结果。如果设置得松点,可分别将值设为200,0.33,5。

-min_pair_count <integer> default: 5
默认,将两个contigs连成scaffold最少需要5对paired reads的验证。如果测序深度较大,则可以提高该值;测序深度低,则降低该值。

-long_mult_cutoff <integer> default: 2
默认下,融合两个contigs需要最少有2个long reads验证。

-max_coverage <float> default: no removal
最高的覆盖度,高于此覆盖度的nodes将被删除。

-coverage_mask <integer> default: 1
contigs最小的置信覆盖度,低于此覆盖度的contigs被maksed。

-shortMatePaired* <yes|no> default: no
如果哪一个shortPaired为mate-pair library测序的结果,则需要指定该参数为yes。

-conserveLong <yes|no> default: no
是否保留含有long reads的序列

-unused_reads <yes|no> default: no
是否输出unused reads, 保存到 UnusedReads.fa 中。

-alignments <yes|no> default: no
是否输出contig比对到参考序列的summary.

-exportFiltered <yes|no> default: no
是否输出由于覆盖度的原因被过滤掉的long nodes。

-clean <yes|no> default: no
是否删除所有的不能用于重新计算的中间文件

-very_clean <yes|no> default: no
是否删除所有的中间文件(删除后不能重新计算)

-min_contig_lgth <integer> default: hash length * 2
输出结果中最小的contigs长度

-amos_file <yes|no> default: no
是否输出AMOS文件

velvetg的默认输出结果

directory/contigs.fa 长度2倍长于kmer的contigs。参数-scaffolding决定生成的该fasta文件是否包含scaffold序列。
directory/stats.txt 用于决定覆盖度cutoff的统计表
directory/PreGraph 初始的de vruijin图
directory/Graph2 最终的de bruijin图 关于该文件中内容的解释,请见velvet PDF manual。
directory/velvet_asm.afg AMOS兼容的组装文件,能用于AMOS基因组组装软件包
directory/Log velvet的运行记录

4. Velvet提供了额外的一些scripts

这些scripts非常有用,位于$velvetHome/contrib/文件夹下。

4.1 estimate-exp_cov

在使用velvetg组装出一个初步结果后,利用结果文件stats.txt来估算出kmer的期望覆盖度。

$ $velvetHome/contrib/estimate-exp_cov/velvet-estimate-exp_cov.pl \
  [options] stats.txt

4.2 observed-insert-length.pl

在使用velvetg组装出一个初步结果后,以结果文件夹为输入,计算insert size和insert sd。

$ $velvetHome/contrib/observed-insert-length.pl/observed-insert-length.pl \
  [options] Velvet_directory

4.3 shuffleSequences

将对称的reads1和reads2文件合并成一个文件,用于velvet的输入。velvet不能将两个文件用于输入。

$ $velvetHome/contrib/shuffleSequences_fasta/shuffleSequences_fastq.pl \
  reads1.fastq reads2.fastq reads.fastq

4.4 VelvetOptimiser

输入该脚本的命令,不加参数,给出详细的帮助信息。该程序用于选取不同的Kmer值,来对原始数据进行组装,同时计算出最优化的组装参数。最后给出最优化方案的组装结果。非常适合于简单基因组的自动化组装操作。其参数设置较为简单。当然需要能在$PATH中有velveth和velvetg两个主要的velvet命令。以下就不详细介绍该命令参数,仅给出一个例子:

$ $velvetHome/contrib/VelvetOptimiser-2.2.4/VelvetOptimiser.pl \
  --s 17 --e 97 --x 2 --a --t 4 --k 'n50' --c 'Lbp' \
  --f '-shortPaired -fastq fragment1.reads.fastq \
  -shortPaired2 -fastq fragment2.reads.fastq \
  -shortPaired3 -fastq jumping1.reads.fastq \
  -shortPaired4 -fastq jumping2.reads.fastq \
  -long -fastq 454.fasta' \
  -o 'shortMatePaired3 yes shortMatePaired4 yes' \
  [-g 40M]

以上命令意义为:使用kmer长度从17到97,每次运行kmer长度+2; –a表示要生成amosfile;使用N50来决定kmer的选取;以’Lbp’,即大于1kb的contigs的总碱基数来决定coverage cutoff的值的选取;–f后为velveth的参数;–o后接velvetg的参数;-g后为预计的基因组大小,用于计算该命令下内存的消耗,然后退出运行,由于该程序会同时运行多个velvet和velveg,消耗的内存巨大。

4.5 AssemblyAssembler

该程序能使用不同的kmer组装出很多Assemblies,然后将这些Assemblies组装融合出一个最终的结果。其使用方法位于该程序的通目录下的README文本文件中。给出一个例子如下:

$ $velvetHome/contrib/AssemblyAssembler1.3/AssemblyAssembler1.3.py \
  -s 17 -e 99 -v $velvetHome -c 5.1 -t 35 -i 300 -m 51 -r y \
  -f "-fastq -shortPaired reads.fastq"

以上命令意义为:使用从17到99的kmer,每种kmer都组装出基因组并最后合并成一个结果。-c为coverage cutoff值;-t设置为只有大于35的kmer时,才进行coverage cutoff;-i表示插入片段长度为300;-m表示期望的kmer覆盖度为51;-r表示结果给出short reads要包含到最后的组装结果中。

可以看出该程序适合于只有一种类型的short reads时,才适合。因为其参数-i只能设置一种插入片段长度大小。

4.6 其它程序

extractContigReads用于提取和指定conting相对应的reads;

afg_handing 用于检查 .afg 文件;

fasta2agp 用于将fasta格式的基因组组装结果(gaps用N表示)转换成AGP文件,用于提交到EMBL或NCBI;

show_repeats 指出Assembly中larger repeated contigs的长度;

read_prepare 和 select_paired 用于NGS数据的过滤

5. 有参考基因组下velvet的组装

转录组De novo组装软件

1. Trinity

Trinity,本博客之前介绍了:Trinity的安装与使用

Citation: Grabherr MG, Haas BJ, Yassour M, Levin JZ, Thompson DA, Amit I, Adiconis X, Fan L, Raychowdhury R, Zeng Q, Chen Z, Mauceli E, Hacohen N, Gnirke A, Rhind N, di Palma F, Birren BW, Nusbaum C, Lindblad-Toh K, Friedman N, Regev A. Full-length transcriptome assembly from RNA-seq data without a reference genome. Nat Biotechnol. 2011 May 15;29(7):644-52. doi: 10.1038/nbt.1883. PubMed PMID: 21572440.

2. Oases

Oases是EMBL-EBI开发出来的,是一种使用short reads(such as Illumina, SOLiD, or 454)进行de novo转录组组装的软件。Oases是在velvet的基础上开发的,其运行需要安装Velvet。

Citation:M.H. Schulz, D.R. Zerbino, M. Vingron and Ewan Birney. Oases: Robust de novo RNA-seq assembly across the dynamic range of expression levels. Bioinformatics, 2012. DOI: 10.1093/bioinformatics/bts094.

上文献中写道:It was tested on human and mouse RNA-seq data and is shown to improve significantly on the transABySS and Trinity de novo transcriptome assemblers.

3. EBARDenovo

EBARDenovo, which stands for Extension, Bridging And Repeat-sensing Denovo. This software package (with patent pending) is free of charge for academic use only.

Citation:Hsueh-Ting Chu,William W. L. Hsiao,Jen-Chih Chen,Tze-Jung Yeh,Mong-Hsun Tsai,Han Lin,Yen-Wenn Liu,Sheng-An Lee,Chaur-Chin Chen,Theresa T. H. Tsao,and Cheng-Yan Kao。EBARDenovo: highly accurate de novo assembly of RNA-Seq with efficient chimera-detection Bioinformatics (2013) 29 (8): 1004-1010 first published online March 1, 2013 doi:10.1093/bioinformatics/btt092

上文献中写道:our algorithm is the most accurate among the examined programs, including de Bruijn graph assemblers, Trinity and Oases.

4. Trans-ABySS

Trans-ABySS: Analyze ABySS multi-k-assembled shotgun transcriptome data.

Trans-ABySS 1.4.4, Released Oct 09, 2012, Supports both transcriptome and genome assemblies. A more robust pipeline and improvement to the 3 analysis suites (fusions, indels, and splicing).
Citation:Robertson G,et al. De novo assembly and analysis of RNA-seq data. Nat. Methods 2010;7:909-912.

Variant calling 软件

1. SNP和INDEL caller

1.1 GATK

1.2 SAMtools

1.3 DISCOVAR

DISCOVAR的官方博客:http://www.broadinstitute.org/software/discovar/blog/。该软件和ALLPATHS-LG是同一个组织开发的,是在ALLPATHS-LG的基础上开发的,用于基因组的组装和Variants的发掘。2013.3 公布出了该软件。

1.4 PyroHMMvar

PyroHMMvar: a sensitive and accurate method to call short INDELs and SNPs for Ion Torrent and 454 data. 2013.8.28发表在bioinformatics上。

Illumina数据模拟软件

现有的Illumina数据模拟软件有以下几种:

1. pIRS

piRS: Profile-based Illumina pair-end reads simulator. 是BGI开发出来的软件。使用C++和Perl编写,下载地址:ftp://ftp.genomics.org.cn/pub/pIRS/。pIRS同时提供了一个引入variants的工具,从而能模拟杂合基因组数据。

文献:Xuesong Hu,Jianying Yuan,Yujian Shi,Jianliang Lu,Binghang Liu,Zhenyu Li,Yanxiang Chen,Desheng Mu,Hao Zhang,Nan Li,Zhen Yue,Fan Bai,Heng Li,and Wei Fan。 pIRS: Profile-based Illumina pair-end reads simulator Bioinformatics (2012) 28 (11): 1533-1535
first published online April 15, 2012 doi:10.1093/bioinformatics/bts187

2. ART

ART能模拟Illumina, 454和SOLiD的这3中NGS数据,包括 single-end, paired-end和mate-pair三种类型的数据。ART是NIH开发出的软件。其官网网址为:http://www.niehs.nih.gov/research/resources/software/biostatistics/art/。现在ART支持Illumina MiSeq的数据模拟了。该软件更新较多较快。

Citation: Weichun Huang, Leping Li, Jason R Myers, and Gabor T Marth. ART: a next-generation sequencing read simulator, Bioinformatics (2012) 28 (4): 593-594

3. 其它软件

Wgsim from the Samtools package (Li et al., 2009)

MetaSim (Richter et al., 2008) for simulating metagenomic data

Mason (http://seqan.de/projects/mason.html) for both Illumina and 454 reads

SimSeq (https://github.com/jstjohn/SimSeq) for Illumina reads

FlowSim (Balzer et al., 2010) for 454 reads.

PBSIM: PacBio reads simulator–toward accurate genome assembly

计算paired-end测序的insert size

给出的条件为:
参考序列文件: ref.fasta
Illumnina paired-end文件: reads1.fq, reads2.fq

1. 结合 Bowtie2,SAMtools 和 Picard的使用来计算insert size

1.1 将paired-end数据比对到参考序列上

$ bowtie2-build ref.fasta ref
$ bowtie2 --rg-id librarylength_insert --rg "PL:ILLUMINA" \
  --rg "SM:Strain" -x ref -p 8 \
  -1 reads1.fq -2 reads2.fq -S align.sam

1.2 将sam格式比对结果转换为bam格式并排序

使用samtools将sam文件转换成bam文件;使用picard将bam文件进行排序.

$ samtools view -bS align.sam > align.bam
$ jar Xmx2g -jar $picardHome/SortSam.jar \
  I=align.bam O=align.sort.bam SO=coordinate

1.3 计算insertsize

输入排序后的bam文件,使用picard生成insertsize的txt的结果文件和PDF格式的图形结果。

$ jar Xmx2g -jar $picardHome/CollectInsertSizeMetrics.jar \
  I=align.sort.bam R=ref.fasta  \
  O=insertsize.txt H=insertsize.pdf

2. 使用Qualimap来计算insertsize

2.1 Qualimap的介绍

Qualimap 用于NGS比对数据的质量控制。使用JAVA和R编写的程序,有GUI和command-line两种运行方式。

文献:Fernando García-Alcalde, Konstantin Okonechnikov, José Carbonell, Luis M. Cruz, Stefan Götz, Sonia Tarazona, Joaquín Dopazo, Thomas F. Meyer, and Ana Conesa “Qualimap: evaluating next-generation sequencing alignment data.” Bioinformatics 28, no. 20 (2012): 2678-2679.
doi: 10.1093/bioinformatics/bts503

2.2 Qualimap的安装

Qualimap的正常使用需要 JAVA runtime vesion 6 或以上版本; R 2.14 或以上版本;需要一些 R 包。该软件默认使用最高线程数运行,速度不错。

$ wget http://qualimap.bioinfo.cipf.es/release/qualimap_v0.7.1.zip
$ unzip qualimap_v0.7.1.zip
$ cd qualimap_v0.7.1
$ sudo su
$ /usr/local/bin/Rscript scripts/installDependencies.r
$ R
> source("http://bioconductor.org/biocLite.R")
> biocLite("gplots","Repitools")

3. 注意事项

对于基因组的paired-end测序,将reads比对到参考基因组上;但是对于转录组测序的paired-end测序,则最好将reads比对到转录组序列上。而比对到基因组序列上reads数会偏少。

结合GATK和SAMtools从头挖掘SNPs和INDELs

提出问题

给出以下的已有结果:
1. 物种species的基因组fasta文件: genome.fasta
2. 对该物种的一个名为sample的基因组DNA样,进行了Illumina hiseq2000 paired-end测序(300bp插入片段文库,~20x基因组碱基覆盖度),结果文件: reads1.fq, reads2.fq
问怎么进行SNPs和INDELs的calling?

文章有很多地方引自Nowind的博文:GATK使用简介 Part2/2
流程参照:http://www.broadinstitute.org/gatk/guide/topic?name=best-practices

以下给出具体的答案和步骤, 以上述已有结果的3个文件所在的目录为当前工作目录,各种软件的主目录以$software表示。多线程的程序以8个线程运行。

1. Raw reads的处理

使用NGSQC toolkit使用默认设置对raw reads进行过滤。

$ perl $NGSQCToolkitHome/QC/IlluQC_PRLL.pl \
  -pe reads1.fq reads2.fq 2 5 -c 8 \
  -o QC

2. 将过滤后的reads比对到基因组上

$ bowtie2-build genome.fasta genome
$ bowtie2 --rg-id sample --rg "PL:ILLUMINA" --rg "SM:sample" \
  -x geome -1 ./QC/reads1.fq_filtered -2 ./QC/reads2.fq.filtered \
  -p 8 -S sample.sam

3. 将sam文件转换为Bam文件并标记出PCR duplicates

$ samtools view -bS sample.sam > sample.bam
$ java -Xmx10g -jar $picardHome/SortSam.jar \
  INPUT=sample.bam OUTPUT=sample.sort.bam \
  SORT_ORDER=coordinate
$ java -Xmx10g -jar $picardHome/MarDuplicates.jar \
  INPUT=sample.sort.bam OUTPUT=sample.dd.bam \
  METRICS_FILE=sample.dd.metrics \
  MAX_FILE_HANDLES_FOR_READ_ENDS_MAP=1000

4. 构建索引文件

$ samtools faidx genome.fasta
$ java -Xmx10g -jar $picardHome/CreateSequenceDictionary.jar \
  R=genome.fasta O=genome.dict
$ samtools index sample.dd.bam

5. 对INDEL周围进行重新比对(realignment)

$ java -Xmx10g -jar $GATKHome/GenomeAnalysisTK.jar \
  -R genome.fasta -T RealignerTargetCreator \
  -I sample.dd.bam -o sample.realn.intervals
$ java -Xmx10g -jar $GATKHome/GenomeAnalysisTK.jar \
  -R genome.fasta -T IndelRealigner \
  -targetIntervals sample.realn.intervals \
  -I sample.dd.bam -o sample.realn.bam

6. 第1遍Variant calling

6.1 使用GATK和samtools进行SNP和INDEL calling

$ java -Xmx10g -jar $GATKHome/GenomeAnalysisTK.jar \
  -R genome.fasta -T UnifiedGenotyper \
  -I sample.realn.bam -o sample.gatk.raw1.vcf \
  --read_filter BadCigar -glm BOTH \
  -stand_call_conf 30.0 -stand_emit_conf 0
$ samtools mpileup -DSugf genome.fasta sample.realn.bam | \
  bcftools view -Ncvg - > sample.samtools.raw1.vcf

6.2 对Variant结果进行综合和过滤

$ java -Xmx10g -jar $GATKHome/GenomeAnalysisTK.jar \
  -R genome.fasta -T SelectVariants \
  --variant sample.gatk.raw1.vcf \
  --concordance sample.samtools.raw1.vcf \
  -o sample.concordance.raw1.vcf
$ MEANQUAL=`awk '{ if ($1 !~ /#/) { total += $6; count++ } } \
  END { print total/count }' sample.concordance.raw1.vcf`
$ java -Xmx10g -jar $GATKHome/GenomeAnalysisTK.jar \
  -R genome.fasta -T VariantFiltration \
  --filterExpression "QD < 20.0 || ReadPosRankSum < -8.0 || \
  FS > 10.0 || QUAL < $MEANQUAL" \
  --filterName LowQualFilter --variant sample.concordance.raw1.vcf \
  --missingValuesInExpressionsShouldEvaluateAsFailing
  --logging_level ERROR -o sample.concordance.flt1.vcf
$ grep -v "Filter" sample.concordance.flt1.vcf > \
  sample.concordance.filter1.vcf

7. 对第5步获得的realign的bam文件的进行校正

$ java -Xmx10g -jar $GATKHome/GenomeAnalysisTK.jar \
  -R genome.fasta -T BaseRecalibrator \
  -I sample.realn.bam -o sample.recal_data.grp \
  -knownSites sample.concordance.filter1.vcf
$ java -Xmx10g -jar $GATKHome/GenomeAnalysisTK.jar \
  -R genome.fasta -T PrintReads \
  -I sample.realn.bam -o sample.recal.bam \
  -BQSR sample.recal_data.grp

8. 第2遍Variant calling

$ java -Xmx10g -jar $GATKHome/GenomeAnalysisTK.jar \
  -R genome.fasta -T UnifiedGenotyper \
  -I sample.recal.bam -o sample.gatk.raw2.vcf \
  --read_filter BadCigar -glm BOTH \
  -stand_call_conf 30.0 -stand_emit_conf 0
$ samtools mpileup -DSugf genome.fasta sample.recal.bam | \
  bcftools view -Ncvg - > sample.samtools.raw2.vcf
$ java -Xmx10g -jar $GATKHome/GenomeAnalysisTK.jar \
  -R genome.fasta -T SelectVariants \
  --variant sample.gatk.raw2.vcf \
  --concordance sample.samtools.raw2.vcf \
  -o sample.concordance.raw2.vcf
$ java -Xmx10g -jar $GATKHome/GenomeAnalysisTK.jar \
  -R genome.fasta -T VariantFiltration \
  --filterExpression "QD < 10.0 || ReadPosRankSum < -8.0 || \
  FS > 10.0 || QUAL < 30" \
  --filterName LowQualFilter --variant sample.concordance.raw2.vcf \
  --missingValuesInExpressionsShouldEvaluateAsFailing
  --logging_level ERROR -o sample.concordance.flt2.vcf
$ grep -v "Filter" sample.concordance.flt2.vcf > \
  sample.concordance.filter2.vcf
$ cp sample.concordance.filter2.vcf sample.final.vcf

最后的结果文件为sample.final.vcf。关于具体的vcf的格式详解见:http://www.hzaumycology.com/chenlianfu_blog/?p=1514

GATK UnifiedGenotyper用于Variant calling

懒人先看:

* 标示的为最常用的参数。

$ java -Xmx20g -jar GenomeAnalysisTK.jar \  #使用GATK主程序
*    -R ref.fasta \  #参考序列
*    -T UnifiedGenotyper \  #使用GATK的该程序
*    -I sample1.bam [-I sample2.bam] [-I ...]\  #输入的bam比对结果
     --dbsnp dbSNP.vcf \  #使用该文件中的variants ID加入到结果文件中
     --genotyping_mode GENOTYPE_GIVEN_ALLELES --allels know.vcf \  #只对已知的variant进行基因分型
*    --genotype_likelihoods_model [SNP/INDEL/BOTH] \  #进行SNP、INDEl或者两者同时的calling
     --min_base_quality_score 17 \  #variant calling时碱基质量的最低要求。但是INDEL calling时,该值无效。而是去除reads的低质量3'端直到Q20。用下面的方法来鉴定
     --min_indel_count_for_genotyping 5 \  #至少有这么多的reads在某一位点表现出了indel
     --min_indel_fraction_per_sample 0.25 \  #至少有这么大比例的reads在某一点表现出了indel
*    --out gatk.cvf \  #输出到文件,否则为标准输出
*    --output_mode [EMIT_VARIANTS_ONLY/EMIT_ALL_CONFIDENT_SITES/EMIT_ALL_SITES] \  #输出模式,默认只输出variant位点
     --sample_ploidy 2 \  #样品的倍型
*    --standard_min_confidence_threshold_for_calling 30.0 \  #设定variant位点的置信阈值,低于该阈值则为low quality
*    --standard_min_confidence_threshold_for_emitting 30.0 \  #在vcf结果文件中,低于该值的位点则不进行报告

1. UnifiedGenotyper简介

UnifiedGenotyper是GATK(Genome Analysis ToolKit)中一个主要工具,用于Variant calling。在GATK网站上这样描述它:A variant caller which unifies the approaches of several disparate callers — Works for single-sample and multi-sample data.

UnifiedGenotyper能对单个或多个sample进行SNP和INDEL calling。使用Beyesian genotype likelihood model来对N个sample进行基因型的判断和等位基因频率的计算。

2. 命令的简单使用和输入要求

一个使用UnifiedGenotyper对多个samples进行SNP calling的例子如下:

$ java -jar GenomeAnalysisTK.jar \
    -R resources/Homo_sapiens_assembly18.fasta \
    -T UnifiedGenotyper \
    -I sample1.bam [-I sample2.bam] \
    --dbsnp dbSNP.vcf \
    -o snps.raw.vcf \
    -stand_call_conf [50.0] \
    -stand_emit_conf 10.0 \
    -dcov [50 for 4x, 200 for >30x WGS or Whole exome] \
    [-L targets.interval_list]

该上述命令中输入的文件有2个:参考序列的fasta文件 和 bam格式的比对结果文件。但是只有这两个文件是不行的,其实额外需要fasta文件的dict文件和fai文件,以及bam文件的bai文件。需要使用picard和samtools软件,命令行如下:

$ java -jar $picardHome/CreateSequenceDictionary.jar R=./resources/Homo_sapiens_assembly18.fasta O=./resources/Homo_sapiens_assembly18.dict
$ samtools faidx ./resources/Homo_sapiens_assembly18.fasta
$ samtools index sample1.bam

3. 附加信息

3.1 Read filters

在运行UnifiedGenotyper的时候,会对reads自动进行过滤,使用的相关命令有:
DuplicateReadFilter
FailsVendorQualityCheckFilter
NotPrimaryAlignmentFilter
MalformedReadFilter
BadMateFilter
MappingQualityUnavailableFilter
UnmappedReadFilter

3.2 并行化运算

该程序能进行多线程运算,使用如下参数即可:
NanoSchedulable (-nct)
CPU数。对每个data的运行能使用的CPU数。即对一个数据执行的一个命令进行计算所能用的CPU数。
TreeReducible (-nt)
线程数。将一个总的data分成多少份,然后分别对每个data使用单独的命令进行运算,最大值为24. 最后合并结果可能消耗额外的时间;消耗的内存也按倍数增加。

3.3 Downsampling 设置

This tool overrides the engine’s default downsampling settings.

Mode: BY_SAMPLE
To coverage: 250

3.4 Window size

This tool uses a sliding window on the reference.

Window start: -200 bp before the locus
Window stop: 200 bp after the locus

4. UnifiedGenotyper的参数

4.1 GATK参数

使用了GATK共有的参数:CommandLineGATK.

4.2 UnifiedGenotyper特有的参数

  • --alleles / -alleles RodBinding[VariantContext] default: none

The set of alleles at which to genotype when –genotyping_mode is GENOTYPE_GIVEN_ALLELES. When the UnifiedGenotyper is put into GENOTYPE_GIVEN_ALLELES mode it will genotype the samples using only the alleles provide in this rod binding –alleles binds reference ordered data. This argument supports ROD files of the following types: BCF2, VCF, VCF3

  • --annotateNDA / -nda default: false

If provided, we will annotate records with the number of alternate alleles that were discovered (but not necessarily genotyped) at a given site. Depending on the value of the –max_alternate_alleles argument, we may genotype only a fraction of the alleles being sent on for genotyping. Using this argument instructs the genotyper to annotate (in the INFO field) the number of alternate alleles that were originally discovered at the site.

  • --annotation / -A List[String] default: none

One or more specific annotations to apply to variant calls. Which annotations to add to the output VCF file. See the VariantAnnotator -list argument to view available annotations.

  • --comp / -comp List[RodBinding[VariantContext]] default: none

Comparison VCF file. If a call overlaps with a record from the provided comp track, the INFO field will be annotated as such in the output with the track name (e.g. -comp:FOO will have ‘FOO’ in the INFO field). Records that are filtered in the comp track will be ignored. Note that ‘dbSNP’ has been special-cased (see the –dbsnp argument). –comp binds reference ordered data. This argument supports ROD files of the following types: BCF2, VCF, VCF3

  • --computeSLOD / -slod boolean default: false

If provided, we will calculate the SLOD (SB annotation). Note that calculating the SLOD increases the runtime by an appreciable amount.

  • -contamination / --contamination_fraction_to_filter double default: 0.05

Fraction of contamination in sequencing data (for all samples) to aggressively remove. If this fraction is greater is than zero, the caller will aggressively attempt to remove contamination through biased down-sampling of reads. Basically, it will ignore the contamination fraction of reads for each alternate allele. So if the pileup contains N total bases, then we will try to remove (N * contamination fraction) bases for each alternate allele.

  • -contaminationFile / --contamination_fraction_per_sample_file File

Tab-separated File containing fraction of contamination in sequencing data (per sample) to aggressively remove. Format should be “” (Contamination is double) per line; No header.. This argument specifies a file with two columns “sample” and “contamination” specifying the contamination level for those samples. Samples that do not appear in this file will be processed with CONTAMINATION_FRACTION

  • --dbsnp / -D RodBinding[VariantContext] default: none

dbSNP file. rsIDs from this file are used to populate the ID column of the output. Also, the DB INFO flag will be set when appropriate. dbSNP is not used in any way for the calculations themselves. –dbsnp binds reference ordered data. This argument supports ROD files of the following types: BCF2, VCF, VCF3

  • --excludeAnnotation / -XA List[String] default: none

One or more specific annotations to exclude. Which annotations to exclude from output in the VCF file. Note that this argument has higher priority than the -A or -G arguments, so annotations will be excluded even if they are explicitly included with the other options.

  • --genotype_likelihoods_model / -glm Model default: SNP

Genotype likelihoods calculation model to employ — SNP is the default option, while INDEL is also available for calling indels and BOTH is available for calling both together.
The –genotype_likelihoods_model argument is an enumerated type (Model), which can have one of the following values:
SNP
INDEL
GENERALPLOIDYSNP
GENERALPLOIDYINDEL
BOTH

  • --genotyping_mode / -gt_mode GENOTYPING_MODE default: DISCOVERY

Specifies how to determine the alternate alleles to use for genotyping.
The –genotyping_mode argument is an enumerated type (GENOTYPING_MODE), which can have one of the following values:
DISCOVERY
the Unified Genotyper will choose the most likely alternate allele
GENOTYPE_GIVEN_ALLELES
only the alleles passed in from a VCF rod bound to the -alleles argument will be used for genotyping

  • --group / -G String[] default: [Standard]

One or more classes/groups of annotations to apply to variant calls. If specified, all available annotations in the group will be applied. See the VariantAnnotator -list argument to view available groups. Keep in mind that RODRequiringAnnotations are not intended to be used as a group, because they require specific ROD inputs.

  • --heterozygosity / -hets Double default: 0.0010

Heterozygosity value used to compute prior likelihoods for any locus. The expected heterozygosity value used to compute prior likelihoods for any locus. The default priors are: het = 1e-3, P(hom-ref genotype) = 1 – 3 * het / 2, P(het genotype) = het, P(hom-var genotype) = het / 2

  • --indel_heterozygosity / -indelHeterozygosity double default: 1.25E-4

Heterozygosity for indel calling. This argument informs the prior probability of having an indel at a site.

  • --indelGapContinuationPenalty / -indelGCP byte default: 10

Indel gap continuation penalty, as Phred-scaled probability. I.e., 30 => 10^-30/10.

  • --indelGapOpenPenalty / -indelGOP byte default: 45

Indel gap open penalty, as Phred-scaled probability. I.e., 30 => 10^-30/10.

  • --input_prior / -inputPrior List[Double] default: none

Input prior for calls. By default, the prior specified with the argument –heterozygosity/-hets is used for variant discovery at a particular locus, using an infinite sites model, see e.g. Waterson (1975) or Tajima (1996). This model asserts that the probability of having a population of k variant sites in N chromosomes is proportional to theta/k, for 1=1:N There are instances where using this prior might not be desireable, e.g. for population studies where prior might not be appropriate, as for example when the ancestral status of the reference allele is not known. By using this argument, user can manually specify priors to be used for calling as a vector for doubles, with the following restriciotns: a) User must specify 2N values, where N is the number of samples. b) Only diploid calls supported. c) Probability values are specified in double format, in linear space. d) No negative values allowed. e) Values will be added and Pr(AC=0) will be 1-sum, so that they sum up to one. f) If user-defined values add to more than one, an error will be produced. If user wants completely flat priors, then user should specify the same value (=1/(2*N+1)) 2*N times,e.g. -inputPrior 0.33 -inputPrior 0.33 for the single-sample diploid case.

  • --max_alternate_alleles / -maxAltAlleles int default: 6

Maximum number of alternate alleles to genotype. If there are more than this number of alternate alleles presented to the genotyper (either through discovery or GENOTYPE_GIVEN ALLELES), then only this many alleles will be used. Note that genotyping sites with many alternate alleles is both CPU and memory intensive and it scales exponentially based on the number of alternate alleles. Unless there is a good reason to change the default value, we highly recommend that you not play around with this parameter. As of GATK 2.2 the genotyper can handle a very large number of events, so the default maximum has been increased to 6.

  • --max_deletion_fraction / -deletions Double default: 0.05

Maximum fraction of reads with deletions spanning this locus for it to be callable [to disable, set to < 0 or > 1; default:0.05].

  • --min_base_quality_score / -mbq int default: 17

Minimum base quality required to consider a base for calling. The minimum confidence needed in a given base for it to be used in variant calling. Note that the base quality of a base is capped by the mapping quality so that bases on reads with low mapping quality may get filtered out depending on this value. Note too that this argument is ignored in indel calling. In indel calling, low-quality ends of reads are clipped off (with fixed threshold of Q20).

  • -minIndelCnt / --min_indel_count_for_genotyping int default: 5

Minimum number of consensus indels required to trigger genotyping run. A candidate indel is genotyped (and potentially called) if there are this number of reads with a consensus indel at a site. Decreasing this value will increase sensitivity but at the cost of larger calling time and a larger number of false positives.

  • -minIndelFrac / --min_indel_fraction_per_sample double default: 0.25

Minimum fraction of all reads at a locus that must contain an indel (of any allele) for that sample to contribute to the indel count for alleles. Complementary argument to minIndelCnt. Only samples with at least this fraction of indel-containing reads will contribute to counting and overcoming the threshold minIndelCnt. This parameter ensures that in deep data you don’t end up summing lots of super rare errors up to overcome the 5 read default threshold. Should work equally well for low-coverage and high-coverage samples, as low coverage samples with any indel containing reads should easily over come this threshold.

  • --out / -o VariantContextWriter default: stdout

File to which variants should be written. A raw, unfiltered, highly sensitive callset in VCF format.

  • --output_mode / -out_mode OUTPUT_MODE default: EMIT_VARIANTS_ONLY

Specifies which type of calls we should output.
The –output_mode argument is an enumerated type (OUTPUT_MODE), which can have one of the following values:
EMIT_VARIANTS_ONLY
produces calls only at variant sites
EMIT_ALL_CONFIDENT_SITES
produces calls at variant sites and confident reference sites
EMIT_ALL_SITES
produces calls at any callable site regardless of confidence; this argument is intended only for point mutations (SNPs) in DISCOVERY mode or generally when running in GENOTYPE_GIVEN_ALLELES mode; it will by no means produce a comprehensive set of indels in DISCOVERY mode

  • --pair_hmm_implementation / -pairHMM HMM_IMPLEMENTATION default: ORIGINAL

The PairHMM implementation to use for -glm INDEL genotype likelihood calculations. The PairHMM implementation to use for -glm INDEL genotype likelihood calculations. The various implementations balance a tradeoff of accuracy and runtime.
The –pair_hmm_implementation argument is an enumerated type (HMM_IMPLEMENTATION), which can have one of the following values:
EXACT
ORIGINAL
LOGLESS_CACHING

  • --pcr_error_rate / -pcr_error Double default: 1.0E-4

The PCR error rate to be used for computing fragment-based likelihoods. The PCR error rate is independent of the sequencing error rate, which is necessary because we cannot necessarily distinguish between PCR errors vs. sequencing errors. The practical implication for this value is that it effectively acts as a cap on the base qualities.

  • --sample_ploidy / -ploidy int default: 2

Plody (number of chromosomes) per sample. For pooled data, set to (Number of samples in each pool * Sample Ploidy)..

  • -stand_call_conf / --standard_min_confidence_threshold_for_calling double default: 30.0

The minimum phred-scaled confidence threshold at which variants should be called. The minimum phred-scaled Qscore threshold to separate high confidence from low confidence calls. Only genotypes with confidence >= this threshold are emitted as called sites. A reasonable threshold is 30 for high-pass calling (this is the default).

  • -stand_emit_conf / --standard_min_confidence_threshold_for_emitting double default: 30.0

The minimum phred-scaled confidence threshold at which variants should be emitted (and filtered with LowQual if less than the calling threshold). This argument allows you to emit low quality calls as filtered records.

VCF格式详解

VCF格式:Vriant Call Format.关于其详细描述,请见GATK的FAQ:How should I interpret VCF files produced by the GATK?

1. 什么是VCF?

CVF是用于描述SNP,INDEL和SV结果的文本文件。在GATK软件中得到最好的支持,当然SAMtools得到的结果也是CVF格式,和GATK的CVF格式有点差别。

2. VCF的主体结构

先给出一个VCF文件的范例:

##fileformat=VCFv4.0
##FILTER=<ID=LowQual,Description="QUAL < 50.0">
##FORMAT=<ID=AD,Number=.,Type=Integer,Description="Allelic depths for the ref and alt alleles in the order listed">
##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth (only filtered reads used for calling)">
##FORMAT=<ID=GQ,Number=1,Type=Float,Description="Genotype Quality">
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
##FORMAT=<ID=PL,Number=3,Type=Float,Description="Normalized, Phred-scaled likelihoods for AA,AB,BB genotypes where A=ref and B=alt; not applicable if site is not biallelic">
##INFO=<ID=AC,Number=.,Type=Integer,Description="Allele count in genotypes, for each ALT allele, in the same order as listed">
##INFO=<ID=AF,Number=.,Type=Float,Description="Allele Frequency, for each ALT allele, in the same order as listed">
##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
##INFO=<ID=DB,Number=0,Type=Flag,Description="dbSNP Membership">
##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
##INFO=<ID=DS,Number=0,Type=Flag,Description="Were any of the samples downsampled?">
##INFO=<ID=Dels,Number=1,Type=Float,Description="Fraction of Reads Containing Spanning Deletions">
##INFO=<ID=HRun,Number=1,Type=Integer,Description="Largest Contiguous Homopolymer Run of Variant Allele In Either Direction">
##INFO=<ID=HaplotypeScore,Number=1,Type=Float,Description="Consistency of the site with two (and only two) segregating haplotypes">
##INFO=<ID=MQ,Number=1,Type=Float,Description="RMS Mapping Quality">
##INFO=<ID=MQ0,Number=1,Type=Integer,Description="Total Mapping Quality Zero Reads">
##INFO=<ID=QD,Number=1,Type=Float,Description="Variant Confidence/Quality by Depth">
##INFO=<ID=SB,Number=1,Type=Float,Description="Strand Bias">
##INFO=<ID=VQSLOD,Number=1,Type=Float,Description="log10-scaled probability of variant being true under the trained gaussian mixture model">
##UnifiedGenotyperV2="analysis_type=UnifiedGenotyperV2 input_file=[TEXT CLIPPED FOR CLARITY]"
#CHROM  POS ID      REF ALT QUAL    FILTER  INFO    FORMAT  NA12878
chr1    873762  .       T   G   5231.78 PASS    AC=1;AF=0.50;AN=2;DP=315;Dels=0.00;HRun=2;HaplotypeScore=15.11;MQ=91.05;MQ0=15;QD=16.61;SB=-1533.02;VQSLOD=-1.5473 GT:AD:DP:GQ:PL   0/1:173,141:282:99:255,0,255
chr1    877664  rs3828047   A   G   3931.66 PASS    AC=2;AF=1.00;AN=2;DB;DP=105;Dels=0.00;HRun=1;HaplotypeScore=1.59;MQ=92.52;MQ0=4;QD=37.44;SB=-1152.13;VQSLOD= 0.1185 GT:AD:DP:GQ:PL  1/1:0,105:94:99:255,255,0
chr1    899282  rs28548431  C   T   71.77   PASS    AC=1;AF=0.50;AN=2;DB;DP=4;Dels=0.00;HRun=0;HaplotypeScore=0.00;MQ=99.00;MQ0=0;QD=17.94;SB=-46.55;VQSLOD=-1.9148 GT:AD:DP:GQ:PL  0/1:1,3:4:25.92:103,0,26
chr1    974165  rs9442391   T   C   29.84   LowQual AC=1;AF=0.50;AN=2;DB;DP=18;Dels=0.00;HRun=1;HaplotypeScore=0.16;MQ=95.26;MQ0=0;QD=1.66;SB=-0.98 GT:AD:DP:GQ:PL  0/1:14,4:14:60.91:61,0,255

从范例上看,VCF文件分为两部分内容:以“#”开头的注释部分;没有“#”开头的主体部分。

值得注意的是,注释部分有很多对VCF的介绍信息。实际上不需要本文章,只是看看这个注释部分就完全明白了VCF各行各列代表的意义。我们先讲VCF文件主题部分的结构,如下所示:

[HEADER LINES]
#CHROM  POS ID      REF ALT QUAL    FILTER  INFO          FORMAT          NA12878
chr1    873762  .       T   G   5231.78 PASS    [ANNOTATIONS] GT:AD:DP:GQ:PL  0/1:173,141:282:99:255,0,255
chr1    877664  rs3828047   A   G   3931.66 PASS    [ANNOTATIONS] GT:AD:DP:GQ:PL  1/1:0,105:94:99:255,255,0
chr1    899282  rs28548431  C   T   71.77   PASS    [ANNOTATIONS] GT:AD:DP:GQ:PL  0/1:1,3:4:25.92:103,0,26
chr1    974165  rs9442391   T   C   29.84   LowQual [ANNOTATIONS] GT:AD:DP:GQ:PL  0/1:14,4:14:60.91:61,0,255

以上去掉了头部的注释行,只留下了代表每一行意义的注释行。主体部分中每一行代表一个Variant的信息。

3. 怎么解释Variation

CHROM 和 POS:代表参考序列名和variant的位置;如果是INDEL的话,位置是INDEL的第一个碱基位置。

ID:variant的ID。比如在dbSNP中有该SNP的id,则会在此行给出;若没有,则用’.’表示其为一个novel variant。

REF 和 ALT:参考序列的碱基 和 Variant的碱基。

QUAL:Phred格式(Phred_scaled)的质量值,表示在该位点存在variant的可能性;该值越高,则variant的可能性越大;计算方法:Phred值 = -10 * log (1-p) p为variant存在的概率; 通过计算公式可以看出值为10的表示错误概率为0.1,该位点为variant的概率为90%。

FILTER:使用上一个QUAL值来进行过滤的话,是不够的。GATK能使用其它的方法来进行过滤,过滤结果中通过则该值为”PASS”;若variant不可靠,则该项不为”PASS”或”.”。

INFO: 这一行是variant的详细信息,内容很多,以下再具体详述。

FORMAT 和 NA12878:这两行合起来提供了’NA12878’这个sample的基因型的信息。’NA12878’代表这该名称的样品,是由BAM文件中的@RG下的 SM 标签决定的。

4. 基因型信息

chr1    873762  .       T   G   [CLIPPED] GT:AD:DP:GQ:PL    0/1:173,141:282:99:255,0,255
chr1    877664  rs3828047   A   G   [CLIPPED] GT:AD:DP:GQ:PL    1/1:0,105:94:99:255,255,0
chr1    899282  rs28548431  C   T   [CLIPPED] GT:AD:DP:GQ:PL    0/1:1,3:4:25.92:103,0,26

看上面最后两列数据,这两列数据是对应的,前者为格式,后者为格式对应的数据。

GT:样品的基因型(genotype)。两个数字中间用’/’分开,这两个数字表示双倍体的sample的基因型。0 表示样品中有ref的allele; 1 表示样品中variant的allele; 2表示有第二个variant的allele。因此: 0/0 表示sample中该位点为纯合的,和ref一致; 0/1 表示sample中该位点为杂合的,有ref和variant两个基因型; 1/1 表示sample中该位点为纯合的,和variant一致。

AD 和 DP:AD(Allele Depth)为sample中每一种allele的reads覆盖度,在diploid中则是用逗号分割的两个值,前者对应ref基因型,后者对应variant基因型; DP(Depth)为sample中该位点的覆盖度。

GQ:基因型的质量值(Genotype Quality)。Phred格式(Phred_scaled)的质量值,表示在该位点该基因型存在的可能性;该值越高,则Genotype的可能性越大;计算方法:Phred值 = -10 * log (1-p) p为基因型存在的概率。

PL:指定的三种基因型的质量值(provieds the likelihoods of the given genotypes)。这三种指定的基因型为(0/0,0/1,1/1),这三种基因型的概率总和为1。和之前不一致,该值越大,表明为该种基因型的可能性越小。 Phred值 = -10 * log (p) p为基因型存在的概率。

5. VCF第8列的信息

该列信息最多了,都是以 “TAG=Value”,并使用”;”分隔的形式。其中很多的注释信息在VCF文件的头部注释中给出。以下是这些TAG的解释

AC,AF 和 AN:AC(Allele Count) 表示该Allele的数目;AF(Allele Frequency) 表示Allele的频率; AN(Allele Number) 表示Allele的总数目。对于1个diploid sample而言:则基因型 0/1 表示sample为杂合子,Allele数为1(双倍体的sample在该位点只有1个等位基因发生了突变),Allele的频率为0.5(双倍体的sample在该位点只有50%的等位基因发生了突变),总的Allele为2; 基因型 1/1 则表示sample为纯合的,Allele数为2,Allele的频率为1,总的Allele为2。

DP:reads覆盖度。是一些reads被过滤掉后的覆盖度。

Dels:Fraction of Reads Containing Spanning Deletions。进行SNP和INDEL calling的结果中,有该TAG并且值为0表示该位点为SNP,没有则为INDEL。

FS:使用Fisher’s精确检验来检测strand bias而得到的Fhred格式的p值。该值越小越好。一般进行filter的时候,可以设置 FS < 10~20。

HaplotypeScore:Consistency of the site with at most two segregating haplotypes

InbreedingCoeff:Inbreeding coefficient as estimated from the genotype likelihoods per-sample when compared against the Hard-Weinberg expectation

MLEAC:Maximum likelihood expectation (MLE) for the allele counts (not necessarily the same as the AC), for each ALT allele, in the same order as listed

MLEAF:Maximum likelihood expectation (MLE) for the allele frequency (not necessarily the same as the AF), for each ALT alle in the same order as listed

MQ:RMS Mapping Quality

MQ0:Total Mapping Quality Zero Reads

MQRankSum:Z-score From Wilcoxon rank sum test of Alt vs. Ref read mapping qualities

QD:Variant Confidence/Quality by Depth

RPA:Number of times tandem repeat unit is repeated, for each allele (including reference)

RU:Tandem repeat unit (bases)

ReadPosRankSum:Z-score from Wilcoxon rank sum test of Alt vs. Ref read position bias

STR:Variant is a short tandem repeat