## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
## Loading required package: mgcv
## Loading required package: nlme
## 
## Attaching package: 'nlme'
## The following object is masked from 'package:dplyr':
## 
##     collapse
## This is mgcv 1.8-23. For overview type 'help("mgcv-package")'.
## Loading required package: genefilter
## Loading required package: BiocParallel
## Loading required package: S4Vectors
## Loading required package: stats4
## Loading required package: BiocGenerics
## Loading required package: parallel
## 
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:parallel':
## 
##     clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
##     clusterExport, clusterMap, parApply, parCapply, parLapply,
##     parLapplyLB, parRapply, parSapply, parSapplyLB
## The following objects are masked from 'package:dplyr':
## 
##     combine, intersect, setdiff, union
## The following objects are masked from 'package:stats':
## 
##     IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
## 
##     anyDuplicated, append, as.data.frame, cbind, colMeans,
##     colnames, colSums, do.call, duplicated, eval, evalq, Filter,
##     Find, get, grep, grepl, intersect, is.unsorted, lapply,
##     lengths, Map, mapply, match, mget, order, paste, pmax,
##     pmax.int, pmin, pmin.int, Position, rank, rbind, Reduce,
##     rowMeans, rownames, rowSums, sapply, setdiff, sort, table,
##     tapply, union, unique, unsplit, which, which.max, which.min
## 
## Attaching package: 'S4Vectors'
## The following objects are masked from 'package:dplyr':
## 
##     first, rename
## The following object is masked from 'package:base':
## 
##     expand.grid
## Loading required package: IRanges
## 
## Attaching package: 'IRanges'
## The following object is masked from 'package:nlme':
## 
##     collapse
## The following objects are masked from 'package:dplyr':
## 
##     collapse, desc, slice
## Loading required package: GenomicRanges
## Loading required package: GenomeInfoDb
## Loading required package: SummarizedExperiment
## Loading required package: Biobase
## Welcome to Bioconductor
## 
##     Vignettes contain introductory material; view with
##     'browseVignettes()'. To cite Bioconductor, see
##     'citation("Biobase")', and for packages 'citation("pkgname")'.
## Loading required package: DelayedArray
## Loading required package: matrixStats
## 
## Attaching package: 'matrixStats'
## The following objects are masked from 'package:Biobase':
## 
##     anyMissing, rowMedians
## The following objects are masked from 'package:genefilter':
## 
##     rowSds, rowVars
## The following object is masked from 'package:dplyr':
## 
##     count
## 
## Attaching package: 'DelayedArray'
## The following objects are masked from 'package:matrixStats':
## 
##     colMaxs, colMins, colRanges, rowMaxs, rowMins, rowRanges
## The following object is masked from 'package:base':
## 
##     apply

1 Description of raw data

The count data files and associated biological conditions are listed in the following table.

Table 1: Data files and associated biological conditions.
name drug type rep
fc1 ctrl ctrl A
fc2 ctrl ctrl B
fc3 ctrl ctrl C
fl1 low trt A
fl2 low trt B
fl3 low trt C
fh1 high trt A
fh2 high trt B
fh3 high trt C

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 16942 features in the count data table.

Table 2: Partial view of the count data table.
fc1 fc2 fc3 fl1 fl2
1500009L16RIK 28 76 68 54 56
1700007B14RIK 3 3 6 3 4
1700025F22RIK 0 0 1 0 0
1700092M07RIK 0 0 1 1 0
4932411E22RIK 0 1 2 1 1
6720489N17RIK 5 4 10 7 4

Looking at the summary of the count table provides a basic description of these raw counts (min and max values, median, etc).

