RNA Seq Read Representation by Trinity Assembly

bhaasIMM edited this page Feb 14, 2017 · 9 revisions
Clone this wiki locally

Assessing the Read Content of the Transcriptome Assembly

Assembled transcripts might not always fully represent properly paired-end reads, as some transcripts may be fragmented or short and only one fragment read of a pair may align. Simply aligning reads to your transcriptome assembly using bowtie or STAR will only capture the properly paired reads. To assess the read composition of our assembly, we want to capture and count all reads that map to our assembled transcripts, including the properly paired and those that are not.

In order to comprehensively capture read alignments, we run the process below. Bowtie2 is used to align the reads to the transcriptome and then we count the number of proper pairs and improper or orphan read alignments.

First, build a bowtie2 index for the transcriptome:

bowtie2-build Trinity.fasta Trinity.fasta

Then perform the alignment (example for paired-end reads):

bowtie2 --local --no-unal -x Trinity.fasta -q -1 left_reads.fq -2 right_reads.fq \
     | samtools view -Sb - | samtools sort -no - - > bowtie2.nameSorted.bam

To get alignment statistics, run the following on the name-sorted bam file:

   $TRINITY_HOME/util/SAM_nameSorted_to_uniq_count_stats.pl bowtie2.nameSorted.bam

#read_type  count   pct
proper_pairs    23383   79.62
improper_pairs  3676    12.52  (left and right reads align, but to different contigs due to fragmentation)
left_only   1199    4.08
right_only  1112    3.79

Total aligned rnaseq fragments: 29370

A typical Trinity transcriptome assembly will have the vast majority of all reads mapping back to the assembly, and ~70-80% of the mapped fragments found mapped as proper pairs.

Visualize read support using IGV

The Integrative Genomics Viewer is useful for visualizing read support across any of the Trinity assemblies. The bowtie2 alignments generated above, which are currently sorted by read name, can be re-sorted according to coordinate, indexed, and then viewed along with the Trinity assemblies using the IGV browser as follows.

# sort the alignments by coordinate
samtools sort bowtie2.nameSorted.bam -o bowtie2.coordSorted.bam

# index the coordinate-sorted bam file
samtools index bowtie2.coordSorted.bam

# index the Trinity.fasta file
samtools faidx Trinity.fasta

# view the aligned reads along the Trinity assembly reference contigs.
# note, you can do this by using the various graphical menu options in IGV (load genome 'Trinity.fasta', load file 'bowtie2.coordSorted.bam'), or you can use the command-line tool like so:

igv.sh -g `pwd`/Trinity.fasta  `pwd`/bowtie2.coordSorted.bam

Note, the above assumes that the Trinity.fasta and bowtie2.coordSorted.bam files are in your current working directory.

And you can then go to any Trinity assembly of interest and examine the read (and paired-end) support. An example region of a long Trinity transcript contig is shown below.