BADGE: A novel Bayesian model for accurate abundance quantification and differential analysis of RNA-Seq data

Background Recent advances in RNA sequencing (RNA-Seq) technology have offered unprecedented scope and resolution for transcriptome analysis. However, precise quantification of mRNA abundance and identification of differentially expressed genes are complicated due to biological and technical variations in RNA-Seq data. Results We systematically study the variation in count data and dissect the sources of variation into between-sample variation and within-sample variation. A novel Bayesian framework is developed for joint estimate of gene level mRNA abundance and differential state, which models the intrinsic variability in RNA-Seq to improve the estimation. Specifically, a Poisson-Lognormal model is incorporated into the Bayesian framework to model within-sample variation; a Gamma-Gamma model is then used to model between-sample variation, which accounts for over-dispersion of read counts among multiple samples. Simulation studies, where sequencing counts are synthesized based on parameters learned from real datasets, have demonstrated the advantage of the proposed method in both quantification of mRNA abundance and identification of differentially expressed genes. Moreover, performance comparison on data from the Sequencing Quality Control (SEQC) Project with ERCC spike-in controls has shown that the proposed method outperforms existing RNA-Seq methods in differential analysis. Application on breast cancer dataset has further illustrated that the proposed Bayesian model can 'blindly' estimate sources of variation caused by sequencing biases. Conclusions We have developed a novel Bayesian hierarchical approach to investigate within-sample and between-sample variations in RNA-Seq data. Simulation and real data applications have validated desirable performance of the proposed method. The software package is available at http://www.cbil.ece.vt.edu/software.htm.


Background
Next Generation Sequencing (NGS) technology has opened a new era for transcriptome analysis, which grants the ability to investigate novel biological problems, such as alternative splicing, differential isoforms, gene fusion, etc. By piling up millions of reads along the reference genome, RNA-Seq technology can obtain signals in a much larger dynamic range with much higher accuracy compared to traditional microarray based technologies. For RNA-Seq analysis, the most popular routine is to determine the expression of genes (abundance quantification) and to identify differentially expressed genes (DEGs).
Methods that quantify gene/isoform level expression mainly fall into two categories: Poisson count mode (e.g., Cufflinks [1], etc) and linear regression model (e.g., Isolasso [2], SLIDE [3], BASIC [4], etc.). The major challenge in accurate quantification of gene expression is that large systematic bias in sequencing counts has been observed due to multiple factors. In contrast to uniform assumption of read distribution, it has been reported that sequence counts show a variety of physical and chemical biases, including transcript length bias, GC-content bias, random hexamer priming bias, etc [5][6][7].
Differential analysis of RNA-Seq data has been focused on modeling variance among biological replicates or samples in the same phenotype group. EdgeR [8] is the first method that models the 'between-sample' variability by replacing the Poisson model with Negative Binomial model. Various statistical methods have been proposed to model the variance among samples in biological groups, aimed to improve overall fitting of count data or robustness against outliers [9][10][11][12].
Despite initial success to model uncertainties associated with sequencing counts from different aspects, there lacks a systematic effort to address variability in RNA-Seq data. We dissect the variance in sequencing counts along two dimensions: over-dispersion of read counts within the same sample (i.e., within-sample variation) and over-dispersion of read counts among individuals from the same biological group (i.e., between-sample variation). Within-sample variation typically leads to large variance of read counts among genomic loci (e.g., nucleotides or exons), which have similar expression level in the same sample. It is typically caused by technical artifacts such as uncorrected systematic bias and gene specific random effects. On the other hand, between-sample variation is mostly due to biological differences among samples under the same condition. To increase the accuracy of abundance estimation so as to improve DEG identification, immediate attention is needed to developing a unified model that takes care of both forms of variation in RNA-Seq data. We propose a computational method, namely Bayesian Analysis of Dispersed Gene Expression ('BADGE'), to model variability in RNA-Seq data. A full Bayesian model is employed to simultaneously account for within-sample variation and between-sample variation to improve inference. The proposed method has several novel contributions compared to existing methodologies: 1) a unified Bayesian causality model is developed for joint abundance estimation and DEG identification. The improved accuracy in profiling mRNA abundance can facilitate the identification of DEGs, which may in turn refine the parameter learning in abundance quantification. 2) A Poisson-Lognormal regression model is incorporated to model within-sample variation [13]. Instead of dealing with multiples sources of technical bias and variation separately, the proposed method can 'blindly' detect over-dispersion pattern within the individual sample. 3) Gamma-Gamma model [14] is used to model between-sample variation, which accounts for overdispersion of read counts among multiple samples. BADGE is a unified computational method that extensively models variability in RNA-seq data to improve abundance quantification and DEG identification.

