PRAM: Pooling RNA-seq and Assembling Models

Peng Liu, Colin N. Dewey, and Sündüz Keleş

2022-11-01

Introduction

Pooling RNA-seq and Assembling Models (PRAM) is an R package that utilizes multiple RNA-seq datasets to predict transcript models. The workflow of PRAM contains four steps. Figure 1 shows each step with function name and associated key parameters. In addition, we provide a function named evalModel() to evaluate prediction accuracy by comparing transcript models with true transcripts. In the later sections of this vignette, we will describe each function in details.

PRAM workflow

PRAM workflow

Installation

From GitHub

Start R and enter:

From Bioconductor

Start R and enter:

For different versions of R, please refer to the appropriate Bioconductor release.

Quick start

Description

PRAM provides a function named runPRAM() to let you conveniently run through the whole workflow.

For a given gene annotation and RNA-seq alignments, you can predict transcript models in intergenic genomic regions:

Examples

PRAM has included input examples files in its extdata/demo/ folder. The table below provides a quick summary of all the example files.

runPRAM()’s input example files.
input argument file name(s)
in_gtf in.gtf
in_bamv SZP.bam, TLC.bam

You can access example files by system.file() in R, e.g. for the argument in_gtf, you can access its example file by

Below shows the usage of runPRAM() with example input files:

Define intergenic genomic ranges: defIgRanges()

Description

To predict intergenic transcripts, we must first define intergenic regions by defIgRanges(). This function requires a GTF file containing known gene annotation supplied for its in_gtf argument. This GTF file should contain an attribue of gene_id in its ninth column. We provided an example input GTF file in PRAM package: extdata/gtf/defIGRanges_in.gtf.

In addition to gene annotation, defIgRanges() also requires user to provide chromosome sizes so that it would know the maximum genomic ranges. You can provide one of the following arguments:

By default, defIgRanges() will define intergenic ranges as regions 10 kb away from any known genes. You can change it by the radius argument.

Example

Prepare input RNA-seq alignments: prepIgBam()

Description

Once intergenic regions were defined, prepIgBam() will extract corresponding RNA-seq alignments from input BAM files. In this way, transcript models predicted at later stage will solely from intergenic regions. Also, with fewer RNA-seq alignments, model prediction will run faster.

Three input arguments are required by prepIgBam():

Example

Build transcript models: buildModel()

Description

buildModel() predict transcript models from RNA-seq BAM file(s). This function requires two arguments:

Transcript prediction methods

buildModel() has implemented seven transcript prediction methods. You can specify it by the method argument with one of the keywords: plcf, plst, cfmg, cftc, stmg, cf, and st. The first five denote meta-assembly methods that utilize multiple RNA-seq datasets to predict a single set of transcript models. The last two represent methods that predict transcript models from a single RNA-seq dataset.

The table below compares prediction steps for these seven methods. By default, buildModel() uses plcf to predict transcript models.

