Trinity的安装与使用

评论10,884

一、 Trinity简介

Trinity,是由 the Broad Institute 开发的转录组de novo组装软件,由三个独立的软件模块组成:

Inchworm,Chrysalis和Butterfly。三个软件依次来处理大规模的RNA-seq的reads数据。

Trinity的简要工作流程为:

Inchworm: 将RNA-seq的原始reads数据组装成Unique序列;

Chrysalis: 将上一步生成的contigs聚类,然后对每个类构建Bruijn图;

Butterfly: 处理这些Bruijn图,依据图中reads和成对的reads来寻找路径,从而得到具有可变剪接的全长转录子,同时将旁系同源基因的转录子分开。

Trinity发表在 Nature Biotechnology

二、 Trinity的安装

1. 下载Trinity

2. 安装Trinity。

[shell]
$ tar zxvf trinityrnaseq_r2013-02-25.tgz
$ cd trinityrnaseq_r2013-02-25
$ make
[/shell]

仅需要在安装目录下进行make即可。该命令编译了由C++编写的Inchworm和Chrysalis,而 使用Java编写的Butterfly则不需要编译,可以直接使用。

三、Trinity的使用

1. 直接运行安装目录下的程序Trinity.pl来使用该软件,不带参数则给出使用帮助。其典型用法为:

Trinity.pl --seqType fq --JM 50G --left reads_1.fq  --right reads_2.fq --CPU 6

2. Trinity参数

必须的参数:
--seqType     reads的类型:(cfa, cfq, fa, or fq)
--JM          jellyfish使用多少G内存用来进行k-mer的计算,包含‘G’这个字符
--left        左边的reads的文件名
--rigth       右边的reads的文件名
--single      不成对的reads的文件名

可选参数:

Misc:
--SS_lib_type        reads的方向。成对的reads: RF or FR; 不成对的reads: F or R。在数据具有链特异性的时候,设置此参数,则正义和反义转录子能得到区分。默认情况下,不设置此参数,reads被当作非链特异性处理。FR: 匹配时,read1在5'端上游, 和前导链一致, read2在3'下游, 和前导链反向互补. 或者read2在上游, read1在下游反向互补; RF: read1在5'端上游, 和前导链反向互补, read2在3'端下游, 和前导链一致;
--output             输出结果文件夹。默认情况下生成trinity_out_dir文件夹并将输出结果保存到此文件夹中。
--CPU                使用的CPU线程数,默认为2
--min_contig_length  报告出的最短的contig长度。默认为200
--jaccard_clip       如果两个转录子之间有UTR区重叠,则这两个转录子很有可能在de novo组装的时候被拼接成一条序列,称为融合转录子(Fusion Transcript)。如果有fastq格式的paired reads,并尽可能减少此类组装错误,则选用此参数。值得说明的是:1. 适合于基因在基因组比较稠密,转录子经常在UTR区域重叠的物种,比如真菌基因组。而对于脊椎动物和植物,则不推荐使用此参数; 2. 要求fastq格式的paired reads文件(文件中reads名分别以/1和/2结尾,以利于软件识别),同时还需要安装bowtie软件用于reads的比对; 3. 单独使用具有链特异性的RNA-seq数据的时候,能极大地减少UTR重叠区很小的融合转录子; 4. 此选项耗费运算,若没必要,则不用此参数。
--prep               仅仅准备一些文件(利于I/O)并在kmer计算前停止程序运行
--no_cleanup         保留所有的中间输入文件
--full_cleanup       仅保留Trinity fasta文件,并重命名成${output_dir}.Trinity.fasta
--cite               显示Trinity文献引证和一些参与的软件工具
--version            报告Trinity版本并推出

Inchworm 和 K-mer 计算相关选项:
--min_kmer_cov      使用Inchworm来计算K-mer数量时候,设置的Kmer的最小值。默认为1
--inchworm_cpu      Inchworm使用的CPU线程数,默认为6和--CPU设置的值中的小值。