Bayesian Analysis of Dispersed Gene Expression (BADGE)
We have developed a computational method, namely Bayesian Analysis of Dispersed Gene Expression (BADGE), to model extensive variability in RNA-Seq data. BADGE explicitly models both between-sample variation and within-sample variation to improve abundance quantification and DEG identification. In this paper, we only focus on the gene level analysis, while the concept can be straight-forwardly generalized for genes with multiple transcripts (isoforms).
Let y g,i,j represent observed counts that fall into the i th (1 ≤ i ≤ I g ) exon region of gene g (1 ≤ g ≤ G) in sample j (1 ≤ j ≤ J), which follows Poisson distribution with mean g g,i,j . I g is the number of exons in gene g. G is the total number of genes. J = J 1 + J 2 is the total number of samples, where J 1 and J 2 denote samples in condition 1 and 2, respectively. Within-sample over-dispersion indicates that g g,i,j has unknown heterogeneity across the gene rather than taking constant value. A hierarchical Bayesian model is constructed to model within-sample variation of RNA-Seq data as follows: where b g,j is the true expression level of gene g for sample j. x g,i is the length of the i th exon weighted by the library size of sample j. U g,i,j is the unknown within-sample variation parameter, which follows normal distribution with mean 0 and precision τ. 'Flat' prior is assigned for τ by setting its shape a = 1 and rate b = 0. Equations (1)(2)(3)(4) are also known as the Poisson-Lognormal regression model with identity link function.
Not only does the read count y g,i,j exhibits overdispersion, but also b g,j has variation across multiple samples in the same biological group. To model between-sample variation carried by b g,j , we adopt the Gamma-Gamma model that is widely used in microarray gene expression analysis [14] into the Poisson count model. Let j 1 and j 2 represent samples in condition 1 and 2. d g is the binary differential state of gene g, where d g = 0 means gene g is not differentially expressed; d g = 1, otherwise. The Gamma-Gamma model for RNA-Seq differential expression is given by: and where λ (1) g and λ (2) g are the rate parameters of Gamma distribution. If d g = 0, λ g . a is the shape parameter for b g,j , which does not depend on differential state d g Moreover, we assume that the pooled rate parameter l g from the gene population further follows Gamma distribution with shape parameter a 0 and rate parameter v. We assign non-informative priors for hyper-parameters a, a 0 , d g (P(d g = 1)= π g = 0.5) and v(a 0 = 1, b 0 = 0). The sub-model defined by Equations (5-9) considers between-sample variation within the same group, which borrows knowledge from the entire population to improve parameter estimation of individual genes. Figure 1 gives the Bayesian hierarchical dependency graph for all the parameters involved in the BADGE method using plate notation. There are three plates in Figure 1: The inner plate denotes dependency among read counts within I g exons in gene g; middle plate denotes dependency among J samples; and the outmost plate represents G genes. Observation y, represented by shaded circle, is the raw exon level RNA-Seq count (for gene level count data, I g = 1), which depends on mRNA abundance b, gene design matrix x and within-sample over-dispersion parameter U. b further depends on group level between-sample over-dispersion Gamma parameter l and a, and U depends on global within-sample overdispersion parameter τ. Parameter l is determined by gene level differential state d, and its priors ν and a 0 . d g (differential state of gene g) is assumed to follow P(dg = 1) = π g = 0.5. Hyper-parameters a 0 , b 0 , π, a, and b, shown in shaded square, are fixed to construct non-informative priors (see additional file 1).