(#tab:methods)Prediction steps of the seven buildModel() methods
method meta-assembly preparing RNA-seq input building transcripts
assembling transcripts
plcf yes pooling alignments Cufflinks no
plst yes pooling alignments StringTie no
cfmg yes no Cufflinks Cuffmerge
cftc yes no Cufflinks TACO
stmg yes no StringTie StringTie-merge
cf no no Cufflinks no
st no no StringTie no

Required external software

Depending on your specified prediction method, buildModel() requires external software: Cufflinks, StringTie and/or TACO, to build and/or assemble transcript models. You can either specify the software location using the cufflinks, stringtie, and taco arguments in buildModel(), or simply leave these three arugments undefined and let PRAM download them for you automatically. The table below summarized software versions buildModel() would download when required software was not specified. Please note that, for macOS, pre-compiled Cufflinks binary versions 2.2.1 and 2.2.0 appear to have an issue on processing BAM files, therefore we recommend to use version 2.1.1 instead.

(#tab:software)buildModel()-required software and recommended version
software Linux binary macOS binary required by
Cufflinks, Cuffmerge v2.2.1 v2.1.1 plcf, cfmg, cftc, and cf
StringTie, StringTie-merge v1.3.3b v1.3.3b plst, stmg, and st
TACO v0.7.0 v0.7.0 cftc

Example

Select transcript models: selModel()

Description

Once transcript models were built, you may want to select a subset of them by their genomic features. selModel() was developed for this purpose. It allows you to select transcript models by their total number of exons and total length of exons and introns.

selModel() requires two arguments:

By default: selModel() will select transcript models with \(\ge\) 2 exons and \(\ge\) 200 bp total length of exons and introns. You can change the default using the min_n_exon and min_tr_len arguments.

Example

Evaluate transcript models: evalModel()

Motivation

After PRAM has predicted a number of transcript models, you may wonder how accurate these models are. To answer this question, you can compare PRAM models with real transcripts (i.e., positive controls) that you know should be predicted. PRAM’s evalModel() function will help you to make such comparison. It will calculate precision and recall rates on three features of a transcript: exon nucleotides, individual splice junctions, and transcript structure (i.e., whether all splice junctions within a transcript were constructed in a model).

Input

evalModel() requires two arguments:

The two arguments can be in multiple formats:

Output

The output of evalModel() is a data.table object, where columns are evaluation results and each row is three transcript features.

evalModel() output columns
column name representation
feat transcript feature
ntp number of true positives (TP)
nfn number of false negatives (FN)
nfp number of false positives (FP)
precision precision rate: \(\frac{TP}{(TP+FP)}\)
recall recall rate: \(\frac{TP}{(TP+FN)}\)
evalModel() output rows
feature name representation
exon_nuc exon nucleotide
indi_jnc individual splice junction
tr_jnc transcript structure

Example

Session Info

Below is the output of sessionInfo() on the system on which this document was compiled.

#> R version 4.2.1 (2022-06-23)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 20.04.5 LTS
#> 
#> Matrix products: default
#> BLAS:   /home/biocbuild/bbs-3.16-bioc/R/lib/libRblas.so
#> LAPACK: /home/biocbuild/bbs-3.16-bioc/R/lib/libRlapack.so
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_GB              LC_COLLATE=C              
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] restfulr_0.0.15             bslib_0.4.0                
#>  [3] compiler_4.2.1              jquerylib_0.1.4            
#>  [5] GenomeInfoDb_1.34.0         highr_0.9                  
#>  [7] XVector_0.38.0              MatrixGenerics_1.10.0      
#>  [9] bitops_1.0-7                tools_4.2.1                
#> [11] zlibbioc_1.44.0             digest_0.6.30              
#> [13] lattice_0.20-45             jsonlite_1.8.3             
#> [15] evaluate_0.17               rlang_1.0.6                
#> [17] Matrix_1.5-1                DelayedArray_0.24.0        
#> [19] cli_3.4.1                   yaml_2.3.6                 
#> [21] parallel_4.2.1              xfun_0.34                  
#> [23] fastmap_1.1.0               GenomeInfoDbData_1.2.9     
#> [25] rtracklayer_1.58.0          stringr_1.4.1              
#> [27] knitr_1.40                  Biostrings_2.66.0          
#> [29] sass_0.4.2                  S4Vectors_0.36.0           
#> [31] IRanges_2.32.0              grid_4.2.1                 
#> [33] stats4_4.2.1                Biobase_2.58.0             
#> [35] data.table_1.14.4           R6_2.5.1                   
#> [37] XML_3.99-0.12               BiocParallel_1.32.0        
#> [39] rmarkdown_2.17              magrittr_2.0.3             
#> [41] Rsamtools_2.14.0            matrixStats_0.62.0         
#> [43] codetools_0.2-18            htmltools_0.5.3            
#> [45] BiocGenerics_0.44.0         GenomicAlignments_1.34.0   
#> [47] GenomicRanges_1.50.0        SummarizedExperiment_1.28.0
#> [49] stringi_1.7.8               RCurl_1.98-1.9             
#> [51] pram_1.14.0                 cachem_1.0.6               
#> [53] rjson_0.2.21                crayon_1.5.2               
#> [55] BiocIO_1.8.0