Table 4: Summary stats of raw counts.
min Q1 median mean Q3 max libsum perc05 perc10 perc90 perc95 zeros percZeros
fc1 0 5 54 244 198.00 91016 4125390 0 0 901 5547 2306 13.61
fc2 0 11 120 577 462.00 263990 9779482 0 790 1559 2 1762 10.40
fc3 0 8 86 376 308.00 136335 6373602 507 1362 0 5 1989 11.74
fl1 0 9 94 412 342.75 160978 6987585 886 0 1 5021 1508 8.90
fl2 0 10 100 434 359.00 166886 7346116 0 1 917 8718 1522 8.98
fl3 0 10 98 448 366.00 189632 7589499 0 874 1600 0 1694 10.00
fh1 0 34 351 1517 1283.00 617236 25701428 1201 1490 1 3 647 3.82
fh2 0 52 544 2369 1995.75 899118 40142841 2098 0 3 2676 329 1.94
fh3 0 28 296 1278 1072.75 497701 21653367 0 1 3238 4606 923 5.45
</cent er>

Figure 1 shows the total number of mapped and counted reads for each sample. We expect total read counts to be similar within and across conditions (as opposed to RNA seq), as differences as fitness defects in HIP and HOP are ~15-20 and ~50-100 respectively. Total counts sometimes vary widely between replicates. This may happen for several reasons, including:

  • disproportionate counts/gene present in each sample that are not corrected by normalization (even between biological replicates);
  • tendency of barseq counts to include spurious high count reads that differ between samples
  • differences between library concentrations, since they may be difficult to measure with high precision.
Figure 1: Number of mapped reads per sample. Colors refer to the biological condition of the sample.

Figure 1: Number of mapped reads per sample. Colors refer to the biological condition of the sample.

Figure 2 shows the proportion of features with no read count in each sample. We expect this proportion to be similar across samples and conditions. Features with null read counts in the 9 samples are left in the data but are not taken into account for the analysis with DESeq2. Here, 0 features (0%) are in this situation (dashed line). Results for those features (fold-change and p-values) are set to NA in the results files.

Figure 2: Proportion of features with null read counts in each sample.

Figure 2: Proportion of features with null read counts in each sample.

Figure 3 shows the distribution of read counts for each sample. For sake of readability, \(\text{log}_2(\text{counts}+1)\) are used instead of raw counts. 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.

Figure 3a: Density distribution of read counts.

Figure 3a: Density distribution of read counts.

Figure 3b: Density distribution of raw and normalized counts.

Figure 3b: Density distribution of raw and normalized counts.

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 DESeq2 normalization has proved to be robust to this situation [Dillies, 2012]. 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. - note: rule of thumb, anything above 0.2 is a likely outlier

Figure 4: Percentage of reads associated with the sequence having the highest count (provided in each box on the graph) for each sample.

Figure 4: Percentage of reads associated with the sequence having the highest count (provided in each box on the graph) for each sample.

Table 4: Percentage of reads associated with the sequences having the highest counts.
fc1 fc2 fc3 fl1 fl2 fl3 fh1 fh2 fh3
MT-CO1 2.21 2.70 2.14 2.30 2.27 2.50 2.40 2.24 2.30
MT-COX3 1.12 1.09 0.89 0.87 0.95 1.12 0.87 0.94 1.19
MT-CYB 1.03 0.94 0.89 0.83 0.97 0.96 0.86 0.96 1.02
MT-ATP6 0.88 0.99 0.83 0.85 0.86 0.98 0.88 0.85 0.84
MBP 0.65 0.54 0.85 0.67 0.74 0.84 0.90 0.58 0.77

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 (\(\text{log}_2(\text{counts}+1)\) are used instead of raw count values). 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.

Figure 5: Pairwise comparison of samples (not produced when more than 30 samples).

Figure 5: Pairwise comparison of samples (not produced when more than 30 samples).

2 Variability within the experiment: data exploration

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 which can be either a Variance Stabilizing Transformation (VST) or a regularized log transformation (rlog) [@Anders2010; @Love2014].