Estimate model parameters using Gibbs sampling
The joint posterior distribution of all parameters given observation y (read count) and x (exon length) is given by: For Poisson-Lognormal regression model, the posterior distributions of parameters b g,j , U g,i,j and τ can be sampled from their corresponding conditional distributions as: Observation (read count) y is shaded, while the random variables are denoted as circles. Fixed parameters are denoted as shaded squares. Exon length information x is denoted as oval. I g is the number of exons, J is the total number of samples in two groups, and G is the number of genes. Note that parameter l actually is a parameter set {l (1) , l (2) }, which correspond to two sample conditions.
We pool all the samples from U g,i,j and get its estimatê T is the total number of Gibbs samples.Û g,i,j will be passed to the Gamma-Gamma model to estimate parameters associated with DEG identification. Similarly for the Gamma-Gamma model, we sample the parameters b, l, α, α 0 , v and d according to their conditionals. The posterior distribution of β j (β j 1 , β j 2 ) can be sampled from: The posterior distribution of ν follows Gamma distribution that is given by: According to Wei etal. [14], the posterior distribution of d given b, a, a 0 and ν can be derived as: where The posterior distribution of a 0 and a are given by: We use Gibbs sampling method [4,13,15,16] to estimate the posterior distributions of individual parameters iteratively from their complex joint distribution. For parameters b, ν, τ, and l, we use conjugate priors to sample from their conditional distributions with standard probability distributions (Gamma distribution). For parameters (U, a 0 and a) that do not have conjugate priors, we use Metropolis-Hastings sampling to sample their posterior distributions. Please see more details about the implementation of Gibbs sampler in additional file 1.

Results and discussion
Over-dispersion of RNA-Seq counts in two dimensions: between-sample variation and within-sample variation Even though RNA-Seq has been proved to be more accurate and less sensitive to background noise than traditional microarray technology [17], large variance in sequencing counts has complicated the detection of hidden biological signals. Increasing evidence shows that read counts in RNA-Seq data have much larger variance than the mean (i.e., 'over-dispersion'), which requires replacing the Poisson model with more sophisticated count models such as Negative Binomial model [8]. Figure 2 (a) shows the scatter plot of mean versus variance for three RNA-Seq datasets: basal breast cancer samples from The Cancer Genome Atlas (TCGA) project [18], human B cell datasets from Cheung et al. [19], and a mouse dataset [20]. The slopes of the least squares (LS) fit lines for all scatter plots are apparently larger than the Poisson model, which implies severe over-dispersion in all three RNA-seq datasets. In addition to variability across samples ('betweensample variation'), we have also observed strong variance of sequencing counts among genomic loci in the same biological sample ('within-sample variability'). Figure 2 (b) shows the scatter plots of counts that fall in 100nt bins along the same gene within the same sample. One TCGA breast cancer sample and one MCF7 breast cancer cell line sample [21] are used as examples. Figure 2 (b) shows strong within-sample over-dispersion of read counts in both RNA-Seq samples, implying the presence of unknown sources of variability. Figure 2 (c) shows the variation of sequencing bias among all the genes within one sample. Despite an overall tendency where read coverage is biased towards the 3'-end of the transcript, subgroups of the genes in the genome exhibit diverse patterns showing either a bias towards the 5'-end or having depleted coverage on both ends. In Figure 2 (d), we further show an example of read coverage for gene S100A9 (exon 2) across four samples from TCGA basal breast cancer dataset. The base level coverage has two distinct patterns, indicating large variation of unknown read bias in the same group. The ambiguity in coverage pattern cannot be explained by deterministic systematic bias, and therefore need to be corrected for accurate estimation of RNA-Seq abundance.

