The SARTools R package which generated this report has been developped at PF2 - Institut Pasteur by M.-A. Dillies and H. Varet (hugo.varet@pasteur.fr). Thanks to cite H. Varet, L. Brillet-Guéguen, J.-Y. Coppee and M.-A. Dillies, SARTools: A DESeq2- and EdgeR-Based R Pipeline for Comprehensive Differential Analysis of RNA-Seq Data, PLoS One, 2016, doi: http://dx.doi.org/10.1371/journal.pone.0157022 when using this tool for any analysis published.
The analyses reported in this document are part of the r projectName
project. The aim is to find features that are differentially expressed between r paste(paste(levels(target[,varInt])[-nlevels(target[,varInt])],collapse=", "),levels(target[,varInt])[nlevels(target[,varInt])],sep=" and ")
. The statistical analysis process includes data normalization, graphical exploration of raw and normalized data, test for differential expression for each feature between the conditions, raw p-value adjustment and export of lists of features having a significant differential expression between the conditions. r ifelse(!is.null(batch),paste0("In this analysis, the ",batch, " effect will be taken into account in the statistical models."),"")
The analysis is performed using the R software [@rcoreteam], Bioconductor [@Gentleman2004] packages including edgeR [@robinson2010] and the SARTools package developed at PF2 - Institut Pasteur. Normalization and differential analysis are carried out according to the edgeR model and package. This report comes with additional tab-delimited text files that contain lists of differentially expressed features.
For more details about the edgeR methodology, please refer to its related publications [@robinson2007; @robinson2008; @robinson2010; @mccarthy2012].
The count data files and associated biological conditions are listed in the following table.
kable_styling(kable(target, row.names=FALSE, caption="Table 1: Data files and associated biological conditions.", format="html"), c("striped", "bordered", "responsive"), font_size=12)
After loading the data we first have a look at the raw data table itself. The data table contains one row per annotated feature and one column per sequenced sample. Row names of this table are feature IDs (unique identifiers). The table contains raw count values representing the number of reads that map onto the features. For this project, there are r nrow(counts)
features in the count data table.
kable_styling(kable(head(counts[, 1:min(ncol(counts), 10)]), row.names=TRUE, digits=0, caption="Table 2: Partial view of the count data table.", format="html"), c("striped", "bordered", "responsive"), font_size=12)
Looking at the summary of the count table provides a basic description of these raw counts (min and max values, median, etc).
fun_summary=function(x){ out=c(quantile(x,c(0,0.25,0.5),type=1),mean(x),quantile(x,c(0.75,1),type=1)) names(out)=c("Min.","1st Qu.","Median","Mean","3rd Qu.","Max.") return(round(out,0)) } kable_styling(kable(t(apply(counts, 2, fun_summary)), row.names=TRUE, digits=0, caption="Table 3: Summary of the raw counts.", format="html"), c("striped", "bordered", "responsive"), font_size=12) nbNull <- nrow(counts) - nrow(removeNull(counts)) percentNull <- nbNull/nrow(counts)
Figure 1 shows the total number of mapped and counted reads for each sample. We expect total read counts to be similar within conditions, they may be different across conditions. Total counts sometimes vary widely between replicates. This may happen for several reasons, including:
Figure 2 shows the percentage of features with no read count in each sample. We expect this percentage to be similar within conditions. Features with null read counts in the r ncol(counts)
samples will not be taken into account for the analysis with edgeR. Here, r nbNull
features (r round(100*percentNull,2)
%) are in this situation (dashed line).
Figure 3 shows the distribution of read counts for each sample (on a log scale to improve readability). Again we expect replicates to have similar distributions. In addition, this figure shows if read counts are preferably low, medium or high. This depends on the organisms as well as the biological conditions under consideration.
It may happen that one or a few features capture a high proportion of reads (up to 20% or more). This phenomenon should not influence the normalization process. The edgeR normalization has proved to be robust to this situation [@dillies2013]. Anyway, we expect these high count features to be the same across replicates. They are not necessarily the same across conditions. Figure 4 and table 4 illustrate the possible presence of such high count features in the data set.
kable_styling(kable(t(as.matrix(majSequences))[,1:min(10, nrow(majSequences))], row.names=TRUE, digits=2, caption="Table 4: Percentage of reads associated with the sequences having the highest counts.", format="html"), c("striped", "bordered", "responsive"), font_size=12)
We may wish to assess the similarity between samples across conditions. A pairwise scatter plot is produced (figure 5) to show how replicates and samples from different biological conditions are similar or different (using a log scale). Moreover, as the Pearson correlation has been shown not to be relevant to measure the similarity between replicates, the SERE statistic has been proposed as a similarity index between RNA-Seq samples [@Schulze2012]. It measures whether the variability between samples is random Poisson variability or higher. Pairwise SERE values are printed in the lower triangle of the pairwise scatter plot. The value of the SERE statistic is:
0 when samples are identical (no variability at all: this may happen in the case of a sample duplication);
1 for technical replicates (technical variability follows a Poisson distribution);
greater than 1 for biological replicates and samples from different biological conditions (biological variability is higher than technical one, data are over-dispersed with respect to Poisson). The higher the SERE value, the lower the similarity. It is expected to be lower between biological replicates than between samples of different biological conditions. Hence, the SERE statistic can be used to detect inversions between samples.
edgeR suggests to filter features with null or low counts because they do not supply much information. For this project, r nrow(counts) - nrow(out.edgeR$dge$counts)
features (r round(100*(nrow(counts)-nrow(out.edgeR$dge$counts))/nrow(counts),2)
%) have been removed from the analysis because they did not satisfy the following condition: having at least r cpmCutoff
counts-per-million in at least r min(table(target[,varInt]))
samples.
The main variability within the experiment is expected to come from biological differences between the samples. This can be checked in two ways. The first one is to perform a hierarchical clustering of the whole sample set. This is performed after a transformation of the count data as moderated log-counts-per-million. Figure 6 shows the dendrogram obtained from CPM data. An euclidean distance is computed between samples, and the dendrogram is built upon the Ward criterion. We expect this dendrogram to group replicates and separate biological conditions.
Another way of visualizing the experiment variability is to look at the first two dimensions of a multidimensional scaling plot, as shown on figure 7. On this figure, the first dimension is expected to separate samples from the different biological conditions, meaning that the biological variability is the main source of variance in the data.
if (!is.null(batch)){ cat("For the statistical analysis, we need to take into account the effect of the ",batch," parameter. Statistical models and tests will thus be adjusted on it.\n") }
Normalization aims at correcting systematic technical biases in the data, in order to make read counts comparable across samples. The normalization proposed by edgeR is called Trimmed Mean of M-values (TMM) but it is also possible to use the RLE (DESeq) or upperquartile normalizations. It relies on the hypothesis that most features are not differentially expressed.
edgeR computes a factor for each sample. These normalization factors apply to the total number of counts and cannot be used to normalize read counts in a direct manner. Indeed, normalization factors are used to normalize total counts. These in turn are used to normalize read counts according to a total count normalization: if $N_j$ is the total number of reads of the sample $j$ and $f_j$ its normalization factor, $N'j=f_j \times N_j$ is the normalized total number of reads. Then, let $s_j=N'_j/\bar{N'}$ with $\bar{N'}$ the mean of the $N'_j$ s. Finally, the normalized counts of the sample $j$ are defined as $x'{ij}=x_{ij}/s_j$ where $i$ is the gene index.
kable_styling(kable(t(matrix(out.edgeR$dge$samples$norm.factors, dimnames=list(target$label,paste0(normalizationMethod," normalization factors")))), row.names=TRUE, digits=2, caption="Table 5: Normalization factors.", format="html"), c("striped", "bordered", "responsive"), font_size=12)
Boxplots are often used to assess the quality of the normalization process, as they show how distributions are globally affected during this process. We expect normalization to stabilize distributions across samples. Figure 8 shows boxplots of raw (left) and normalized (right) data respectively.
edgeR aims at fitting one linear model per feature. For this project, the design used is r paste(as.character(paste("~", ifelse(!is.null(batch), paste(batch,"+"), ""), varInt)),collapse=" ")
and the goal is to estimate the models' coefficients which can be interpreted as $\log_2(\texttt{FC})$. These coefficients will then be tested to get p-values and adjusted p-values.
The edgeR model assumes that the count data follow a negative binomial distribution which is a robust alternative to the Poisson law when data are over-dispersed (the variance is higher than the mean). The first step of the statistical procedure is to estimate the dispersion of the data.
Figure 9 shows the result of the dispersion estimation step. The x- and y-axes represent the mean count value and the estimated dispersion respectively. Black dots represent empirical dispersion estimates for each feature (from the observed count values). The blue curve shows the relationship between the means of the counts and the dispersions modeled with splines. The red segment represents the common dispersion.
Once the dispersion estimation and the model fitting have been done, edgeR can perform the statistical testing. Figure 10 shows the distributions of raw p-values computed by the statistical test for the comparison(s) done. This distribution is expected to be a mixture of a uniform distribution on $[0,1]$ and a peak around 0 corresponding to the differentially expressed features.
A p-value adjustment is performed to take into account multiple testing and control the false positive rate to a chosen level $\alpha$. For this analysis, a r pAdjustMethod
p-value adjustment was performed [@BH1995; @BY2001] and the level of controlled false positive rate was set to r alpha
.
kable_styling(kable(summaryResults$nDiffTotal, row.names=FALSE, digits=0, caption="Table 6: Number of up-, down- and total number of differentially expressed features for each comparison.", format="html"), c("striped", "bordered", "responsive"), font_size=12)
Figure 11 represents the MA-plot of the data for the comparisons done, where differentially expressed features are highlighted in red. A MA-plot represents the log ratio of differential expression as a function of the mean intensity for each feature. Triangles correspond to features having a too low/high $\log_2(\text{FC})$ to be displayed on the plot.
Figure 12 shows the volcano plots for the comparisons performed and differentially expressed features are still highlighted in red. A volcano plot represents the log of the adjusted P value as a function of the log ratio of differential expression.
Full results as well as lists of differentially expressed features are provided in the following text files which can be easily read in a spreadsheet. For each comparison:
These files contain the following columns:
r paste(paste(levels(target[,varInt])[-nlevels(target[,varInt])],collapse=", "),levels(target[,varInt])[nlevels(target[,varInt])],sep=" and ")
: means (rounded) of normalized counts of the biological conditions;The versions of the R software and Bioconductor packages used for this analysis are listed below. It is important to save them if one wants to re-perform the analysis in the same conditions.
si <- as.character(toLatex(sessionInfo())) si <- si[-c(1,length(si))] si <- gsub("(\\\\verb)|(\\|)", "", si) si <- gsub("~", " ", si) si <- paste(si, collapse=" ") si <- unlist(strsplit(si, "\\\\item")) cat(paste(si, collapse="\n -"), "\n")
Parameter values used for this analysis are:
r workDir
r projectName
r author
r targetFile
r rawDir
r ifelse(is.null(featuresToRemove),"NULL",paste(featuresToRemove,collapse=", "))
r varInt
r condRef
r ifelse(is.null(batch),"NULL",batch)
r alpha
r pAdjustMethod
r cpmCutoff
r gene.selection
r normalizationMethod
r colors
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.