A VST is a transformation of the data that makes them homoscedastic, meaning that the variance is then independent of the mean. It is performed in two steps: (i) a mean-variance relationship is estimated from the data with the same function that is used to normalize count data and (ii) from this relationship, a transformation of the data is performed in order to get a dataset in which the variance is independent of the mean. The homoscedasticity is a prerequisite for the use of some data analysis methods, such as hierarchical clustering or Principal Component Analysis (PCA). The regularized log transformation is based on a GLM (Generalized Linear Model) on the counts and has the same goal as a VST but is more robust in the case when the size factors vary widely.

Figure 6 shows the dendrogram obtained from log transformed 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.

Figure 6: Sample clustering based on normalized data.

Figure 6: Sample clustering based on normalized data.

Another way of visualizing the experiment variability is to look at the first principal components of the PCA, as shown on the figure 7. On this figure, the first principal component (PC1) is expected to separate samples from the different biological conditions, meaning that the biological variability is the main source of variance in the data.

Figure 7: First two components of a Principal Component Analysis, with percentages of variance associated with each axis.

Figure 7: First two components of a Principal Component Analysis, with percentages of variance associated with each axis.

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.

Figure 7b: Multidimensional scaling plot of the samples.

Figure 7b: Multidimensional scaling plot of the samples.

3 Normalization

Normalization aims at correcting systematic technical biases in the data, in order to make read counts comparable across samples. The normalization proposed by DESeq2 relies on the hypothesis that most features are not differentially expressed. It computes a scaling factor for each sample. Normalized read counts are obtained by dividing raw read counts by the scaling factor associated with the sample they belong to. Scaling factors around 1 mean (almost) no normalization is performed. Scaling factors lower than 1 will produce normalized counts higher than raw ones, and the other way around. Two options are available to compute scaling factors: locfunc=“median” (default) or locfunc=“shorth”. Here, the normalization was performed using the median.

The histograms (figure 8) can help to validate the choice of the normalization parameter (“median” or “shorth”). Under the hypothesis that most features are not differentially expressed, each size factor represented by a red line is expected to be close to the mode of the distribution of the counts divided by their geometric means across samples.

Figure 8: Diagnostic of the estimation of the size factors.

Figure 8: Diagnostic of the estimation of the size factors.

The figure 9 shows that the scaling factors of DESeq2 and the total count normalization factors may not perform similarly.

Figure 9: Plot of the estimated size factors and the total number of reads per sample.

Figure 9: Plot of the estimated size factors and the total number of reads per sample.

Boxplots are often used as a qualitative measure of 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 10 shows boxplots of raw (left) and normalized (right) data respectively.

Figure 10: Boxplots of raw (left) and normalized (right) read counts.

Figure 10: Boxplots of raw (left) and normalized (right) read counts.

4 Differential analysis

4.1 Modelisation

DESeq2 aims at fitting one linear model per feature. For this project, the design used is counts ~ drug 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.

4.2 Outlier detection

Model outliers are features for which at least one sample seems unrelated to the experimental or study design. For every feature and for every sample, the Cook’s distance [@cook1977] reflects how the sample matches the model. A large value of the Cook’s distance indicates an outlier count and p-values are not computed for the corresponding feature.

4.3 Dispersions estimation

The DESeq2 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. Its purpose is to determine the shape of the mean-variance relationship. The default is to apply a GLM (Generalized Linear Model) based method (fitType=“parametric”), which can handle complex designs but may not converge in some cases. The alternative is to use fitType=“local” as described in the original paper [@Anders2010]. The parameter used for this project is fitType= local. Then, DESeq2 imposes a Cox Reid-adjusted profile likelihood maximization [@cox1897 and McCarthy, 2012] and uses the maximum (MAP) of the dispersion [Wu, 2013].

Figure 11: Dispersion estimates (left) and diagnostic of log-normality (right).

Figure 11: Dispersion estimates (left) and diagnostic of log-normality (right).