Generate simulation data based on real RNA-Seq datasets
To generate realistic synthetic data that represent characteristics of real RNA-Seq data, we adopted a simulation strategy proposed by Wu et al. [10] to first estimate model parameters from real datasets and then use them to generate sequencing counts based on human annotation file (version: GRCh37/hg19). Two RNA-Seq datasets were used in the study: 1) a mouse dataset with 10 C57BL/6J (B6) mouse samples and 11 DBA/2J (D2) mouse samples [20]; 2) 23 basal breast cancer samples from the TCGA project [18]. For the TCGA dataset, we divided the patients (which received chemotherapy treatment) into two groups: early re-current group (recurrence time < 2 yrs, 13 samples) and late recurrent group (recurrence time > 3 yrs, 10 samples). Figure 3 gives the trace plots of sampled model parameters. We used thin = 10 for the Gibbs sampling process, which means to record every 10 th sample. It took BADGE several hours to estimate posterior distributions using 10,000 iterations on real dataset. We have also plotted auto-correlation curves of each parameter in supplementary materials (additional file 1). We further explored the variability of RNA-Seq data by close examination of estimated model parameters. For withinsample variability, two typical values of over-dispersion prior parameter τ have been estimated, where τ = 0.44 in mouse dataset and τ = 1.78 in TCGA dataset. In our Poisson-Lognormal regression model, τ is the precision parameter (inverse of Gaussian variance s 2 ) that controls overall degree of within-sample over-dispersion. Smaller τ indicates larger variation of read counts across the transcriptome. Small value of τ observed in real datasets strongly supported our motivation that read counts along one transcript must be corrected for improved abundance estimation. Between-sample variability is jointly determined by a, a 0 , and ν. Small value in ν (0.001 in mouse and 0.2 in TCGA sample) yield large variation of VAR (l), where VAR (b) increases when l takes small value. We used the model parameters estimated from real datasets to generate read counts for simulation. Please refer to supplementary materials in additional file 1 for more detailed description of simulation data.

Performance comparison for abundance estimation on simulation data
We incorporated the estimated parameter τ from real datasets to generate synthetic data and studied the performance of the BADGE method for abundance estimation. We compared our method with four commonly used methods for RNA-Seq normalization, which were: readsper-kilobase-per-million (RPKM), DESeq, trimmed mean of M-values (TMM) and upper quantile normalization (UQUA). RPKM [22] is calculated through normalizing reads by length of genomic features (genes and exons) and total library size. DESeq normalization is implemented by DESeq (1.14.1) [9], which is a differential gene identification method based on negative binomial model. TMM was originally developed in edgeR [8] and later included into BioConductor package NOISeq [23]. NOISeq (2.0.0) also has separate implementations of RPKM and UQUA methods, which were used here for performance comparison. Based on estimated parameters from real RNA-Seq datasets (mouse and TCGA breast cancer data), we selected typical model parameters to simulate count data: σ = 0.75, 1 and 1.5; ν = 0.1 and 0.001; α = 2 and α 0 = 0.5. We used the average correlation of normalized counts with ground truth gene expression to measure the accuracy of abundance quantification across multiple samples. Figure 4 gives the average correlation for all competing methods under different model settings. From Figure 4, we see that the BADGE method had robust performance under different over-dispersion settings by maintaining a performance measure (correlation to ground truth) very close to 1. Among the rest of the normalization methods, DESeq, TMM and UQUA achieved comparable performance across multiple parameter settings, while RPKM had the least favourable performance in all scenarios. Our computational result is quite consistent with the observation by Dillies et al. [24] that DESeq and TMM (edgeR) are much better normalization methods than RPKM.

Performance comparison for differentially expressed gene (DEG) identification on simulation data
We compared BADGE with four existing methods: DESeq (1.14.1, fitType=local), edgeR (3.4.2, default), DSS (2.0.0, default), EBSeq (1.3.1, default), for differentially expressed gene (DEG) identification from RNA-Seq data. We used parameters learned from real datasets to generate simulation data. Within-sample variability is controlled by precision parameter τ (or standard deviation σ), and we set τ = 1.78 (i.e., s = 0.75, which was learned from TCGA basal dataset) and τ = 0.44 (i.e., s = 1.5, which was learned from mouse dataset.). According to estimated parameters from real datasets, we set a = 2, a 0 = 0.5, while varied ν between 0.001 and 0.1, which was consistent with the parameter settings in abundance estimation. For each parameter set, we randomly selected 10 genesets from hg19 annotation file to evaluate the variance of the performance. Areaunder-the-curve (AUC) of the receiver operating characteristic (ROC) curve was used as performance measurement. Tables 1, 2, 3 give the AUC values for each method along with standard deviations (listed in parentheses) of AUCs across 10 experiments.
We simulated RNA-Seq gene expression with three different scenarios: genes that were highly differentially expressed, moderately differentially expressed and weakly differentially expressed (see supplementary materials in additional file 1 for more information). From Tables 1, 2, 3, we see that the BADGE method consistently outperformed existing methods in different parameter settings (highlighted in bold). For highly differentially expressed genes (Table 1), the performance of the other methods degraded as we decreased τ, while BADGE was able to Figure 4 Performance comparison for abundance estimation on simulation data. maintain good performance by employing a Poisson-Lognormal model to account for within-sample variability. For genes that were weakly differentially expressed (Table  3), BADGE achieved a maximum improvement of AUC up to 1.3, compared to the second best method EBSeq ( Table 3, τ = 0.44, ν = 0.001).

