VaSP: Quantification and Visualization of Variations of Splicing in Population

Huihui Yu, Qian Du and Chi Zhang

2021-05-19

1. Introduction

VaSP is an R package for discovery of genome-wide variable alternative splicing events from short-read RNA-seq data and visualizations of gene splicing information for publication-quality multi-panel figures.

Figure 1. Overview of VaSP. (A). The workflow and functions of VaSP. The input is an R data object ballgown (see ?ballgown) produced by a standard RNA-seq data analysis protocol, including mapping with HISAT, assembling with StringTie, and collecting expression information with R package Ballgown. VaSP calculates the Single Splicing Strength (3S) scores for all splicing junctions in the genome (?spliceGenome) or in a particular gene (?spliceGene), identifies genotype-specific splicing (GSS) events (?BMfinder), and displays differential splicing information (?splicePlot). The 3S scores can be also used for other analyses, such as differential splicing analysis or splicing QTL identification. (B). VaSP estimates 3S scores based on junction-read counts normalized by gene-level read coverage. In this example, VaSP calculates the splicing scores of four introns in a gene X with two transcript isoforms. Only the fourth intron is a full usage intron excised by both the two isoforms and the other three are alternative donor site (AltD) sites or Intron Retention (IntronR), respectively. (C). Visualization of splicing information in gene MSTRG.183 (LOC_Os01g03070), whole gene without splicing scores. (D). Visualization of differential splicing region of the gene MSTRG.183 with splicing score displaying. In C and D, the y-axes are read depths and the arcs (lines between exons) indicate exon-exon junctions (introns). The dotted arcs indicate no junction-reads spanning the intron (3S = 0) and solid arcs indicate 3S > 0. The transcripts labeled beginning with ‘LOC_Os’ indicate annotated transcripts by reference genome annotation and the ones beginning with “MSTRG” are transcripts assembled by StringTie. (Yu et al., 2021)

2. Citation

Yu, H., Du, Q., Campbell, M., Yu, B., Walia, H. and Zhang, C. (2021), Genome‐wide discovery of natural variation in pre‐mRNA splicing and prioritising causal alternative splicing to salt stress response in rice. New Phytol. https://doi.org/10.1111/nph.17189

3. Installation

Start R (>= 4.0) and run:

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
BiocManager::install("VaSP")
vignette('VaSP')

If you use an older version of R (>= 3.5), enter:

BiocManager::install("yuhuihui2011/VaSP", build_vignettes=TRUE)
vignette('VaSP')

4. Data input

