Leonardo Collado-Torres1,2, Abhinav Nellore3,4,5, Andrew E Jaffe1,2,6,7. 1. Lieber Institute for Brain Development, Baltimore, MD, 21205, USA. 2. Center for Computational Biology, Johns Hopkins University, Baltimore, MD, 21205 , USA. 3. Department of Biomedical Engineering, Oregon Health and Science University, Portland, OR, 97239, USA. 4. Department of Surgery, Oregon Health and Science University, Portland, OR, 97239, USA. 5. Computational Biology Program, Oregon Health and Science University, Portland, OR, 97239, USA. 6. Department of Biostatistics, Johns Hopkins Bloomberg School of Public Health, Baltimore, MD, 21205, USA. 7. Department of Mental Health, Johns Hopkins Bloomberg School of Public Health, Baltimore, MD, 21205, USA.
Abstract
The recount2 resource is composed of over 70,000 uniformly processed human RNA-seq samples spanning TCGA and SRA, including GTEx. The processed data can be accessed via the recount2 website and the recount Bioconductor package. This workflow explains in detail how to use the recount package and how to integrate it with other Bioconductor packages for several analyses that can be carried out with the recount2 resource. In particular, we describe how the coverage count matrices were computed in recount2 as well as different ways of obtaining public metadata, which can facilitate downstream analyses. Step-by-step directions show how to do a gene-level differential expression analysis, visualize base-level genome coverage data, and perform an analyses at multiple feature levels. This workflow thus provides further information to understand the data in recount2 and a compendium of R code to use the data.
The recount2 resource is composed of over 70,000 uniformly processed human RNA-seq samples spanning TCGA and SRA, including GTEx. The processed data can be accessed via the recount2 website and the recount Bioconductor package. This workflow explains in detail how to use the recount package and how to integrate it with other Bioconductor packages for several analyses that can be carried out with the recount2 resource. In particular, we describe how the coverage count matrices were computed in recount2 as well as different ways of obtaining public metadata, which can facilitate downstream analyses. Step-by-step directions show how to do a gene-level differential expression analysis, visualize base-level genome coverage data, and perform an analyses at multiple feature levels. This workflow thus provides further information to understand the data in recount2 and a compendium of R code to use the data.
RNA sequencing (RNA-seq) is now the most widely used high-throughput assay for measuring gene expression. In a typical RNA-seq experiment, several million reads are sequenced per sample. The reads are often aligned to the reference genome using a splice-aware aligner to identify where reads originated. Resulting alignment files are then used to compute count matrices for several analyses such as identifying differentially expressed genes. The Bioconductor project
[1] has many contributed packages that specialize in analyzing this type of data and previous workflows have explained how to use them
[2–
4]. Initial steps are typically focused on generating the count matrices. Some pre-computed matrices have been made available via the ReCount project
[5] or Bioconductor Experiment data packages such as the
airway dataset
[6]. The pre-computed count matrices in ReCount have been useful to RNA-seq methods developers and to researchers seeking to avoid the computationally intensive process of creating these matrices. In the years since ReCount was published, hundreds of new RNA-seq projects have been carried out, and researchers have shared the data publicly.We recently uniformly processed over 70,000 publicly available human RNA-seq samples, and made the data available via the recount2 resource at
jhubiostatistics.shinyapps.io/recount/
[7]. Samples in recount2 are grouped by project (over 2,000) originating from the Sequence Read Archive, the Genotype-Tissue Expression study (GTEx) and the Cancer Genome Atlas (TCGA). The processed data can be accessed via the
recount Bioconductor package available at
bioconductor.org/packages/recount. Together, recount2 and the
recount Bioconductor package should be considered a successor to ReCount.Due to space constraints, the recount2 publication
[7] did not cover how to use the
recount package and other useful information for carrying out analyses with recount2 data. We describe how the count matrices in recount2 were generated. We also review the R code necessary for using the recount2 data, whose details are important because some of this code involves multiple Bioconductor packages and changing default options. We further show: a) how to augment metadata that comes with datasets with metadata learned from natural language processing of associated papers as well as expression data b) how to perform differential expression analyses, and c) how to visualize the base-pair data available from recount2.
Analysis of RNA-seq data available at recount2
recount2 overview
The recount2 resource provides expression data summarized at different feature levels to enable novel cross-study analyses. Generally when investigators use the term
expression, they think about gene expression. But more information can be extracted from RNA-seq data. Once RNA-seq reads have been aligned to the reference genome it is possible to determine the number of aligned reads overlapping each base-pair resulting in the genome base-pair coverage curve as shown in
Figure 1. In the example shown in
Figure 1, most of the reads overlap known exons from a gene. Those reads can be used to compute a count matrix at the exon or gene feature levels. Some reads span exon-exon junctions (jx) and while most match the annotation, some do not (jx 3 and 4). An exon-exon junction count matrix can be used to identify differentially expressed junctions, which can show which isoforms are differentially expressed given sufficient coverage. For example, junctions 2 and 5 are unique to isoform 2, while junction 6 is unique to isoform 1. The genome base-pair coverage data can be used with
derfinder
[8] to identify expressed regions; some of these could be unannotated exons, which together with the exon-exon junction data could help establish new isoforms.
Figure 1.
Overview of the data available in recount2.
Reads (pink boxes) aligned to the reference genome can be used to compute a base-pair coverage curve and identify exon-exon junctions (split reads). Gene and exon count matrices are generated using annotation information providing the gene (green boxes) and exon (blue boxes) coordinates together with the base-level coverage curve. The reads spanning exon-exon junctions (jx) are used to compute a third count matrix that might include unannotated junctions (jx 3 and 4). Without using annotation information, expressed regions (orange box) can be determined from the base-level coverage curve to then construct data-driven count matrices.
Overview of the data available in recount2.
Reads (pink boxes) aligned to the reference genome can be used to compute a base-pair coverage curve and identify exon-exon junctions (split reads). Gene and exon count matrices are generated using annotation information providing the gene (green boxes) and exon (blue boxes) coordinates together with the base-level coverage curve. The reads spanning exon-exon junctions (jx) are used to compute a third count matrix that might include unannotated junctions (jx 3 and 4). Without using annotation information, expressed regions (orange box) can be determined from the base-level coverage curve to then construct data-driven count matrices.recount2 provides gene, exon, and exon-exon junction count matrices both in text format and
RangedSummarizedExperiment objects (rse)
[9] as shown in
Figure 2. These rse objects provide information about the expression features (for example gene IDs) and the samples. In this workflow we will explain how to add metadata to the rse objects in recount2 in order to ask biological questions. recount2 also provides coverage data in the form of bigWig files. All four features can be accessed with the
recount Bioconductor package
[7].
recount also allows sending queries to
snaptron
[10] to search for specific exon-exon junctions.
Figure 2.
recount2 provides coverage count matrices in RangedSummarizedExperiment (rse) objects.
Once the rse object has been downloaded and loaded into R, the feature information is accessed with rowRanges(rse) (blue box), the counts with assays(rse)$counts (pink box) and the sample metadata with colData(rse) (green box). The sample metadata can be expanded using add_predictions(rse) (orange box) or with custom code (brown box) matching by a unique sample identifier such as the SRA Run ID. The rse object is inside the purple box and matching data is highlighted in each box.
recount2 provides coverage count matrices in RangedSummarizedExperiment (rse) objects.
Once the rse object has been downloaded and loaded into R, the feature information is accessed with rowRanges(rse) (blue box), the counts with assays(rse)$counts (pink box) and the sample metadata with colData(rse) (green box). The sample metadata can be expanded using add_predictions(rse) (orange box) or with custom code (brown box) matching by a unique sample identifier such as the SRA Run ID. The rse object is inside the purple box and matching data is highlighted in each box.
Packages used in the workflow
In this workflow we will use several Bioconductor packages. To reproduce the entirety of this workflow, install the packages using the following code after installing R 3.4.x from CRAN in order to use Bioconductor version 3.5 or newer.Once they are installed, load all the packages with the following code.
Coverage counts provided by recount2
The most accessible features are the gene, exon and exon-exon junction count matrices. This section explains them in greater detail.
Figure 3 shows 16 RNA-seq reads, each 3 base-pairs long, and a reference genome.
Figure 3.
RNA-seq starting data.
16 RNA-seq un-aligned RNA-seq reads 3 base-pairs long are shown (pink boxes) alongside a reference genome that is 16 base-pairs long (white box).
RNA-seq starting data.
16 RNA-seq un-aligned RNA-seq reads 3 base-pairs long are shown (pink boxes) alongside a reference genome that is 16 base-pairs long (white box).Reads in the recount2 resource were aligned with the splice-aware Rail-RNA aligner
[11].
Figure 4 shows the reads aligned to the reference genome. Some of the reads are split as they span an exon-exon junction. Two of the reads were soft clipped meaning that just a portion of the reads aligned (top left in purple).
Figure 4.
Aligned RNA-seq reads.
Spice-aware RNA-seq aligners such as Rail-RNA are able to find the coordinates to which the reads map, even if they span exon-exon junctions (connected boxes). Rail-RNA soft clips some reads (purple boxes with rough edges) such that a portion of these reads align to the reference genome.
Aligned RNA-seq reads.
Spice-aware RNA-seq aligners such as Rail-RNA are able to find the coordinates to which the reads map, even if they span exon-exon junctions (connected boxes). Rail-RNA soft clips some reads (purple boxes with rough edges) such that a portion of these reads align to the reference genome.In order to compute the gene and exon count matrices we first have to process the annotation, which for recount2 is Gencode v25 (CHR regions) with hg38 coordinates. Although
recount can generate count matrices for other annotations using hg38 coordinates.
Figure 5 shows two isoforms for a gene composed of 3 different exons.
Figure 5.
Gene annotation.
A single gene with two isoforms composed by three distinct exons (blue boxes) is illustrated. Exons 1 and 3 share the first five base-pairs while exon 2 is common to both isoforms.
Gene annotation.
A single gene with two isoforms composed by three distinct exons (blue boxes) is illustrated. Exons 1 and 3 share the first five base-pairs while exon 2 is common to both isoforms.The coverage curve is at base-pair resolution so if we are interested in gene counts we have to be careful not to double count base-pairs 1 through 5 that are shared by exons 1 and 3 (
Figure 5). Using the function
disjoin() from
GenomicRanges
[12] we identified the distinct exonic sequences (disjoint exons). The following code defines the exon coordinates that match
Figure 5 and the resulting disjoint exons for our example gene. The resulting disjoint exons are shown in
Figure 6.
Figure 6.
Disjoint exons.
Windows of distinct exonic sequence for the example gene. Disjoint exons 1 and 2 form exon 1.
Disjoint exons.
Windows of distinct exonic sequence for the example gene. Disjoint exons 1 and 2 form exon 1.Now that we have disjoint exons, we can compute the base-pair coverage for each of them as shown in
Figure 7. That is, for each base-pair that corresponds to exonic sequence, we compute the number of reads overlapping that given base-pair. For example, the first base-pair is covered by 3 different reads and it does not matter whether the reads themselves were soft clipped. Not all reads or bases of a read contribute information to this step, as some do not overlap known exonic sequence (light pink in
Figure 7).
Figure 7.
Base-pair coverage counting for exonic base-pairs.
At each exonic base-pair we compute the number of reads overlapping that given base-pair. The first base (orange arrow) has 3 reads overlapping that base-pair. Base-pair 11 has a coverage of 3 but does not overlap known exonic sequence, so that information is not used for the gene and exon count matrices (grey arrow). If a read partially overlaps exonic sequence, only the portion that overlaps is used in the computation (see right most read).
Base-pair coverage counting for exonic base-pairs.
At each exonic base-pair we compute the number of reads overlapping that given base-pair. The first base (orange arrow) has 3 reads overlapping that base-pair. Base-pair 11 has a coverage of 3 but does not overlap known exonic sequence, so that information is not used for the gene and exon count matrices (grey arrow). If a read partially overlaps exonic sequence, only the portion that overlaps is used in the computation (see right most read).With base-pair coverage for the exonic sequences computed, the coverage count for each distinct exon is simply the sum of the base-pair coverage for each base in a given distinct exon. For example, the coverage count for disjoint exon 2 is 2 + 2 + 3 = 7 as shown in
Figure 8. The gene coverage count is then
coverage
where
n is the number of exonic base-pairs for the gene and is equal to the sum of the coverage counts for its disjoint exons as shown in
Figure 8.
Figure 8.
Exon and gene coverage counts.
The coverage counts for each disjoint exon are the sum of the base-pair coverage. The gene coverage count is the sum of the disjoint exons coverage counts.
Exon and gene coverage counts.
The coverage counts for each disjoint exon are the sum of the base-pair coverage. The gene coverage count is the sum of the disjoint exons coverage counts.For the exons, recount2 provides the disjoint exons coverage count matrix. It is possible to reconstruct the exon coverage count matrix by summing the coverage count for the disjoint exons that compose each exon. For example, the coverage count for exon 1 would be the sum of the coverage counts for disjoint exons 1 and 2, that is 19 + 7 = 26. Some methods might assume that double counting of the shared base-pairs was performed while others assume or recommend the opposite.
Scaling coverage counts
The coverage counts described previously are the ones actually included in the rse objects in recount2 instead of typical read count matrices. This is an important difference to keep in mind as most methods were developed for read count matrices. Part of the sample metadata available from recount2 includes the read length and number of mapped reads. Given a target library size (40 million reads by default), the coverage counts in recount2 can be scaled to read counts for a given library size as shown in
Equation (1). Note that the resulting scaled read counts are not necessarily integers so it might be necessary to round them if a differential expression (DE) method assumes integer data.From
Figure 4 we know that Rail-RNA soft clipped some reads, so a more precise measure than the denominator of
Equation (1) is the area under coverage (AUC) which is the sum of the coverage for all base-pairs of the genome, regardless of the annotation as shown in
Figure 9. Without soft clipping reads, the AUC would be equal to the number of reads mapped multiplied by the read length. So for our example gene, the scaled counts for a library size of 20 reads would be
and in general calculated with
Equation (2). The following code shows how to compute the AUC given a set of aligned reads and reproduce a portion of
Figure 9.
Figure 9.
Area under coverage (AUC).
The area under coverage is the sum of the base-pair coverage for all positions in the genome regardless of the annotation. It is the area under the base-level coverage curve shown as the light blue area under the pink curve.
Area under coverage (AUC).
The area under coverage is the sum of the base-pair coverage for all positions in the genome regardless of the annotation. It is the area under the base-level coverage curve shown as the light blue area under the pink curve.The
recount function
scale_counts() computes the scaled read counts for a target library size of 40 million reads and we highly recommend using it before doing other analyses. The following code shows how to use
scale_counts() and that the resulting read counts per sample can be lower than the target size (40 million). This happens when not all mapped reads overlap known exonic base-pairs of the genome. In our example, the gene has a scaled count of 16 reads for a library size of 20 reads, meaning that 4 reads did not overlap exonic sequences.
Enriching the annotation
Data in recount2 can be used for annotation-agnostic analyses and enriching the known annotation. Just like exon and gene coverage count matrices, recount2 provides exon-exon junction count matrices. These matrices can be used to identify new isoforms (
Figure 10) or identify differentially expressed isoforms. For example, exon-exon junctions 2, 5 and 6 in
Figure 1 are only present in one annotated isoform.
Snaptron
[10] allows programatic and high-level queries of the exon-exon junction information and its graphical user interface is specially useful for visualizing this data. Inside R, the
recount function
snaptron_query() can be used for searching specific exon-exon junctions in recount2.
Figure 10.
Exon-exon junctions go beyond the annotation.
Reads spanning exon-exon junctions are highlighted and compared against the annotation. Three of them match the annotated junctions, but one (blue and orange read) spans an unannotated exon-exon junction with the left end matching the annotation and the right end hinting at a possible new isoform for this gene (blue and orange isoform).
Exon-exon junctions go beyond the annotation.
Reads spanning exon-exon junctions are highlighted and compared against the annotation. Three of them match the annotated junctions, but one (blue and orange read) spans an unannotated exon-exon junction with the left end matching the annotation and the right end hinting at a possible new isoform for this gene (blue and orange isoform).The base-pair coverage data from recount2 can be used together with
derfinder
[8] to identify expressed regions of the genome, providing another annotation-agnostic analysis of the expression data. Using the function
expressed_regions() we can identify regions of expression based on a given data set in recount2. These regions might overlap known exons but can also provide information about intron retention events (
Figure 11), improve detection of exon boundaries (
Figure 12), and help identify new exons (
Figure 1) or expressed sequences in intergenic regions. Using
coverage_matrix() we can compute a coverage matrix based on the expressed regions or another set of genomic intervals. The resulting matrix can then be used for a DE analysis, just like the exon, gene and exon-exon junction matrices.
Figure 11.
Intron retention events.
Some reads might align with known intronic segments of the genome and provide information for exploring intron retention events (pink read). Some might support an intron retention event or a new isoform when coupled with exon-exon junction data (orange read).
Figure 12.
Exon boundaries.
Reads that go beyond the known exon boundaries can inform us of whether the annotated boundaries are correct or if there was a run-off transcription event.
Intron retention events.
Some reads might align with known intronic segments of the genome and provide information for exploring intron retention events (pink read). Some might support an intron retention event or a new isoform when coupled with exon-exon junction data (orange read).
Exon boundaries.
Reads that go beyond the known exon boundaries can inform us of whether the annotated boundaries are correct or if there was a run-off transcription event.
Gene level analysis
Having reviewed how the coverage counts in recount2 were produced, we can now do a DE analysis. We will use data from 72 individuals spanning the human lifespan, split into 6 age groups with SRA accession SRP045638
[13]. The function
download_study() requires a SRA accession which can be found using
abstract_search().
download_study() can then be used to download the gene coverage count data as well as other expression features. The files are saved in a directory named after the SRA accession, in this case SRP045638.The coverage count matrices are provided as
RangedSummarizedExperiment objects (rse)
[9]. These objects store information at the feature level, the samples and the actual count matrix as shown in
Figure 1 of Love
et al., 2016
[3].
Figure 2 shows the actual rse objects provided by recount2 and how to access the different portions of the data. Using a unique sample ID such as the SRA Run ID it is possible to expand the sample metadata. This can be done using the predicted phenotype provided by
add_predictions()
[14], pulling information from GEO via
find_geo() and
geo_characteristics(), or with custom code.
Metadata
Using the
colData() function we can access sample metadata. More information on these metadata is provided in the
Supplementary material of the recount2 paper
[7], and we provide a brief review here. The rse objects for SRA data sets include 21 columns with mostly technical information. The GTEx and TCGA rse objects include additional metadata as available from the raw sources. In particular, we compiled metadata for GTEx using the v6 phenotype information available at
, and we put together a large table of TCGA case and sample information by combining information accumulated across
Seven Bridges’ Cancer Genomics Cloud and
TCGAbiolinks
[15].Technical variables Several of these technical variables include the number of reads as reported by SRA, the actual number of reads Rail-RNA was able to download (which might be lower in some cases), the number of reads mapped by Rail-RNA, whether the sample is paired-end or not, the coverage AUC and the average read length (times 2 for paired-end samples). Note that the sample with SRA Run ID SRR2071341 has about 240.8 million reads as reported by SRA, while it has 120.4 million spots reported in
; that is because it is a paired-end sample (2 reads per spot). These details are important for those interested in writing alternative scaling functions to
scale_counts().Biological information Other metadata variables included provide more biological information, such as the
SHARQ beta tissue and cell type predictions, which are based on processing the abstract of papers. This information is available for some of the SRA projects.For some data sets we were able to find the GEO accession IDs, which we then used to create the
title and
characteristics variables. If present, the
characteristics information can be used to create additional metadata variables by parsing the
CharacterList in which it is stored. Since the input is free text, sometimes more than one type of wording is used to describe the same information, meaning that we might have to process that information in order to build a more convenient variable, such as a factor vector.As shown in
Figure 2, we can expand the biological metadata information by adding predictions based on RNA-seq data
[14]. The predictions include information about sex, sample source (cell line vs tissue), tissue and the sequencing strategy used. To add the predictions, simply use the function
add_predictions() to expand the
colData() slot.Adding more information Ultimately, more sample metadata information could be available elsewhere, which can be useful for analyses. This information might be provided in the paper describing the data, the SRA Run Selector or other sources. As shown in
Figure 2, it is possible to append information to the
colData() slot as long as there is a unique sample identifier such as the SRA Run ID.For our example use case, project SRP045638 has a few extra biologically relevant variables via the SRA Run selector
https://trace.ncbi.nlm.nih.gov/Traces/study/?acc=SRP045638. We can download that information into text file named
SraRunTable.txt by default, then load it into R, sort it appropriately and then append it to the
colData() slot. Below we do so for the SRP045638 project.Since we have the predicted sex as well as the reported sex via the SRA Run Selector, we can check whether they match.
DE setup
Now that we have all the metadata available we can perform a DE analysis. The original study for project SRP045638
[13] looked at differences between 6 age groups: prenatal, infant, child, teen, adult and late life. The following code creates these six age groups.Most of the DE signal from the original study was between the prenatal and postnatal samples. To simplify the analysis, we will focus on this comparison.As we saw earlier in
Figure 9, it is important to scale the coverage counts to read counts. To highlight the fact that we scaled the counts, we will use a new object name and delete the previous one. However, in practice we would simply overwrite the
rse object with the output of
scale_counts(rse).Having scaled the counts, we then filter out genes that are lowly expressed and extract the count matrix.
DE analysis
Now that we have scaled the counts, there are multiple DE packages we could use, as described elsewhere
[2,
3]. Since we have 12 samples per group, which is a moderate number, we will use
limma-voom
[16] due to its speed. The model we use tests for DE between prenatal and postnatal samples adjusting for sex and RIN, which is a measure of quality of the input sample. We check the data with multi-dimensional scaling plots (
Figure 13 and
Figure 14) as well as the mean-variance plot (
Figure 15). In a real use case we might have to explore the results with different models and perform sensitivity analyses.
Figure 13.
Multi-dimensional scaling plot of the gene level data by age group.
Figure 14.
Multi-dimensional scaling plot of the gene level data by sex.
Figure 15.
voom mean-variance plot of the gene level data.
Having run the DE analysis, we can explore some of the top results either with an MA plot (
Figure 16) and a volcano plot
Figure (17). Both reveal very strong and widespread DE signal.
Figure 16.
MA plot of the gene level data.
Testing for prenatal and postnatal DE adjusting for sex and RIN.
Figure 17.
Volcano plot of the gene level data.
Testing for prenatal and postnatal DE adjusting for sex and RIN.
MA plot of the gene level data.
Testing for prenatal and postnatal DE adjusting for sex and RIN.
Volcano plot of the gene level data.
Testing for prenatal and postnatal DE adjusting for sex and RIN.
DE report
Now that we have the DE results, we can use some of the tools with the biocView
ReportWriting to create a report. One of them is
regionReport
[17], which can create reports from
DESeq2
[18] and
edgeR
[19] results. It can also handle
limma-voom
[16] results by making them look like
DESeq2 results. To do so, we need to extract the relevant information from the
limma-voom objects using
topTable() and build DESeqDataSet and DESeqResults objects as shown below. A similar conversion is needed to use
ideal
[20], which is another package in the
ReportWriting biocView category.Having converted our
limma-voom results to
DESeq2 results, we can now create the report, which should open automatically in a browser.If the report doesn’t open automatically, we can open it with
browseURL(). A pre-computed version is available as
Supplementary File 1.
GO enrichment
Using
clusterProfiler
[21] we can then perform several enrichment analyses using the Ensembl gene IDs. Here we show how to perform an enrichment analysis using the biological process ontology (
Figure 18).
Figure 18.
Biological processes enriched in the DE genes.
Several other analyses can be performed with the resulting list of differentially expressed genes as described previously
[2,
3], although that is beyond the scope of this workflow.
Other features
As described in
Figure 1, recount2 provides data for expression features beyond genes. In this section we perform a DE analysis using exon data as well as the base-pair resolution information.
Exon and exon-exon junctions
The exon and exon-exon junction coverage count matrices are similar to the gene level one and can also be downloaded with
download_study(). However, these coverage count matrices are much larger than the gene one. Aggressive filtering of lowly expressed exons or exon-exon junctions can reduce the matrix dimensions if this impacts the performance of the DE software used.Below we repeat the gene level analysis for the disjoint exon data. We first download the exon data, add the expanded metadata we constructed for the gene analysis, explore the data (
Figure 19), and then perform the DE analysis using
limma-voom.
Figure 19.
voom mean-variance plot of the exon level data.
Just like at the gene level, we see many exons differentially expressed between prenatal and postnatal samples (
Figure 20). As a first step to integrate the results from the two features, we can compare the list of genes that are differentially expressed versus the genes that have at least one exon differentially expressed.
Figure 20.
Volcano plot of the exon level data.
Testing for prenatal and postnatal DE adjusting for sex and RIN.
Volcano plot of the exon level data.
Testing for prenatal and postnatal DE adjusting for sex and RIN.Not all differentially expressed genes have differentially expressed exons. Moreover, genes with at least one differentially expressed exon are not necessarily differentially expressed (
Figure 21). This is in line with what was described in Figure 2B of Soneson
et al., 2015
[22].
Figure 21.
Venn diagram of the overlap between DE genes and genes with at least one exon DE.
This was just a quick example of how we can perform DE analyses at the gene and exon feature levels. We envision that more involved pipelines could be developed that leverage both feature levels, such as in Jaffe et al., 2017
[23]. For instance, we could focus on the differentially expressed genes with at least one differentially expressed exon, and compare the direction of the DE signal versus the gene level signal as shown in
Figure 22.
Figure 22.
Log fold change (FC) for DE genes compared against the most extreme exon log FC among exons that are DE for the given gene.
The fold change for most exons shown in
Figure 22 agrees with the gene level fold change. However, some of them have opposite directions and could be interesting to study further.
Base-pair resolution
recount2 provides bigWig coverage files (unscaled) for all samples, as well as a mean bigWig coverage file per project where each sample was scaled to 40 million 100 base-pair reads. The mean bigWig files are exactly what is needed to start an
expressed regions analysis with
derfinder
[8].
recount provides two related functions:
expressed_regions() which is used to define a set of regions based on the mean bigWig file for a given project, and coverage_matrix() which based on a set of regions builds a count
coverage matrix in a
RangedSummarizedExperiment object just like the ones that are provided for genes and exons. Both functions ultimately use
import.bw() from
rtracklayer
[24] which currently is not supported on Windows machines. While this presents a portability disadvantage, on the other side it allows reading portions of bigWig files from the web without having to fully download them.
download_study() with
type = "mean" or
type = "samples" can be used to download the bigWig files, which we recommend doing when working with them extensively.For illustrative purposes, we will use the data from chromosome 21 for the SRP045638 project. First, we obtain the expressed regions using a relatively high mean cutoff of 5. We then filter the regions to keep only the ones longer than 100 base-pairs to shorten the time needed for running
coverage_matrix().Now that we have a set of regions to work with, we proceed to build a
RangedSummarizedExperiment object with the coverage counts, add the expanded metadata we built for the gene level, and scale the counts. Note that
coverage_matrix() scales the base-pair coverage counts by default, which we turn off in order to use use
scale_counts().Now that we have a scaled count matrix for the expressed regions, we can proceed with the DE analysis just like we did at the gene and exon feature levels (
Figure 23,
Figure 24,
Figure 25, and
Figure 26).
Figure 23.
Multi-dimensional scaling plot of the expressed regions level data by age group.
Figure 24.
Multi-dimensional scaling plot of the expressed regions level data by sex.
Figure 25.
voom mean-variance plot of the expressed regions level data.
Figure 26.
Volcano plot of the expressed regions level data.
Testing for prenatal and postnatal DE adjusting for sex and RIN.
Volcano plot of the expressed regions level data.
Testing for prenatal and postnatal DE adjusting for sex and RIN.Having identified the differentially expressed regions (DERs), we can sort all regions by their adjusted p-value.
Visualize regions
Since the DERs do not necessarily match the annotation, it is important to visualize them. The code for visualizing DERs can easily be adapted to visualize other regions. Although, the width and number of the regions will influence the computing resources needed to make the plots.Because the unscaled bigWig files are available in recount2, several visualization packages can be used such as
epivizr
[25],
wiggleplotr
[26] and
derfinderPlot
[8]. With all of them it is important to remember to scale the data except when visualizing the mean bigWig file for a given project.First, we need to get the list of URLs for the bigWig files. We can either manually construct them or search them inside the
recount_url table.We visualize the DERs using
derfinderPlot, similar to what was done in the original publication
[13]. However, we first add a little padding to the regions: 100 base-pairs on each side.Next, we obtain the base-pair coverage data for each DER and scale the data to a library size of 40 million 100 base-pair reads, using the coverage AUC information we have in the metadata.The function
plotRegionCoverage() requires several pieces of annotation information for the plots that use a TxDb object. For recount2 we used Gencode v25 hg38’s annotation, which means that we need to process it manually instead of using a pre-computed TxDb package.To create a TxDb object for Gencode v25, first we need to import the data. Since we are working only with chromosome 21 for this example, we can subset it. Next we need to add the relevant chromosome information. Some of the annotation functions we use can handle Entrez or Ensembl IDs, but not Gencode IDs. So we will make sure that we are working with Ensembl IDs before finally creating the Gencode v25 TxDb object.Now that we have a TxDb object for Gencode v25 on hg38 coordinates, we can use
bumphunter’s
[27] annotation functions for annotating the original 10 regions we were working with. Since we are using Ensembl instead of Entrez gene IDs, we need to pass this information to
annotateTranscripts(). Otherwise, the function will fail to retrieve the gene symbols.The final piece we need to run
plotRegionCoverage() is information about which base-pairs are exonic, intronic, etc. This is done via the
annotateRegions() function in
derfinder, which itself requires prior processing of the TxDb information by
makeGenomicState().We can finally use
plotRegionCoverage() to visualize the top 10 regions coloring by whether they are prenatal or postnatal samples. Known exons are shown in dark blue, introns in light blue.In these plots we can see that some DERs match known exons (
Figure 28,
Figure 34,
Figure 36), some are longer than known exons (
Figure 27,
Figure 33,
Figure 35), and others are exon fragments (
Figure 29–
Figure 32) which could be due to the cutoff used. Note that
Figure 33 could be shorter than a known exon due to a coverage dip.
Figure 28.
Base-pair resolution plot of differentially expressed region 2.
Figure 34.
Base-pair resolution plot of differentially expressed region 8.
Figure 36.
Base-pair resolution plot of differentially expressed region 10.
Figure 27.
Base-pair resolution plot of differentially expressed region 1.
Figure 33.
Base-pair resolution plot of differentially expressed region 7.
Figure 35.
Base-pair resolution plot of differentially expressed region 9.
Figure 29.
Base-pair resolution plot of differentially expressed region 3.
Figure 32.
Base-pair resolution plot of differentially expressed region 6.
Summary
In this workflow we described in detail the available data in recount2, how the coverage count matrices were computed, the metadata included in recount2 and how to get new phenotypic information from other sources. We showed how to perform a DE analysis at the gene and exon levels as well as use an annotation-agnostic approach. Finally, we explained how to visualize the base-pair information for a given set of regions. This workflow constitutes a strong basis to leverage the recount2 data for human RNA-seq analyses.The authors present a workflow for working with the 70,000 processed RNA-seq datasets that form the recount2 project, using R, and seek to expand on the details presented in the original recount2 publication by describing how coverage count matrices were computed in recount2.I'm always slightly confused about the point of these workflow papers - this kind of example workflow information seems better suited to the R package vignettes, and for this reason I sometimes find them awkward to review. In addition, a considerably similar set of example workflow information (albeit somewhat less well described) has already been published in the supplementary information for the original recount2 publication from the same authors (doi:10.1038/nbt.3838, specifically see Supp. Text & Figures, and Supp. Notes 3 & 4)
[1]. Indeed, the supplementary info there goes further than this workflow in describing how to compare results from recount2 across several studies (Supp. Note 5). Personally I found the workflow example here somewhat convoluted and difficult to follow in places but I am sure the community will find it useful in helping to use the recount2 resource and perhaps the nature of such an example workflow presented on real data for a package such as this.Happily, however, the authors also present substantially new and more detailed information in a few key areas. In particular the description of how the recount2 read coverage matrices are computed is useful and interesting and the example showing how to supplement the project metadata with additional information is useful.Specific Comments:1. I don't really like the use of pseudo-maths equations for Eq1 & 2 - I'd like to see the words replaced with algebraic variables with meanings explained in the text.2. The scaled read counts are not the same as the actual mapping read counts that are typically required by downstream DE tools (which then typically apply their own appropriate normalization to these numbers). I'd like to see recount2 provide the actual mapping read count for features in addition to the scaled read counts. That said (and if I’m understanding things correctly) the manuscript here is a description of what the format of the recount2 data is and that has already been published - so I'm not expecting this to be changed.3. I really don't understand the sentence: "Not all differentially expressed genes have differentially expressed exons." Surely this is the definition of a DE gene?? I absolutely agree that "Moreover, genes with at least one differentially expressed exon are not necessarily differentially expressed" - differential transcript usage is a prime example of where this can happen - but if a gene is DE I'm pretty sure that it must have a DE exon.4. I don't see the need for figs 28-36 - a single example of the plot type should be sufficient I think for an example workflow.5. It would be nice if recount2 could also provide information at the transcript level. Have the authors considered augmenting recount2 with salmon quantifications for all the data? (big job and more of a 'feature request' really).I have read this submission. I believe that I have an appropriate level of expertise to confirm that it is of an acceptable scientific standard.The manuscript by Collado-Torres
et al. provides a workflow to analyze public RNA-seq data using ‘recount2’. Recount2 is a resource that provides whole-genome coverage tracks for more than 70,000 RNA-seq experiments. The accompanying R/Bioconductor package ‘recount’ gives programmatic access to download read counts per gene and to estimate read counts for genomic regions of interest. In an RNA-seq pipeline, processing raw data into the formats available through recount2 involves the most time-consuming steps. Thus, recount2 will save many researchers a lot of time.The workflow describes how to programmatically access data from recount2 and describes different analyses that can be done using these data. However, I think the authors needs improve and clarify some aspects of the workflow, which I summarize below.Major comments:The authors use the formula in equation 1 to scale read counts. While I agree that the read counts will be approximately equal to the sum of the coverage divided by the read length, it was not clear why the additional rescaling is needed. I recommend that the authors include a more extensive justification. Also, if the experiments were paired-end, wouldn’t this formula be counting reads instead of sequenced RNA fragments (i.e. double counting)?The section “Enriching annotation” describes several functions and analyses but does not provide any code or examples. Currently, since it is incomplete, it is more distracting than informative. I suggest that the authors either expand this section and add code or drop it.I don’t understand the biological question behind a differential expression analysis at the exon level. Could the authors clarify what the biological question is? If the aim is to find differential exon usage, wouldn’t it be better to use either DEXSeq, DRIMseq, or similar packages that are specifically designed for this analysis?Minor comments:The first three sentences of the introduction need references.The sentence “generally, when investigators use the term expression, they refer to gene expression” is not entirely true. For example, developmental or cell biologists often interpret “expression” as protein expression.For full reproducibility, it would be useful to download the data within R using the SRAdb package instead of downloading it manually.The code that creates the age groups is too complicated (4 embedded ‘ifelse’ statements). I have submitted a pull request with a simplified version of it (
https://github.com/LieberInstitute/recountWorkflow/pull/1).Figures 13 and 14 could be merged into a single plot, using shapes and colors to distinguish the different annotations. The same holds for figures 23 and 24.I have read this submission. I believe that I have an appropriate level of expertise to confirm that it is of an acceptable scientific standard, however I have significant reservations, as outlined above.The authors present a workflow that describes how to analyze the datasets available through the Recount2 project with Bioconductor. Since many of the state-of-the-art methods for the analysis of RNA-seq data are implemented in R and available through the Bioconductor project, this contribution is an important resource for researchers interested in reanalyzing the impressive amount of data that the authors have processed in the Recount2 project.I have a few comments that hopefully will help improve the workflow.1. I was a bit confused by the rationale of the scaled coverage counts. And especially on the need for a target library size and the use of scaled counts. Wouldn't it be simpler to divide the coverage by read length (without rescaling)? Wouldn't that result in the actual reads mapped to each region (exon, gene, ...)? I understand that for the derfinder analysis, some rescaling is needed for normalization purposes, but for more "classic" analysis (such as gene- or exon-level differential expression) where the counts are normalized later in the workflow, wouldn't starting from 'coverage/readlength' be a more sensible choice?2. Sex prediction. This is a really interesting part of the analysis, even though it's not the focus of this workflow. It would be interesting to get the authors' opinion of how to best use this feature on real analyses. For instance, are the 8 misclassified samples likely to be false positives from the classifiers or are they mislabeled samples? What is the recommendation of the authors in such cases? Should these samples be discarded or is there any diagnostics that can be run to make sure that the quality of these samples is not compromised?3. I think that the authors should give more details on the design matrix. For instance, why did they decide to include RIN and sex? Why is it important to include these variables in the model? More generally, the workflow lacks details on the limma pipeline. I understand that this is not the focus of the authors' work, but it may be confusing for beginners that don't have a direct experience with limma or voom. The authors could for instance refer the reader to the limma workflow
[1] for details.4. Similarly, there is a lack of details on the GO enrichment analysis. Since there are many types of gene-set enrichment analysis, a paragraph could be added with more details and perhaps some references to explain what enrichment analysis is and what types of hypotheses are tested.5. One important advantage of exon-level differential expression is that it can be used to infer alternative splicing. This can be done with the functions 'diffSplice()' and 'topSplice()' in limma or with the DEXSeq package. It would be nice to showcase these functions or at least to mention that they exist.6. Is the annotation in Recount2 stable? Or is it constantly updated when a new version of Gencode is released? If the former, it might make sense to package the 'gencode_v25_hg38_txdb' object that the authors create in the workflow so that each user does not have to create it from scratch every time.Minor comments:- The authors use throughout the paper 'assays(rse)$counts' to access the counts of the 'rse' object. Although this is correct, a clearer and more concise way is 'assay(rse)' (or 'assay(rse, "counts")' if the authors want to explicitly state the name of the assay).- Section "Coverage counts provided by recount2". The authors say "Although recount can generate count matrices for other annota- tions using hg38 coordinates. " But they never say how this can be done. It would be good to add a paragraph on how to do that (which I presume involves creating an alternative txdb object).I have read this submission. I believe that I have an appropriate level of expertise to confirm that it is of an acceptable scientific standard, however I have significant reservations, as outlined above.
Authors: Andrew E Jaffe; Richard E Straub; Joo Heon Shin; Ran Tao; Yuan Gao; Leonardo Collado-Torres; Tony Kam-Thong; Hualin S Xi; Jie Quan; Qiang Chen; Carlo Colantuoni; William S Ulrich; Brady J Maher; Amy Deep-Soboslay; Alan J Cross; Nicholas J Brandon; Jeffrey T Leek; Thomas M Hyde; Joel E Kleinman; Daniel R Weinberger Journal: Nat Neurosci Date: 2018-07-26 Impact factor: 24.884
Authors: Michael Lawrence; Wolfgang Huber; Hervé Pagès; Patrick Aboyoun; Marc Carlson; Robert Gentleman; Martin T Morgan; Vincent J Carey Journal: PLoS Comput Biol Date: 2013-08-08 Impact factor: 4.475
Authors: Blanca E Himes; Xiaofeng Jiang; Peter Wagner; Ruoxi Hu; Qiyu Wang; Barbara Klanderman; Reid M Whitaker; Qingling Duan; Jessica Lasky-Su; Christina Nikolos; William Jester; Martin Johnson; Reynold A Panettieri; Kelan G Tantisira; Scott T Weiss; Quan Lu Journal: PLoS One Date: 2014-06-13 Impact factor: 3.240
Authors: Ashish H Shah; Robert Suter; Pavan Gudoor; Tara T Doucet-O'Hare; Vasileios Stathias; Iahn Cajigas; Macarena de la Fuente; Vaidya Govindarajan; Alexis A Morell; Daniel G Eichberg; Evan Luther; Victor M Lu; John Heiss; Ricardo J Komotar; Michael E Ivan; Stephan Schurer; Mark R Gilbert; Nagi G Ayad Journal: Neurooncol Adv Date: 2021-12-31
Authors: Eddie Luidy Imada; Diego Fernando Sanchez; Ben Langmead; Luigi Marchionni; Leonardo Collado-Torres; Christopher Wilks; Tejasvi Matam; Wikum Dinalankara; Aleksey Stupnikov; Francisco Lobo-Pereira; Chi-Wai Yip; Kayoko Yasuzawa; Naoto Kondo; Masayoshi Itoh; Harukazu Suzuki; Takeya Kasukawa; Chung-Chau Hon; Michiel J L de Hoon; Jay W Shin; Piero Carninci; Andrew E Jaffe; Jeffrey T Leek; Alexander Favorov; Gloria R Franco Journal: Genome Res Date: 2020-02-20 Impact factor: 9.043
Authors: Mohamed Mounir; Marta Lucchetta; Tiago C Silva; Catharina Olsen; Gianluca Bontempi; Xi Chen; Houtan Noushmehr; Antonio Colaprico; Elena Papaleo Journal: PLoS Comput Biol Date: 2019-03-05 Impact factor: 4.475
Authors: Patrick Deelen; Sipko van Dam; Johanna C Herkert; Juha M Karjalainen; Harm Brugge; Kristin M Abbott; Cleo C van Diemen; Paul A van der Zwaag; Erica H Gerkes; Evelien Zonneveld-Huijssoon; Jelkje J Boer-Bergsma; Pytrik Folkertsma; Tessa Gillett; K Joeri van der Velde; Roan Kanninga; Peter C van den Akker; Sabrina Z Jan; Edgar T Hoorntje; Wouter P Te Rijdt; Yvonne J Vos; Jan D H Jongbloed; Conny M A van Ravenswaaij-Arts; Richard Sinke; Birgit Sikkema-Raddatz; Wilhelmina S Kerstjens-Frederikse; Morris A Swertz; Lude Franke Journal: Nat Commun Date: 2019-06-28 Impact factor: 14.919
Authors: Tim O Nieuwenhuis; Stephanie Y Yang; Rohan X Verma; Vamsee Pillalamarri; Dan E Arking; Avi Z Rosenberg; Matthew N McCall; Marc K Halushka Journal: Nat Commun Date: 2020-04-22 Impact factor: 14.919