The left panel on figure 11 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 counts). The red dots show the mean-variance relationship function (fitted dispersion value) as estimated by the model. The blue dots are the final estimates from the maximum a posteriori and are used to perform the statistical test. Blue circles (if any) point out dispersion outliers. These are features with a very high empirical variance (computed from observed counts). These high dispersion values fall far from the model estimation. For these features, the statistical test is based on the empirical variance in order to be more conservative than with the MAP dispersion. These features will have low chance to be declared significant. The figure on the right panel allows to check the hypothesis of log-normality of the dispersions.

4.4 Statistical test for differential expression

Once the dispersion estimation and the model fitting have been done, DESeq2 can perform the statistical testing. Figure 12 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.

Figure 12: Distribution(s) of raw p-values.

Figure 12: Distribution(s) of raw p-values.

4.5 Independent filtering

DESeq2 can perform an independent filtering to increase the detection power of differentially expressed features at the same experiment-wide type I error. Since features with very low counts are not likely to see significant differences typically due to high dispersion, it defines a threshold on the mean of the normalized counts irrespective of the biological condition. This procedure is independent because the information about the variables in the design formula is not used [@Love2014].

4.6 Final results

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 BH p-value adjustment was performed [@BH1995 and BY2001] and the level of controlled false positive rate was set to 0.05.

Figure 13 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 13: MA-plot(s) of each comparison. Red dots represent significantly differentially expressed features.

Figure 13: MA-plot(s) of each comparison. Red dots represent significantly differentially expressed features.

Figure 14 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.

Figure 14: Volcano plot(s) of each comparison. Red dots represent significantly differentially expressed features.

Figure 14: Volcano plot(s) of each comparison. Red dots represent significantly differentially expressed features.

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:

  • TestVsRef.complete.txt contains results for all the features;
  • TestVsRef.up.txt contains results for significantly up-regulated features. Features are ordered from the most significant adjusted p-value to the less significant one;
  • TestVsRef.down.txt contains results for significantly down-regulated features. Features are ordered from the most significant adjusted p-value to the less significant one.

These files contain the following columns:

  • Id: unique feature identifier;
  • sampleName: raw counts per sample;
  • norm.sampleName: rounded normalized counts per sample;
  • baseMean: base mean over all samples;
  • ctrl, low and high: means (rounded) of normalized counts of the biological conditions;
  • FoldChange: fold change of expression, calculated as \(2^{\log_2(\text{FC})}\);
  • log2FoldChange: \(\log_2(\text{FC})\) as estimated by the GLM model. It reflects the differential expression between Test and Ref and can be interpreted as \(\log_2(\frac{\text{Test}}{\text{Ref}})\). If this value is:
    • around 0: the feature expression is similar in both conditions;
    • positive: the feature is up-regulated (\(\text{Test} > \text{Ref}\));
    • negative: the feature is down-regulated (\(\text{Test} < \text{Ref}\));
  • pvalue: raw p-value from the statistical test;
  • padj: adjusted p-value on which the cut-off \(\alpha\) is applied;
  • dispGeneEst: dispersion parameter estimated from feature counts (i.e. black dots on figure 11);
  • dispFit: dispersion parameter estimated from the model (i.e. red dots on figure 11);
  • dispMAP: dispersion parameter estimated from the Maximum A Posteriori model;
  • dispersion: final dispersion parameter used to perform the test (i.e. blue dots and circles on figure 11);
  • betaConv: convergence of the coefficients of the model (TRUE or FALSE);
  • maxCooks: maximum Cook’s distance of the feature.

5 R session information and parameters