Users need to follow the manual of R package Ballgown (https://github.com/alyssafrazee/ballgown) to create a ballgown object as an input for the VaSP package. See ?ballgown for detailed information on creating Ballgown objects. The object can be stored in a .RDate file by save() . Here is an example of constructing rice.bg object from HISAT2+StringTie output

library(VaSP)
?ballgown
path<-system.file('extdata', package='VaSP')
rice.bg<-ballgown(samples = list.dirs(path = path,recursive = F) )

5. Quick start

Calculate 3S (Single Splicing Strength) scores, find GSS (genotype-specific splicing) events and display the splicing information.

library(VaSP)
#> Loading required package: ballgown
#> 
#> Attaching package: 'ballgown'
#> The following object is masked from 'package:base':
#> 
#>     structure
data(rice.bg)
?rice.bg
rice.bg
#> ballgown instance with 33 transcripts and 6 samples
score<-spliceGene(rice.bg, gene="MSTRG.183", junc.type = "score")
tail(round(score,2),2)
#>    Sample_027 Sample_042 Sample_102 Sample_137 Sample_237 Sample_272
#> 58          0       0.02       0.22       0.23       0.23       0.23
#> 59          0       0.00       0.00       0.12       0.12       0.12
gss <- BMfinder(score, cores = 1) 
#> Warning in BMfinder(score, cores = 1): sample size < 30, the result should be
#> further tested!
#> ---BMfinder: 16 features * 6 samples
#> ---Completed:  a total of 4 bimodal distrubition features found!
gss
#>    Sample_027 Sample_042 Sample_102 Sample_137 Sample_237 Sample_272
#> 55          2          2          1          1          1          1
#> 57          1          1          2          2          2          2
#> 58          1          1          2          2          2          2
#> 59          1          1          1          2          2          2
gss_intron<-structure(rice.bg)$intron
(gss_intron<-gss_intron[gss_intron$id%in%rownames(gss)])
#> GRanges object with 4 ranges and 2 metadata columns:
#>       seqnames          ranges strand |        id transcripts
#>          <Rle>       <IRanges>  <Rle> | <integer> <character>
#>   [1]     Chr1 1179011-1179226      - |        55       15:16
#>   [2]     Chr1 1179011-1179134      - |        57          17
#>   [3]     Chr1 1179011-1179110      - |        58          18
#>   [4]     Chr1 1179011-1179106      - |        59          19
#>   -------
#>   seqinfo: 1 sequence from an unspecified genome; no seqlengths
range(gss_intron)
#> GRanges object with 1 range and 0 metadata columns:
#>       seqnames          ranges strand
#>          <Rle>       <IRanges>  <Rle>
#>   [1]     Chr1 1179011-1179226      -
#>   -------
#>   seqinfo: 1 sequence from an unspecified genome; no seqlengths
splicePlot(rice.bg,gene='MSTRG.183',samples = sampleNames(rice.bg)[c(1,3,5)],
    start = 1179000, end = 1179300)
#> [1] "yes"

6. Functions

Currently, there are 6 functions in VaSP:
getDepth: Get read depth from a BAM file (in bedgraph format)
getGeneinfo: Get gene informaton from a ballgown object
spliceGene: Calculate 3S scores for one gene
spliceGenome: Calculate genome-wide splicing scores
BMfinder: Discover bimodal distrubition features
splicePlot: Visualization of read coverage, splicing information and gene information in a gene region

6.1 getDepth

Get read depth from a BAM file (in bedgraph format) and return a data.frame in bedgraph file format which can be used as input for plotBedgraph in the SuShi package.

6.2 getGeneinfo

Get gene informaton from a ballgown object by genes or by genomic regions and return a data.frame in bed-like file format that can be used as input for plotGenes in the SuShi package

6.3 spliceGene

Calculate 3S Scores from ballgown object for a given gene. This function can only calculate one gene. Please use function spliceGenome to obtain genome-wide 3S scores.

rice.bg
#> ballgown instance with 33 transcripts and 6 samples
head(geneIDs(rice.bg))
#>           1           2           3           4           5           6 
#> "MSTRG.177" "MSTRG.177" "MSTRG.177" "MSTRG.178" "MSTRG.178" "MSTRG.179"

score <- spliceGene(rice.bg, "MSTRG.183", junc.type = "score")
count <- spliceGene(rice.bg, "MSTRG.183", junc.type = "count")

## compare
tail(score)
#>    Sample_027 Sample_042 Sample_102 Sample_137 Sample_237 Sample_272
#> 54   1.073545  1.1034944  0.9799037  1.0581254  1.0581254  1.0581254
#> 55   1.073545  1.1034944  0.1224880  0.1594436  0.1594436  0.1594436
#> 56   0.788727  1.3148018  1.1803386  1.3190330  1.3190330  1.3190330
#> 57   0.000000  0.0000000  0.5790340  0.4058563  0.4058563  0.4058563
#> 58   0.000000  0.0234786  0.2227054  0.2319179  0.2319179  0.2319179
#> 59   0.000000  0.0000000  0.0000000  0.1159589  0.1159589  0.1159589
tail(count)
#>    Sample_027 Sample_042 Sample_102 Sample_137 Sample_237 Sample_272
#> 54         49         47         88         73         73         73
#> 55         49         47         11         11         11         11
#> 56         36         56        106         91         91         91
#> 57          0          0         52         28         28         28
#> 58          0          1         20         16         16         16
#> 59          0          0          0          8          8          8

## get intron structrue
intron <- structure(rice.bg)$intron
intron[intron$id %in% rownames(score)]
#> GRanges object with 16 ranges and 2 metadata columns:
#>        seqnames          ranges strand |        id transcripts
#>           <Rle>       <IRanges>  <Rle> | <integer> <character>
#>    [1]     Chr1 1172688-1173213      - |        43       15:19
#>    [2]     Chr1 1173416-1173795      - |        44       15:19
#>    [3]     Chr1 1173877-1173965      - |        45       15:19
#>    [4]     Chr1 1174170-1174670      - |        46       15:19
#>    [5]     Chr1 1175175-1176065      - |        48       15:19
#>    ...      ...             ...    ... .       ...         ...
#>   [12]     Chr1 1179011-1179226      - |        55       15:16
#>   [13]     Chr1 1174881-1174952      - |        56       16:19
#>   [14]     Chr1 1179011-1179134      - |        57          17
#>   [15]     Chr1 1179011-1179110      - |        58          18
#>   [16]     Chr1 1179011-1179106      - |        59          19
#>   -------
#>   seqinfo: 1 sequence from an unspecified genome; no seqlengths

6.4 spliceGenome

Calculate 3S scores from ballgown objects for all genes and return a list of two elements: “score’ is a matrix of intron 3S scores with intron rows and sample columns and”intron" is a GRanges object of intron structure.

rice.bg
#> ballgown instance with 33 transcripts and 6 samples

splice <- spliceGenome(rice.bg, gene.select = NA, intron.select = NA)
#> ---Calculate gene-level read coverage:
#>   10 genes selected.
#> ---Extract intron-level read ucount:
#>   81 introns in 9 genes selected.
names(splice)
#> [1] "score"  "intron"

head(splice$score)
#>   Sample_027 Sample_042 Sample_102 Sample_137 Sample_237 Sample_272
#> 1  1.4852698  1.6132865   1.934796   1.834662   1.834662   1.834662
#> 2  1.1580070  1.5164893   1.924559   1.726741   1.726741   1.726741
#> 3  1.2838773  1.7423494   2.129300   2.309516   2.309516   2.309516
#> 4  1.8377067  1.3551606   1.904085   2.050505   2.050505   2.050505
#> 5  0.9817885  0.9679719   1.289864   1.446146   1.446146   1.446146
#> 6  1.1076589  1.1615663   1.637923   1.661988   1.661988   1.661988
splice$intron
#> GRanges object with 81 ranges and 3 metadata columns:
#>        seqnames          ranges strand |        id   transcripts     gene_id
#>           <Rle>       <IRanges>  <Rle> | <integer>   <character> <character>
#>    [1]     Chr1 1146321-1146479      - |         1           1:2   MSTRG.177
#>    [2]     Chr1 1146612-1147484      - |         2           1:2   MSTRG.177
#>    [3]     Chr1 1147563-1148021      - |         3           1:3   MSTRG.177
#>    [4]     Chr1 1148200-1148268      - |         4           1:3   MSTRG.177
#>    [5]     Chr1 1148442-1148530      - |         5           1:3   MSTRG.177
#>    ...      ...             ...    ... .       ...           ...         ...
#>   [77]     Chr1 1187243-1187436      - |        77 c(28, 29, 32)   MSTRG.186
#>   [78]     Chr1 1189347-1190773      - |        78         29:30   MSTRG.186
#>   [79]     Chr1 1190863-1190978      - |        79         29:30   MSTRG.186
#>   [80]     Chr1 1189347-1189914      - |        80         31:33   MSTRG.186
#>   [81]     Chr1 1189961-1190037      - |        81            33   MSTRG.186
#>   -------
#>   seqinfo: 1 sequence from an unspecified genome; no seqlengths

6.5 BMfinder

Find bimodal distrubition features and divide the samples into 2 groups by k-means clustering and return a matrix with feature rows and sample columns.

6.6 splicePlot

Visualization of read coverage, splicing information and gene information in a gene region. This function is a wrapper of getDepth, getGeneinfo, spliceGene, plotBedgraph and plotGenes.

If the bam files are provided (bam.dir is not NA), the read depth for each sample is plotted. Otherwise (bam.dir=NA), the conserved exons of the samples are displayed by rectangles (an example is the figure in 4. Quick start). And by default (junc.type = 'score', junc.text = TRUE), the junctions (represented by arcs) are labeled with splicing scores. You can change the argument junc.text = FALSE to unlabel the junctions or change the argument junc.type = 'count' to label with junction read counts.

There are other more options to modify the plot, please see the function ?splicePlot for details.

7. Session Information

sessionInfo()
#> R version 4.1.0 (2021-05-18)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 20.04.2 LTS
#> 
#> Matrix products: default
#> BLAS:   /home/biocbuild/bbs-3.13-bioc/R/lib/libRblas.so
#> LAPACK: /home/biocbuild/bbs-3.13-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     
#> 
#> other attached packages:
#> [1] Sushi_1.30.0    biomaRt_2.48.0  zoo_1.8-9       VaSP_1.4.0     
#> [5] ballgown_2.24.0
#> 
#> loaded via a namespace (and not attached):
#>  [1] nlme_3.1-152                bitops_1.0-7               
#>  [3] matrixStats_0.58.0          bit64_4.0.5                
#>  [5] filelock_1.0.2              RColorBrewer_1.1-2         
#>  [7] progress_1.2.2              httr_1.4.2                 
#>  [9] GenomeInfoDb_1.28.0         tools_4.1.0                
#> [11] bslib_0.2.5.1               utf8_1.2.1                 
#> [13] R6_2.5.0                    DBI_1.1.1                  
#> [15] BiocGenerics_0.38.0         mgcv_1.8-35                
#> [17] tidyselect_1.1.1            prettyunits_1.1.1          
#> [19] curl_4.3.1                  bit_4.0.4                  
#> [21] compiler_4.1.0              Biobase_2.52.0             
#> [23] DelayedArray_0.18.0         rtracklayer_1.52.0         
#> [25] sass_0.4.0                  genefilter_1.74.0          
#> [27] rappdirs_0.3.3              stringr_1.4.0              
#> [29] digest_0.6.27               Rsamtools_2.8.0            
#> [31] rmarkdown_2.8               XVector_0.32.0             
#> [33] pkgconfig_2.0.3             htmltools_0.5.1.1          
#> [35] MatrixGenerics_1.4.0        dbplyr_2.1.1               
#> [37] fastmap_1.1.0               limma_3.48.0               
#> [39] highr_0.9                   rlang_0.4.11               
#> [41] RSQLite_2.2.7               jquerylib_0.1.4            
#> [43] BiocIO_1.2.0                generics_0.1.0             
#> [45] jsonlite_1.7.2              BiocParallel_1.26.0        
#> [47] dplyr_1.0.6                 RCurl_1.98-1.3             
#> [49] magrittr_2.0.1              GenomeInfoDbData_1.2.6     
#> [51] Matrix_1.3-3                Rcpp_1.0.6                 
#> [53] S4Vectors_0.30.0            fansi_0.4.2                
#> [55] lifecycle_1.0.0             stringi_1.6.2              
#> [57] yaml_2.2.1                  edgeR_3.34.0               
#> [59] SummarizedExperiment_1.22.0 zlibbioc_1.38.0            
#> [61] BiocFileCache_2.0.0         grid_4.1.0                 
#> [63] blob_1.2.1                  parallel_4.1.0             
#> [65] crayon_1.4.1                lattice_0.20-44            
#> [67] Biostrings_2.60.0           splines_4.1.0              
#> [69] annotate_1.70.0             hms_1.1.0                  
#> [71] KEGGREST_1.32.0             locfit_1.5-9.4             
#> [73] knitr_1.33                  pillar_1.6.1               
#> [75] GenomicRanges_1.44.0        rjson_0.2.20               
#> [77] stats4_4.1.0                XML_3.99-0.6               
#> [79] glue_1.4.2                  evaluate_0.14              
#> [81] png_0.1-7                   vctrs_0.3.8                
#> [83] purrr_0.3.4                 assertthat_0.2.1           
#> [85] cachem_1.0.5                xfun_0.23                  
#> [87] xtable_1.8-4                restfulr_0.0.13            
#> [89] survival_3.2-11             tibble_3.1.2               
#> [91] GenomicAlignments_1.28.0    AnnotationDbi_1.54.0       
#> [93] memoise_2.0.0               IRanges_2.26.0             
#> [95] cluster_2.1.2               sva_3.40.0                 
#> [97] ellipsis_0.3.2