Chrysalis相关选项:
--max_reads_per_graph   在一个Bruijn图中锚定的最大的reads数目,默认为200000
--no_run_chrysalis      运行Inchworm完毕,在运行chrysalis之前停止运行Trinity
--no_run_quantifygraph  在平行化运算quantifygrahp前停止运行Trinity

Butterfly相关选项:
--bfly_opts                    Butterfly额外的参数
--max_number_of_paths_per_node 从node A -> B,最多允许多少条路径。默认为10
--group_pairs_distance         最大插入片读长度,默认为500
--path_reinforcement_distance  延长转录子路径时候,reads间最小的重叠碱基数。默认PE:75; SE:25
--no_triplet_lock              不锁定triplet-supported nodes
--bflyHeapSpaceMax             运行Butterfly时java最大的堆积空间,默认为20G
--bflyHeapSpaceInit            java初始的堆积空间,默认为1G
--bflyGCThreads                java进行无用信息的整理时使用的线程数,默认由java来决定
--bflyCPU                      运行Butterfly时使用的CPU线程数,默认为2
--bflyCalculateCPU             计算Butterfly所运行的CPU线程数,由公式80% * max_memory / maxbflyHeapSpaceMax 得到
--no_run_butterfly             在Chrysalis运行完毕后,停止运行Butterfly

Grid-computing选项:
--grid_computing_module   选定Perl模块,在/Users/bhaas/SVN/trinityrnaseq/trunk/PerlLibAdaptors/。

3. 适合于illumina测序数据的真菌物种转录组组装的Trinity命令为:

Trinity.pl --seqType fq --JM 50G --left reads_1.fq  --right reads_2.fq --SS_lib_type FR --output transcriptome_tissue --CPU 24 --jaccard_clip --inchworm_cpu 24 --group_pairs_distance 500 --bflyCPU 24

4. Trinity生成的结果文件
运行程序结束后,转录组结果为trinity_out_dir/Trinity.fasta。可以使用软件所带的一支程序分析转录组统计信息。

$ $TRINITY_HOME/util/TrinityStats.pl trinity_out_dir/Trinity.fasta
Total trinity transcripts:	30706
Total trinity components:	26628
Contig N50: 554

三. Trinity运行原理与过程

1. 检测java的可运行性,因为buttfly会用到

2. 运行jellyfish,使用其dump命令得到jellyfish.kmers.fa文件

3. Inchworm(Linear contig construction from k-mers)

assembles the RNA-seq data into the unique sequences of transcripts, often generating full-length transcripts for a dominant isoform, but then reports just the unique portions of alternatively spliced transcripts.

4. Chrysalis

clusters the Inchworm contigs into clusters and constructs complete de Bruijn graphs for each cluster. Each cluster represents the full transcriptonal complexity for a given gene (or sets of genes that share sequences in common). Chrysalis then partitions the full read set among these disjoint graphs.

5. Butterfly

then processes the individual graphs in parallel, tracing the paths that reads and pairs of reads take within the graph, ultimately reporting full-length transcripts for alternatively spliced isoforms, and teasing apart transcripts that corresponds to paralogous genes.

四. 注意事项

3.1 Trinity分步运行

当数据量比较大的时候,trinity运行的时间会很长,同时,内存不够等情况出现的时候有可能程序运行崩溃。最好是分步运行。下一步会接着前一步进行下去。

Stage 1: generate the kmer-catalog and run Inchworm: –no_run_chrysalis

Stage 2: Chrysalis clustering of inchworm contigs and mapping reads: –no_run_quantifygraph

Stage 3: Chrysalis deBruijn graph construction: –no_run_butterfly

Stage 4: Run butterfly, generate final Trinity.fasta file. (exclude –no_ options)

3.2 计算资源

Ideally, you will have access to a large-memory server, ideally having ~1G of RAM per 1M reads to be assembled (but often, much less memory may be required).

The assembly from start to finish can take anywhere from ~1/2 hour to 1 hour per million reads (your mileage may vary). 个人记录了一次,使用dell服务器,64GB RAM,24 threads : 53M 的reads,运行了16.5h(平均3.2M/h),内存使用峰值为43G.

原文来自:http://www.hzaumycology.com/chenlianfu_blog/?p=688

发表评论

匿名网友