recount3 quick start guide

    collapse = TRUE,
    comment = "#>"
## Track time spent on making the vignette
startTime <- Sys.time()

## Bib setup

## Load knitcitations with a clean bibliography
cite_options(hyperlink = "to.doc", citation_format = "text", style = "html")
# Note links won't show for now due to the following issue

## Write bibliography information
bib <- c(
    R = citation(),
    BiocFileCache = citation("BiocFileCache"),
    BiocStyle = citation("BiocStyle"),
    knitcitations = citation("knitcitations"),
    knitr = citation("knitr")[3],
    recount3 = citation("recount3")[1],
    recount3paper = citation("recount3")[2],
    rmarkdown = citation("rmarkdown"),
    sessioninfo = citation("sessioninfo"),
    SummarizedExperiment = RefManageR::BibEntry(
        bibtype = "manual",
        key = "SummarizedExperiment",
        author = "Martin Morgan and Valerie Obenchain and Jim Hester and Hervé Pagès",
        title = "SummarizedExperiment: SummarizedExperiment container",
        year = 2019, doi = "10.18129/B9.bioc.SummarizedExperiment"
    testthat = citation("testthat"),
    covr = citation("covr"),
    RefManageR = citation("RefManageR"),
    pryr = citation("pryr"),
    interactiveDisplayBase = citation("interactiveDisplayBase"),
    rtracklayer = citation("rtracklayer"),
    S4Vectors = citation("S4Vectors"),
    RCurl = citation("RCurl"),
    data.table = citation("data.table"),
    R.utils = citation("R.utils"),
    Matrix = citation("Matrix"),
    GenomicRanges = citation("GenomicRanges"),
    recount2paper = citation("recount")[1],
    recount2workflow = citation("recount")[2],
    recount1paper = citation("recount")[5],
    recountbrain = citation("recount")[6],
    recount2fantom = citation("recount")[7],
    bioconductor2015 = RefManageR::BibEntry(
        bibtype = "Article",
        key = "bioconductor2015",
        author = "Wolfgang Huber and Vincent J Carey and Robert Gentleman and Simon Anders and Marc Carlson and Benilton S Carvalho and Hector Corrada Bravo and Sean Davis and Laurent Gatto and Thomas Girke and Raphael Gottardo and Florian Hahne and Kasper D Hansen and Rafael A Irizarry and Michael Lawrence and Michael I Love and James MacDonald and Valerie Obenchain and Andrzej K Oles and Hervé Pagès and Alejandro Reyes and Paul Shannon and Gordon K Smyth and Dan Tenenbaum and Levi Waldron and Martin Morgan",
        title = "Orchestrating high-throughput genomic analysis with Bioconductor",
        year = 2015, doi = "10.1038/nmeth.3252",
        journal = "Nature Methods",
        journaltitle = "Nat Methods"

write.bibtex(bib, file = "quickstartRef.bib")


The r Biocpkg('recount3') R/Bioconductor package is an interface to the recount3 project. recount3 provides uniformly processed RNA-seq data for hundreds of thousands of samples. The R package makes it possible to easily retrieve this data in standard Bioconductor containers, including RangedSummarizedExperiment. The sections on terminology and available data contains more detail on those subjects.

The main documentation website for all the recount3-related projects is available at Please check that website for more information about how this R/Bioconductor package and other tools are related to each other.


Installing recount3

R is an open-source statistical environment which can be easily modified to enhance its functionality via packages. r Biocpkg('recount3') is a R package available via the Bioconductor repository for packages. R can be installed on any operating system from CRAN after which you can install r Biocpkg('recount3') by using the following commands in your R session:

if (!requireNamespace("BiocManager", quietly = TRUE)) {


## Check that you have a valid Bioconductor installation

You can install the development version from GitHub with:


Required knowledge

r Biocpkg('recount3') is based on many other packages and in particular in those that have implemented the infrastructure needed for dealing with RNA-seq data. A r Biocpkg('recount3') user will benefit from being familiar with r Biocpkg('SummarizedExperiment') to understand the objects r Biocpkg('recount3') generates. It might also prove to be highly beneficial to check the

If you are asking yourself the question "Where do I start using Bioconductor?" you might be interested in this blog post.

Asking for help

As package developers, we try to explain clearly how to use our packages and in which order to use the functions. But R and Bioconductor have a steep learning curve so it is critical to learn where to ask for help. The blog post quoted above mentions some but we would like to highlight the Bioconductor support site as the main resource for getting help: remember to use the recount3 tag and check the older posts. Other alternatives are available such as creating GitHub issues and tweeting. However, please note that if you want to receive help you should adhere to the posting guidelines. It is particularly critical that you provide a small reproducible example and your session information so package developers can track down the source of the error.

Citing r Biocpkg('recount3')

We hope that r Biocpkg('recount3') will be useful for your research. Please use the following information to cite the package and the overall approach. Thank you!

## Citation info

Quick start

After installing r Biocpkg('recount3') r citep(bib[['recount3paper']]), we need to load the package, which will automatically load the required dependencies.

## Load recount3 R package

If you have identified a study of interest and want to access the gene level expression data, use create_rse() as shown below. create_rse() has arguments that will allow you to specify the annotation of interest for the given organism, and whether you want to download gene, exon or exon-exon junction expression data.

## Find all available human projects
human_projects <- available_projects()

## Find the project you are interested in,
## here we use SRP009615 as an example
proj_info <- subset(
    project == "SRP009615" & project_type == "data_sources"

## Create a RangedSummarizedExperiment (RSE) object at the gene level
rse_gene_SRP009615 <- create_rse(proj_info)

## Explore that RSE object

You can also interactively choose your study of interest

## Note that you can interactively explore the available projects
proj_info_interactive <- interactiveDisplayBase::display(human_projects)

## Select a single row, then hit "send". The following code checks this.
stopifnot(nrow(proj_info_interactive) == 1)

## Then create the RSE object
rse_gene_interactive <- create_rse(proj_info_interactive)

Once you have a RSE file, you can use transform_counts() to transform the raw coverage counts.

## Once you have your RSE object, you can transform the raw coverage
## base-pair coverage counts using transform_counts().
## For RPKM, TPM or read outputs, check the details in transform_counts().
assay(rse_gene_SRP009615, "counts") <- transform_counts(rse_gene_SRP009615)

Now you are ready to continue with downstream analysis software.

r Biocpkg('recount3') also supports accessing the BigWig raw coverage files as well as specific study or collection sample metadata. Please continue to the users guide for more detailed information.

Users guide

r Biocpkg('recount3') r citep(bib[['recount3paper']]) provides an interface for downloading the recount3 raw files and building Bioconductor-friendly R objects r citep(list(bib[["bioconductor2015"]], bib[["SummarizedExperiment"]])) that can be used with many downstream packages. To achieve this, the raw data is organized by study from a specific data source. That same study can be a part of one or more collections, which is a manually curated set of studies with collection-specific sample metadata (see the Data source vs collection for details). To get started with r Biocpkg('recount3'), you will need to identify the ID for the study of interest from either human or mouse for a particular annotation of interest. Once you have identified study, data source or collection, and annotation, r Biocpkg('recount3') can be used to build a RangedSummarizedExperiment object r citep(bib[["SummarizedExperiment"]]) for either gene, exon or exon-exon junction expression feature data. Furthermore, r Biocpkg('recount3') provides access to the coverage BigWig files that can be quantified for custom set of genomic regions using r Biocpkg('megadepth'). Furthermore, r Biocpkg('snapcount') allows fast-queries for custom exon-exon junctions and other custom input.

Available data

r Biocpkg('recount3') provides access to most of the recount3 raw files in a form that is R/Bioconductor-friendly. As a summary of the data provided by the recount3 project (Figure \@ref(fig:recountWorkflowFig1)), the main data files provided are:



Here we describe some of the common terminology and acronyms used throughout the rest of the documentation. r Biocpkg('recount3') enables creating RangedSummarizedExperiment objects that contain expression quantitative data (Figure \@ref(fig:recountWorkflowFig2)). As a quick overview, some of the main terms are:


r Biocpkg('recount3') enables accessing data from multiple reference organisms from public projects. To identify these projects, the key terms we use are:

Many of the recount3 raw files include three columns that are used to identify each sample and that allow merging the data across these files. Those are:

Find a study

In order to access data from r Biocpkg('recount3'), the first step is to identify a project that you are interested in working with. Most of the project IDs are the ones you can find on the Sequence Read Archive (SRA). For example, SRP009615 which we use in the examples in this vignette.The exceptions are the Genotype-Expression and The Cancer Genome Atlas human studies, commonly known as GTEx and TCGA. Both GTEx and TCGA are available in r Biocpkg('recount3') by tissue.

Through available_projects()

While you can use external websites to find a study of interest, you can also use available_projects() to list the projects that are available in r Biocpkg('recount3') as shown below. This will return a data.frame() object that lists the unique project IDs.

human_projects <- available_projects()

## Select a study of interest
project_info <- subset(
    project == "SRP009615" & project_type == "data_sources"

Let's say that you are interested in the GTEx projects, you could then filter by file_source. We'll focus only on those entries that from a data source, and not from a collection for now.

subset(human_projects, file_source == "gtex" & project_type == "data_sources")

Note that one of the projects for GTEx is STUDY_NA, that's because in r Biocpkg('recount3') we processed all GTEx samples, including some that had no tissue assigned and were not used by the GTEx consortium.

If you prefer to view the list of available studies interactively, you can do so with r Biocpkg('interactiveDisplayBase') as shown below. You'll want to assign the output of interactiveDisplayBase::display() to an object so you can save your selections and use them later. By doing so, you'll be able to select a study of interest, and save the information for later use after you hit the "send" button.

## Alternatively, interactively browse the human projects,
## select one, then hit send
selected_study <- interactiveDisplayBase::display(human_projects)

Ultimately, we need three pieces of information in order to download a specific dataset from r Biocpkg('recount3'). Those are:

project_info[, c("project", "organism", "project_home")]

Available annotations

Now that we have identified our project of interest, the next step is to choose an annotation that we want to work with. The annotation files available depend on the organism. To facilitate finding the specific names we use in r Biocpkg('recount3'), we have provided the function annotation_options().


The main sources are:

In r Biocpkg('recount3') we have provided multiple annotations, which is different from r Biocpkg('recount') (recount2 R/Bioconductor package) where all files were computed using GENCODE version 25. However, in both, you might be interested in quantifying your annotation of interest, as described further below in the BigWig files section.

Build a RSE

Once you have chosen an annotation and a project, you can now build a RangedSummarizedExperiment object r citep(list(bib[["bioconductor2015"]], bib[["SummarizedExperiment"]])). To do so, we recommend using the create_rse() function as shown below for GENCODE v26 (the default annotation for human files). create_rse() internally uses several other r Biocpkg('recount3') functions for locating the necessary raw files, downloading them, reading them, and building the RangedSummarizedExperiment (RSE) object. create_rse() shows several status message updates that you can silence with suppressMessages(create_rse()) if you want to.

## Create a RSE object at the gene level
rse_gene_SRP009615 <- create_rse(project_info)

## Explore the resulting RSE gene object

Explore the RSE

Because the RSE object is created at run-time in r Biocpkg('recount3'), unlike the static files provided by r Biocpkg('recount') for recount2, create_rse() stores information about how this RSE object was made under metadata(). This information is useful in case you share the RSE object and someone else wants to be able to re-make the object with the latest data ^[This new design allows us to couple the expression data with metadata on the fly, as well as have flexibility in case we uncover an error in the files.].

## Information about how this RSE object was made

The SRP009615 study was composed of 12 samples, for which we have 63,856 genes in GENCODE v26. The annotation-specific information is available through rowRanges() as shown below with the gene_id column used to identify genes in each of the annotations ^[Although ERCC and SIRV are technically not genes.].

## Number of genes by number of samples

## Information about the genes

Sample metadata

The sample metadata provided in r Biocpkg('recount3') is much more extensive than the one in r Biocpkg('recount') for the recount2 project because it's includes for quality control metrics, predictions, and information used internally by r Biocpkg('recount3') functions such as create_rse(). All individual metadata tables include the columns rail_id, external_id and study which are used for merging the different tables. Finally, *BigWigUrl provides the URL for the BigWig file for the given sample.

## Sample metadata
recount3_cols <- colnames(colData(rse_gene_SRP009615))

## How many are there?

## View the first few ones

## Group them by source
recount3_cols_groups <- table(gsub("\\..*", "", recount3_cols))

## Common sources and number of columns per source
recount3_cols_groups[recount3_cols_groups > 1]

## Unique columns
recount3_cols_groups[recount3_cols_groups == 1]
## Explore them all

For studies from SRA, we can further extract the SRA attributes using expand_sra_attributes() as shown below.

rse_gene_SRP009615_expanded <-
colData(rse_gene_SRP009615_expanded)[, ncol(colData(rse_gene_SRP009615)):ncol(colData(rse_gene_SRP009615_expanded))]


The counts in r Biocpkg('recount3') are raw base-pair coverage counts, similar to those in r Biocpkg('recount'). To further understand them, check the r Biocpkg('recountWorkflow') DOI 10.12688/f1000research.12223.1. To highlight that these are raw base-pair coverage counts, they are stored in the "raw_counts" assay


Using transform_counts() you can scale the counts and assign them to the "counts" assays slot to use them in downstream packages such as r Biocpkg('DESeq2') and r Biocpkg('limma').

## Once you have your RSE object, you can transform the raw coverage
## base-pair coverage counts using transform_counts().
## For RPKM, TPM or read outputs, check the details in transform_counts().
assay(rse_gene_SRP009615, "counts") <- transform_counts(rse_gene_SRP009615)

Just like with r Biocpkg('recount') for recount2, you can transform the raw base-pair coverage counts r citep(bib[["recount2workflow"]]) to read counts with compute_read_counts(), RPKM with recount::getRPKM() or TPM values with recount::getTPM(). Check transform_counts() from r Biocpkg('recount3') for more details.


r Biocpkg('recount3') provides an interface to raw files that go beyond gene counts, as well as other features you might be interested in. For instance, you might want to study expression at the exon expression level instead of gene. To do so, use the type argument in create_rse() as shown below.

## Create a RSE object at the exon level
rse_exon_SRP009615 <- create_rse(
    type = "exon"

## Explore the resulting RSE exon object

## Explore the object

Each exon is shown in this output, so, you might have to filter the exons of interest. Unlike in recount2, these are actual exons and not disjoint exons ^[Check the BigWig files section further below.].

## Exon annotation information

## Exon ids are repeated because a given exon can be part of
## more than one transcript

Because there are many more exons than genes, this type of analysis uses more computational resources. Thus, for some large projects you might need to use a high performance computing environment. To help you proceed with caution, create_rse() shows how many features and samples it's trying to access. So if you get an out of memory error, you'll know why that happened.

## Check how much memory the gene and exon RSE objects use

Exon-exon junctions

In r Biocpkg('recount3') we have also provided the option to create RSE files for exon-exon junctions. Unlike the gene/exon RSE files, only the junctions present in a given project are included in the files, so you'll have to be more careful when merging exon-exon junction RSE files. Furthermore, these are actual read counts and not raw base-pair counts. Given the sparsity of the data, the counts are provided using a sparse matrix object from r CRANpkg("Matrix"). Thus exon-exon junction files can be less memory demanding than the exon RSE files.

## Create a RSE object at the exon-exon junction level
rse_jxn_SRP009615 <- create_rse(
    type = "jxn"

## Explore the resulting RSE exon-exon junctions object

## Exon-exon junction information

## Memory used

BigWig files

Internally we used GenomicFeatures::exonicParts() when processing all annotations in r Biocpkg('recount3') instead of GenomicRanges::disjoin() that was used in recount2. We then re-assembled the counts for each exon/gene to create the count files provided in r Biocpkg('recount3'). However, you might want to exclude the overlapping exonic parts from the counts. If that's the case or if you are interested in specific regions of the hg38/mm10 genomes, you might want to access the coverage BigWig files.

## BigWig file names
## The full URL is stored in BigWigUrl

These BigWig files can be accessed using from R, or other tools such as bwtool that we've used in the past ^[For example in recount.bwtool .]. Using them, you can compute a coverage matrix for a given set of regions.

One new software we developed is r Biocpkg("megadepth") for which we have provided an R/Bioconductor package interface. r Biocpkg("megadepth") is faster at accessing BigWig files and is the software we used internally for generating the recount3 data. r Biocpkg("megadepth") provides convenient to use functions for quantifying a set of regions, which might be of interest for co-expression analyses where double counting exonic parts can be problematic.

You can also use r Biocpkg("derfinder") and r Biocpkg("derfinderPlot") if you are interested in visualizing the base-pair coverage data for a specific region using these BigWig coverage files.

Local files

r Biocpkg('recount3') depends on r Biocpkg('BiocFileCache') r citep(bib[['BiocFileCache']]) for organizing the raw files and caching them, such that if you use the same file more than once, you only have to download it once. r Biocpkg('BiocFileCache') will automatically update the file if it detects that the file has changed in the source

If you want to inspect which files you have downloaded or even delete them, them you'll want to use recount3_cache_files() and recount3_cache_rm() as illustrated below.

## List the URLs of the recount3 data that you have downloaded
## Delete the recount3 files from your cache

## Check that no files are listed

Your own mirror

r Biocpkg('recount3') functions such as create_rse() have a recount3_url argument that can be changed to point to a mirror or to a path in your computing system. This argument enables using r Biocpkg('recount3') with data stored in other locations, or even generated using the same processing pipeline that was used for r Biocpkg('recount3') but for your own/private data.

The main documentation website documents how the raw files should be organized in your mirror or for your own data. You can inspect the structure of the data by checking the internals of locate_url() and locate_url_ann(). Both functions can be used to get the full list of URLs. In addition, for a given mirror, available_projects() will show the local data sources and collections. Finally, file_retrieve() won't cache the data if it detects that the data already exists in the local disk.

In particular, this functionality can be useful if you want to access the data at IDIES using SciServer Compute.

Teams involved

The ReCount family involves the following teams:

Project history

To clarify the relationship between the R/Bioconductor packages and the phases of ReCount r citep(bib[["recount1paper"]]) please check the table below:

| Year | Phase | Main references | R/Bioconductor | | --- | --- | --- | --- | | 2011 | ReCount | DOI: 10.1186/1471-2105-12-449 | none | | 2017 | recount2 | DOI: 10.1038/nbt.3838 10.12688/f1000research.12223.1 | r Biocpkg('recount') | | 2020 | recount3 | DOI: TODO | r Biocpkg('recount3') |

Other related tools

The ReCount team has worked on several software solutions and projects that complement each other and enable you to re-use public RNA-seq data. Another Bioconductor package that you might be highly interested in is r Biocpkg("snapcount"), which allows you to use the Snaptron web services. In particular, r Biocpkg("snapcount") is best for queries over a particular subset of genes or intervals across all or most of the samples in recount2/Snaptron.

We remind you that the main documentation website for all the recount3-related projects is available at Please check that website for more information about how this R/Bioconductor package and other tools are related to each other.

Thank you!

P.S. An alternative version of this vignette is available that was made using r CRANpkg("pkgdown").


The r Biocpkg('recount3') package r citep(bib[['recount3']]) was made possible thanks to:

Code for creating the vignette

## Create the vignette
system.time(render("recount3-quickstart.Rmd", "BiocStyle::html_document"))

## Extract the R code
knit("recount3-quickstart.Rmd", tangle = TRUE)
## Clean up

Date the vignette was generated.

## Date the vignette was generated

Wallclock time spent generating the vignette.

## Processing time in seconds
totalTime <- diff(c(startTime, Sys.time()))
round(totalTime, digits = 3)

R session information.

## Session info
options(width = 120)


This vignette was generated using r Biocpkg('BiocStyle') r citep(bib[['BiocStyle']]) with r CRANpkg('knitr') r citep(bib[['knitr']]) and r CRANpkg('rmarkdown') r citep(bib[['rmarkdown']]) running behind the scenes.

Citations made with r CRANpkg('knitcitations') r citep(bib[['knitcitations']]).

## Print bibliography

Try the recount3 package in your browser

Any scripts or data that you put into this service are public.

recount3 documentation built on Feb. 13, 2021, 2 a.m.