6 R session information and parameters

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.

  • R version 3.4.4 (2018-03-15), x86_64-redhat-linux-gnu
  • Locale: LC_CTYPE=en_US.UTF-8, LC_NUMERIC=C, LC_TIME=en_US.UTF-8, LC_COLLATE=en_US.UTF-8, LC_MONETARY=en_US.UTF-8, LC_MESSAGES=en_US.UTF-8, LC_PAPER=en_US.UTF-8, LC_NAME=C, LC_ADDRESS=C, LC_TELEPHONE=C, LC_MEASUREMENT=en_US.UTF-8, LC_IDENTIFICATION=C
  • Running under: CentOS release 6.9 (Final)
  • Matrix products: default
  • BLAS: /usr/lib64/R/lib/libRblas.so
  • LAPACK: /usr/lib64/R/lib/libRlapack.so
  • Base packages: base, datasets, graphics, grDevices, methods, parallel, stats, stats4, utils
  • Other packages: Biobase 2.38.0, BiocGenerics 0.24.0, BiocParallel 1.12.0, DelayedArray 0.4.1, DESeq2 1.18.1, dplyr 0.7.6, genefilter 1.60.0, GenomeInfoDb 1.14.0, GenomicRanges 1.30.3, ggplot2 3.0.0, IRanges 2.12.0, knitr 1.20, matrixStats 0.53.1, mgcv 1.8-23, nlme 3.1-137, RColorBrewer 1.1-2, S4Vectors 0.16.0, SummarizedExperiment 1.8.1, sva 3.26.0, xtable 1.8-2
  • Loaded via a namespace (and not attached): acepack 1.4.1, annotate 1.56.2, AnnotationDbi 1.40.0, assertthat 0.2.0, backports 1.1.2, base64enc 0.1-3, bindr 0.1.1, bindrcpp 0.2.2, bit 1.1-12, bit64 0.9-7, bitops 1.0-6, blob 1.1.1, checkmate 1.8.5, cluster 2.0.7-1, colorspace 1.3-2, compiler 3.4.4, crayon 1.3.4, data.table 1.11.4, DBI 1.0.0, digest 0.6.15, edgeR 3.12.1, evaluate 0.10.1, foreign 0.8-70, Formula 1.2-3, geneplotter 1.56.0, GenomeInfoDbData 1.0.0, ggrepel 0.8.0, glue 1.3.0, grid 3.4.4, gridExtra 2.3, gtable 0.2.0, highr 0.6, Hmisc 4.1-1, htmlTable 1.12, htmltools 0.3.6, htmlwidgets 1.2, lattice 0.20-35, latticeExtra 0.6-28, lazyeval 0.2.1, limma 3.34.9, locfit 1.5-9.1, magrittr 1.5, Matrix 1.2-14, memoise 1.1.0, munsell 0.4.3, nnet 7.3-12, pillar 1.3.0, pkgconfig 2.0.1, plyr 1.8.4, purrr 0.2.4, R6 2.2.2, Rcpp 0.12.18, RCurl 1.95-4.11, rlang 0.2.1, rmarkdown 1.10, rpart 4.1-13, rprojroot 1.3-2, RSQLite 2.1.1, rstudioapi 0.7, SARTools 1.5.1, scales 0.5.0, splines 3.4.4, stringi 1.2.4, stringr 1.3.1, survival 2.42-3, tibble 1.4.2, tidyselect 0.2.4, tools 3.4.4, withr 2.1.2, XML 3.98-1.13, XVector 0.18.0, yaml 2.2.0, zlibbioc 1.24.0

Parameter values used for this analysis are:

  • workDir: /home/ggiaever/RProjects/2018_chemogenomics_db_norge
  • projectName: aug8_maleRAT
  • author: gg
  • targetFile: /home/ggiaever/RProjects/2018_chemogenomics_db_norge
  • rawDir: raw
  • featuresToRemove: NULL
  • varInt: drug
  • condRef: ctrl
  • batch: NULL
  • alpha: 0.05
  • pAdjustMethod: BH
  • cpmCutoff: 1
  • gene.selection: pairwise
  • normalizationMethod: TMM
  • colors: #FF8C007F, #1E90FF7F, #32CD327F, #0000807F, #FF69B47F, #8B668B7F, #0000FF7F, #EE00EE7F, #9370DB7F, #B222227F, #6E8B3D7F, #3A5FCD7F

7 Bibliography