Performance comparison for differentially expressed gene (DEG) identification on Sequencing Quality Control (SEQC) data
We compared the performance of BADGE with existing RNA-Seq differential gene identification methods on the Sequencing Quality Control (SEQC) dataset with ERCC spike-in controls [25]. 92 artificial transcripts were mixed into a real RNA-Seq library with different ratios (1:1 for none differentially expressed genes, and 4:1, 2:3 and 1:2 for differentially expressed genes), which were used as ground truth differential states for differential gene identification. Gene level counts were downloaded from http://bitbucket.org/soccin/seqc. We compared the ROC curves between BADGE and four other methods used in the simulation study for differential gene identification, which were DESeq [9], edgeR [8], DSS [10] and EBSeq [11]. Figure 5 shows the ROC curves of the five competing methods.
On the SEQC dataset, BADGE had the best performance among all five methods by achieving an AUC very close to 0.9. The second best method was DSS with an AUC about 0.85. DESeq (AUC = 0.7624) and edgeR (AUC = 0.7675) had very close performance, which was consistent with the previous results reported by Rapaport et al. [25]. EBSeq, on the other hand, had the least favourable performance (AUC = 0.71) on this specific dataset and it failed to detect the most strongly differentially expressed genes: its sensitivity was less than 0.1 when its specificity was about 0.9. By close examination of the 'left' ROC curves of the five methods, we can further infer that BADGE should have significantly better precision than the   competing methods, whose sensitivity went all the way up to 0.7 before any sacrifice in specificity.
'Blind' estimation of hidden heterogeneity in RNA-Seq data In contrast to uniform random sampling, read counts in RNA-Seq data show large variance due to different sources of hidden heterogeneities. By using a Poisson-Lognormal regression model, BADGE can 'blindly' estimate hidden heterogeneities across the transcriptome to minimize overall variability in sequencing counts without using additional information (e.g., genome sequence information in huge Fasta file to calculate GC percentage). In BADGE model, the variability of each individual exon is carried by parameter U g,i,j (gene g, exon i, sample j), while the overall degree of variation is controlled by τ. Based on sampled parameters from real datasets, we further investigated U g,i,j to see how systematic artifacts in RNA-Seq (such as transcript length bias and GC content) can be de-convoluted by BAGDE method. Figure 6 shows the histogram of Pearson's correlation between estimated U g,i,j and: 1. transcript location; 2. GC content. From Figure 6 (a), we see strong positive correlation between estimated over-dispersion parameter U g,i,j and transcript location, which indicates that most of the genes had biased expression towards 3'-end of the  transcript in our dataset, while about 15 percent of the genes had low correlation (<0.5). In addition, a significant correlation between U g,i,j and GC-content bias (extremely low or high GC content are associated with low abundance [26]) were also observed in Figure 6 (b). These observations support that BADGE can correctly estimate hidden sources of variation in RNA-Seq data 'blindly' without using transcript location information or sequence information.

Conclusions
Large variation in RNA-Seq data has become the major obstacle against accurate estimation of gene expression and DEG identification. Much effort has been made to model variation across biological replicates, while limited attention is paid to tackle extensive over-dispersion observed in sequencing counts. For short-read sequencing technologies (e.g., Illumina), multiple sources of systematic bias have been identified, including transcript length bias, GC-content bias, etc. However, in-depth investigation of real RNA-Seq datasets has revealed the following complications: 1) Sequencing bias not only changes from one gene to another, but also varies among samples (Figure 2(c) and (d)); 2) Gene expression is jointly influenced by multiple bias factors, which leads to large variation across the entire transcriptome ( Figure 6). However, current research activities have been focused on addressing individual bias corrections, which lacks a unified effort to account for total variability in RNA-Seq data. Therefore, we propose the BADGE method to extensively model both within-sample variability (bias and random variance) and between-sample variability (biological variations among replicates or within the same phenotype group) to improve quality of inference.