1 Overview

The 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 recount.bio. Please check that website for more information about how this R/Bioconductor package and other tools are related to each other.

2 Basics

2.1 Installing recount3

R is an open-source statistical environment which can be easily modified to enhance its functionality via packages. 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 recount3 by using the following commands in your R session:

if (!requireNamespace("BiocManager", quietly = TRUE)) {
    install.packages("BiocManager")
}

BiocManager::install("recount3")

## Check that you have a valid Bioconductor installation
BiocManager::valid()

You can install the development version from GitHub with:

BiocManager::install("LieberInstitute/recount3")

2.2 Required knowledge

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 recount3 user will benefit from being familiar with SummarizedExperiment to understand the objects 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.

2.3 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.

2.4 Citing recount3

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

## Citation info
citation("recount3")
#> To cite package 'recount3' in publications use:
#> 
#>   Collado-Torres L (2023). _Explore and download data from the recount3
#>   project_. doi:10.18129/B9.bioc.recount3
#>   <https://doi.org/10.18129/B9.bioc.recount3>,
#>   https://github.com/LieberInstitute/recount3 - R package version
#>   1.10.2, <http://www.bioconductor.org/packages/recount3>.
#> 
#>   Wilks C, Zheng SC, Chen FY, Charles R, Solomon B, Ling JP, Imada EL,
#>   Zhang D, Joseph L, Leek JT, Jaffe AE, Nellore A, Collado-Torres L,
#>   Hansen KD, Langmead B (2021). "recount3: summaries and queries for
#>   large-scale RNA-seq expression and splicing." _Genome Biol_.
#>   doi:10.1186/s13059-021-02533-6
#>   <https://doi.org/10.1186/s13059-021-02533-6>,
#>   <https://doi.org/10.1186/s13059-021-02533-6>.
#> 
#> To see these entries in BibTeX format, use 'print(<citation>,
#> bibtex=TRUE)', 'toBibtex(.)', or set
#> 'options(citation.bibtex.max=999)'.

3 Quick start

After installing recount3 (Wilks, Zheng, Chen, Charles et al., 2021), we need to load the package, which will automatically load the required dependencies.

## Load recount3 R package
library("recount3")

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()
#> 2023-05-07 18:00:51.140427 caching file sra.recount_project.MD.gz.
#> 2023-05-07 18:00:51.580698 caching file gtex.recount_project.MD.gz.
#> 2023-05-07 18:00:51.839908 caching file tcga.recount_project.MD.gz.

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

## Create a RangedSummarizedExperiment (RSE) object at the gene level
rse_gene_SRP009615 <- create_rse(proj_info)
#> 2023-05-07 18:00:58.196031 downloading and reading the metadata.
#> 2023-05-07 18:00:58.598048 caching file sra.sra.SRP009615.MD.gz.
#> 2023-05-07 18:00:58.830809 caching file sra.recount_project.SRP009615.MD.gz.
#> 2023-05-07 18:00:59.081815 caching file sra.recount_qc.SRP009615.MD.gz.
#> 2023-05-07 18:00:59.356195 caching file sra.recount_seq_qc.SRP009615.MD.gz.
#> 2023-05-07 18:00:59.597217 caching file sra.recount_pred.SRP009615.MD.gz.
#> 2023-05-07 18:00:59.738518 downloading and reading the feature information.
#> 2023-05-07 18:00:59.945209 caching file human.gene_sums.G026.gtf.gz.
#> 2023-05-07 18:01:00.589058 downloading and reading the counts: 12 samples across 63856 features.
#> 2023-05-07 18:01:00.74989 caching file sra.gene_sums.SRP009615.G026.gz.
#> 2023-05-07 18:01:01.061018 constructing the RangedSummarizedExperiment (rse) object.

## Explore that RSE object
rse_gene_SRP009615
#> class: RangedSummarizedExperiment 
#> dim: 63856 12 
#> metadata(8): time_created recount3_version ... annotation recount3_url
#> assays(1): raw_counts
#> rownames(63856): ENSG00000278704.1 ENSG00000277400.1 ...
#>   ENSG00000182484.15_PAR_Y ENSG00000227159.8_PAR_Y
#> rowData names(10): source type ... havana_gene tag
#> colnames(12): SRR387777 SRR387778 ... SRR389077 SRR389078
#> colData names(175): rail_id external_id ...
#>   recount_pred.curated.cell_line BigWigURL

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.

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.

4 Users guide

recount3 (Wilks, Zheng, Chen, Charles et al., 2021) provides an interface for downloading the recount3 raw files and building Bioconductor-friendly R objects (Huber, Carey, Gentleman, Anders et al., 2015; Morgan, Obenchain, Hester, and Pagès, 2019) 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 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, recount3 can be used to build a RangedSummarizedExperiment object (Morgan, Obenchain, Hester, and Pagès, 2019) for either gene, exon or exon-exon junction expression feature data. Furthermore, recount3 provides access to the coverage BigWig files that can be quantified for custom set of genomic regions using megadepth. Furthermore, snapcount allows fast-queries for custom exon-exon junctions and other custom input.

4.1 Available data

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 1), the main data files provided are:

  • metadata: information about the samples in recount3, which can come from sources such as the Sequence Read Archive as well as recount3 quality metrics.
  • gene: RNA expression data quantified at the gene annotation level. This information is provided for multiple annotations that are organism-specific. Similar to the recount2 project, the recount3 project provides counts at the base-pair coverage level (Collado-Torres, Nellore, and Jaffe, 2017).
  • exon: RNA expression data quantified at the exon annotation level. The data is also annotation-specific and the counts are also at the base-pair coverage level.
  • exon-exon junctions: RNA expression data quantified at the exon-exon junction level. This data is annotation-agnostic (it does not depend on the annotation) and is variable across each study because different sets of exon-exon junctions are measured in each study.
  • bigWig: RNA expression data in raw format at the base-pair coverage resolution. This raw data when coupled with a given annotation can be used to generate gene and exon level counts using software such as megadepth. It enables exploring the RNA expression landscape in an annotation-agnostic way.
Overview of the data available in recount2 and recount3. 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. DOI: < https://doi.org/10.12688/f1000research.12223.1>.

Figure 1: Overview of the data available in recount2 and recount3
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. DOI: < https://doi.org/10.12688/f1000research.12223.1>.

4.2 Terminology

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

  • rse: a RangedSummarizedExperiment object from SummarizedExperiment (Morgan, Obenchain, Hester, and Pagès, 2019) that contains:
    • counts: a matrix with the expression feature data (either: gene, exon, or exon-exon junctions) and that can be accessed using assays(counts).
    • metadata: a table with information about the samples and quality metrics that can be accessed using colData(rse).
    • annotation: a table-like object with information about the expression features which can be annotation-specific (gene and exons) or annotation-agnostic (exon-exon junctions). This information can be accessed using rowRanges(rse).
recount2 and recount3 provide coverage count matrices in RangedSummarizedExperiment (rse) objects. Once the rse object has been downloaded and loaded into R (using `recount3::create_rse()` or `recount2::download_study()`), the feature information is accessed with `rowRanges(rse)` (blue box), the counts with assays(rse) (pink box) and the sample metadata with `colData(rse)` (green box). The sample metadata stored in `colData(rse)` can be expanded 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. DOI: < https://doi.org/10.12688/f1000research.12223.1>.

Figure 2: recount2 and recount3 provide coverage count matrices in RangedSummarizedExperiment (rse) objects
Once the rse object has been downloaded and loaded into R (using recount3::create_rse() or recount2::download_study()), the feature information is accessed with rowRanges(rse) (blue box), the counts with assays(rse) (pink box) and the sample metadata with colData(rse) (green box). The sample metadata stored in colData(rse) can be expanded 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. DOI: < https://doi.org/10.12688/f1000research.12223.1>.

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

  • project: the project ID, which is typically the same ID that is used externally to identify that project in databases like the Sequence Read Archive 1 GTEx and TCGA are broken up by tissue as described later in this vignette.
  • project_home: the location for where the project is located at in the main recount3 data host: IDIES SciServer. We have two types of project homes:
    • data_source: this identifies where the raw data was downloaded from for creating recount3.
    • collection: this identifies a human-curated set of projects or samples. The main difference compared to a data_source is that a collection has collection-specific metadata. For example, someone might have created a table of information about samples in several projects by reading the papers describing these studies as in recount-brain (Razmara, Ellis, Sokolowski, Davis et al., 2019).
  • organism: the reference organism (species) for the RNA-seq data, which is either human (hg38) or mouse (mm10).

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:

4.3 Find a study

In order to access data from 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 recount3 by tissue.

4.3.1 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 recount3 as shown below. This will return a data.frame() object that lists the unique project IDs.

human_projects <- available_projects()
#> 2023-05-07 18:01:01.66662 caching file sra.recount_project.MD.gz.
#> 2023-05-07 18:01:01.898517 caching file gtex.recount_project.MD.gz.
#> 2023-05-07 18:01:02.122462 caching file tcga.recount_project.MD.gz.
dim(human_projects)
#> [1] 8742    6
head(human_projects)
#>     project organism file_source     project_home project_type n_samples
#> 1 SRP107565    human         sra data_sources/sra data_sources       216
#> 2 SRP149665    human         sra data_sources/sra data_sources         4
#> 3 SRP017465    human         sra data_sources/sra data_sources        23
#> 4 SRP119165    human         sra data_sources/sra data_sources         6
#> 5 SRP133965    human         sra data_sources/sra data_sources        12
#> 6 SRP096765    human         sra data_sources/sra data_sources         7

## Select a study of interest
project_info <- subset(
    human_projects,
    project == "SRP009615" & project_type == "data_sources"
)
project_info
#>        project organism file_source     project_home project_type n_samples
#> 1838 SRP009615    human         sra data_sources/sra data_sources        12

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")
#>              project organism file_source      project_home project_type
#> 8678  ADIPOSE_TISSUE    human        gtex data_sources/gtex data_sources
#> 8679          MUSCLE    human        gtex data_sources/gtex data_sources
#> 8680    BLOOD_VESSEL    human        gtex data_sources/gtex data_sources
#> 8681           HEART    human        gtex data_sources/gtex data_sources
#> 8682           OVARY    human        gtex data_sources/gtex data_sources
#> 8683          UTERUS    human        gtex data_sources/gtex data_sources
#> 8684          VAGINA    human        gtex data_sources/gtex data_sources
#> 8685          BREAST    human        gtex data_sources/gtex data_sources
#> 8686            SKIN    human        gtex data_sources/gtex data_sources
#> 8687  SALIVARY_GLAND    human        gtex data_sources/gtex data_sources
#> 8688           BRAIN    human        gtex data_sources/gtex data_sources
#> 8689   ADRENAL_GLAND    human        gtex data_sources/gtex data_sources
#> 8690         THYROID    human        gtex data_sources/gtex data_sources
#> 8691            LUNG    human        gtex data_sources/gtex data_sources
#> 8692          SPLEEN    human        gtex data_sources/gtex data_sources
#> 8693        PANCREAS    human        gtex data_sources/gtex data_sources
#> 8694       ESOPHAGUS    human        gtex data_sources/gtex data_sources
#> 8695         STOMACH    human        gtex data_sources/gtex data_sources
#> 8696           COLON    human        gtex data_sources/gtex data_sources
#> 8697 SMALL_INTESTINE    human        gtex data_sources/gtex data_sources
#> 8698        PROSTATE    human        gtex data_sources/gtex data_sources
#> 8699          TESTIS    human        gtex data_sources/gtex data_sources
#> 8700           NERVE    human        gtex data_sources/gtex data_sources
#> 8701       PITUITARY    human        gtex data_sources/gtex data_sources
#> 8702           BLOOD    human        gtex data_sources/gtex data_sources
#> 8703           LIVER    human        gtex data_sources/gtex data_sources
#> 8704          KIDNEY    human        gtex data_sources/gtex data_sources
#> 8705    CERVIX_UTERI    human        gtex data_sources/gtex data_sources
#> 8706  FALLOPIAN_TUBE    human        gtex data_sources/gtex data_sources
#> 8707         BLADDER    human        gtex data_sources/gtex data_sources
#> 8708        STUDY_NA    human        gtex data_sources/gtex data_sources
#> 8709     BONE_MARROW    human        gtex data_sources/gtex data_sources
#>      n_samples
#> 8678      1293
#> 8679       881
#> 8680      1398
#> 8681       942
#> 8682       195
#> 8683       159
#> 8684       173
#> 8685       482
#> 8686      1940
#> 8687       178
#> 8688      2931
#> 8689       274
#> 8690       706
#> 8691       655
#> 8692       255
#> 8693       360
#> 8694      1577
#> 8695       384
#> 8696       822
#> 8697       193
#> 8698       263
#> 8699       410
#> 8700       659
#> 8701       301
#> 8702      1048
#> 8703       251
#> 8704        98
#> 8705        19
#> 8706         9
#> 8707        21
#> 8708       133
#> 8709       204

Note that one of the projects for GTEx is STUDY_NA, that’s because in 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 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 recount3. Those are:

  • project: the project ID,
  • organism: either human or mouse,
  • project_home: where the data lives which varies between data sources and collections.
project_info[, c("project", "organism", "project_home")]
#>        project organism     project_home
#> 1838 SRP009615    human data_sources/sra

4.4 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 recount3, we have provided the function annotation_options().

annotation_options("human")
#> [1] "gencode_v26" "gencode_v29" "fantom6_cat" "refseq"      "ercc"       
#> [6] "sirv"
annotation_options("mouse")
#> [1] "gencode_v23"

The main sources are:

In recount3 we have provided multiple annotations, which is different from 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.

4.5 Build a RSE

Once you have chosen an annotation and a project, you can now build a RangedSummarizedExperiment object (Huber, Carey, Gentleman, Anders et al., 2015; Morgan, Obenchain, Hester, and Pagès, 2019). 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 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)
#> 2023-05-07 18:01:07.986617 downloading and reading the metadata.
#> 2023-05-07 18:01:08.350625 caching file sra.sra.SRP009615.MD.gz.
#> 2023-05-07 18:01:08.563755 caching file sra.recount_project.SRP009615.MD.gz.
#> 2023-05-07 18:01:08.793937 caching file sra.recount_qc.SRP009615.MD.gz.
#> 2023-05-07 18:01:09.057151 caching file sra.recount_seq_qc.SRP009615.MD.gz.
#> 2023-05-07 18:01:09.285824 caching file sra.recount_pred.SRP009615.MD.gz.
#> 2023-05-07 18:01:09.394595 downloading and reading the feature information.
#> 2023-05-07 18:01:09.551529 caching file human.gene_sums.G026.gtf.gz.
#> 2023-05-07 18:01:10.146816 downloading and reading the counts: 12 samples across 63856 features.
#> 2023-05-07 18:01:10.286087 caching file sra.gene_sums.SRP009615.G026.gz.
#> 2023-05-07 18:01:10.503522 constructing the RangedSummarizedExperiment (rse) object.

## Explore the resulting RSE gene object
rse_gene_SRP009615
#> class: RangedSummarizedExperiment 
#> dim: 63856 12 
#> metadata(8): time_created recount3_version ... annotation recount3_url
#> assays(1): raw_counts
#> rownames(63856): ENSG00000278704.1 ENSG00000277400.1 ...
#>   ENSG00000182484.15_PAR_Y ENSG00000227159.8_PAR_Y
#> rowData names(10): source type ... havana_gene tag
#> colnames(12): SRR387777 SRR387778 ... SRR389077 SRR389078
#> colData names(175): rail_id external_id ...
#>   recount_pred.curated.cell_line BigWigURL

4.6 Explore the RSE

Because the RSE object is created at run-time in recount3, unlike the static files provided by 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 4 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
metadata(rse_gene_SRP009615)
#> $time_created
#> [1] "2023-05-07 18:01:10 EDT"
#> 
#> $recount3_version
#>           package ondiskversion loadedversion
#> recount3 recount3        1.10.2        1.10.2
#>                                                  path
#> recount3 /tmp/RtmpPpGo4A/Rinst32e73c7c7b5162/recount3
#>                                            loadedpath attached is_base
#> recount3 /tmp/RtmpPpGo4A/Rinst32e73c7c7b5162/recount3     TRUE   FALSE
#>                date       source md5ok                             library
#> recount3 2023-05-07 Bioconductor    NA /tmp/RtmpPpGo4A/Rinst32e73c7c7b5162
#> 
#> $project
#> [1] "SRP009615"
#> 
#> $project_home
#> [1] "data_sources/sra"
#> 
#> $type
#> [1] "gene"
#> 
#> $organism
#> [1] "human"
#> 
#> $annotation
#> [1] "gencode_v26"
#> 
#> $recount3_url
#> [1] "http://duffel.rail.bio/recount3"

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 5 Although ERCC and SIRV are technically not genes..

## Number of genes by number of samples
dim(rse_gene_SRP009615)
#> [1] 63856    12

## Information about the genes
rowRanges(rse_gene_SRP009615)
#> GRanges object with 63856 ranges and 10 metadata columns:
#>                              seqnames            ranges strand |   source
#>                                 <Rle>         <IRanges>  <Rle> | <factor>
#>          ENSG00000278704.1 GL000009.2       56140-58376      - |  ENSEMBL
#>          ENSG00000277400.1 GL000194.1      53590-115018      - |  ENSEMBL
#>          ENSG00000274847.1 GL000194.1      53594-115055      - |  ENSEMBL
#>          ENSG00000277428.1 GL000195.1       37434-37534      - |  ENSEMBL
#>          ENSG00000276256.1 GL000195.1       42939-49164      - |  ENSEMBL
#>                        ...        ...               ...    ... .      ...
#>   ENSG00000124334.17_PAR_Y       chrY 57184101-57197337      + |   HAVANA
#>   ENSG00000185203.12_PAR_Y       chrY 57201143-57203357      - |   HAVANA
#>    ENSG00000270726.6_PAR_Y       chrY 57190738-57208756      + |   HAVANA
#>   ENSG00000182484.15_PAR_Y       chrY 57207346-57212230      + |   HAVANA
#>    ENSG00000227159.8_PAR_Y       chrY 57212184-57214397      - |   HAVANA
#>                                type bp_length     phase                gene_id
#>                            <factor> <numeric> <integer>            <character>
#>          ENSG00000278704.1     gene      2237      <NA>      ENSG00000278704.1
#>          ENSG00000277400.1     gene      2179      <NA>      ENSG00000277400.1
#>          ENSG00000274847.1     gene      1599      <NA>      ENSG00000274847.1
#>          ENSG00000277428.1     gene       101      <NA>      ENSG00000277428.1
#>          ENSG00000276256.1     gene      2195      <NA>      ENSG00000276256.1
#>                        ...      ...       ...       ...                    ...
#>   ENSG00000124334.17_PAR_Y     gene      2504      <NA> ENSG00000124334.17_P..
#>   ENSG00000185203.12_PAR_Y     gene      1054      <NA> ENSG00000185203.12_P..
#>    ENSG00000270726.6_PAR_Y     gene       773      <NA> ENSG00000270726.6_PA..
#>   ENSG00000182484.15_PAR_Y     gene      4618      <NA> ENSG00000182484.15_P..
#>    ENSG00000227159.8_PAR_Y     gene      1306      <NA> ENSG00000227159.8_PA..
#>                                         gene_type   gene_name       level
#>                                       <character> <character> <character>
#>          ENSG00000278704.1         protein_coding  BX004987.1           3
#>          ENSG00000277400.1         protein_coding  AC145212.2           3
#>          ENSG00000274847.1         protein_coding  AC145212.1           3
#>          ENSG00000277428.1               misc_RNA       Y_RNA           3
#>          ENSG00000276256.1         protein_coding  AC011043.1           3
#>                        ...                    ...         ...         ...
#>   ENSG00000124334.17_PAR_Y         protein_coding        IL9R           2
#>   ENSG00000185203.12_PAR_Y              antisense      WASIR1           2
#>    ENSG00000270726.6_PAR_Y   processed_transcript AJ271736.10           2
#>   ENSG00000182484.15_PAR_Y transcribed_unproces..      WASH6P           2
#>    ENSG00000227159.8_PAR_Y unprocessed_pseudogene    DDX11L16           2
#>                                     havana_gene         tag
#>                                     <character> <character>
#>          ENSG00000278704.1                 <NA>        <NA>
#>          ENSG00000277400.1                 <NA>        <NA>
#>          ENSG00000274847.1                 <NA>        <NA>
#>          ENSG00000277428.1                 <NA>        <NA>
#>          ENSG00000276256.1                 <NA>        <NA>
#>                        ...                  ...         ...
#>   ENSG00000124334.17_PAR_Y OTTHUMG00000022720.1         PAR
#>   ENSG00000185203.12_PAR_Y OTTHUMG00000022676.3         PAR
#>    ENSG00000270726.6_PAR_Y OTTHUMG00000184987.2         PAR
#>   ENSG00000182484.15_PAR_Y OTTHUMG00000022677.5         PAR
#>    ENSG00000227159.8_PAR_Y OTTHUMG00000022678.1         PAR
#>   -------
#>   seqinfo: 374 sequences from an unspecified genome; no seqlengths

4.7 Sample metadata

The sample metadata provided in recount3 is much more extensive than the one in recount for the recount2 project because it’s includes for quality control metrics, predictions, and information used internally by 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?
length(recount3_cols)
#> [1] 175

## View the first few ones
head(recount3_cols)
#> [1] "rail_id"            "external_id"        "study"             
#> [4] "sra.sample_acc.x"   "sra.experiment_acc" "sra.submission_acc"

## 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]
#> 
#>    recount_pred recount_project      recount_qc  recount_seq_qc             sra 
#>               7               5             109              12              38

## Unique columns
recount3_cols_groups[recount3_cols_groups == 1]
#> 
#>   BigWigURL external_id     rail_id       study 
#>           1           1           1           1
## Explore them all
recount3_cols

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

rse_gene_SRP009615_expanded <-
    expand_sra_attributes(rse_gene_SRP009615)
colData(rse_gene_SRP009615_expanded)[, ncol(colData(rse_gene_SRP009615)):ncol(colData(rse_gene_SRP009615_expanded))]
#> DataFrame with 12 rows and 5 columns
#>                        BigWigURL sra_attribute.cells
#>                      <character>         <character>
#> SRR387777 http://duffel.rail.b..                K562
#> SRR387778 http://duffel.rail.b..                K562
#> SRR387779 http://duffel.rail.b..                K562
#> SRR387780 http://duffel.rail.b..                K562
#> SRR389079 http://duffel.rail.b..                K562
#> ...                          ...                 ...
#> SRR389082 http://duffel.rail.b..                K562
#> SRR389083 http://duffel.rail.b..                K562
#> SRR389084 http://duffel.rail.b..                K562
#> SRR389077 http://duffel.rail.b..                K562
#> SRR389078 http://duffel.rail.b..                K562
#>           sra_attribute.shRNA_expression sra_attribute.source_name
#>                              <character>               <character>
#> SRR387777                             no                    SL2933
#> SRR387778             yes, targeting SRF                    SL2934
#> SRR387779                             no                    SL5265
#> SRR387780              yes targeting SRF                    SL3141
#> SRR389079            no shRNA expression                    SL6485
#> ...                                  ...                       ...
#> SRR389082         expressing shRNA tar..                    SL2592
#> SRR389083            no shRNA expression                    SL4337
#> SRR389084         expressing shRNA tar..                    SL4326
#> SRR389077            no shRNA expression                    SL1584
#> SRR389078         expressing shRNA tar..                    SL1583
#>           sra_attribute.treatment
#>                       <character>
#> SRR387777               Puromycin
#> SRR387778  Puromycin, doxycycline
#> SRR387779               Puromycin
#> SRR387780  Puromycin, doxycycline
#> SRR389079               Puromycin
#> ...                           ...
#> SRR389082  Puromycin, doxycycline
#> SRR389083               Puromycin
#> SRR389084  Puromycin, doxycycline
#> SRR389077               Puromycin
#> SRR389078  Puromycin, doxycycline

4.8 Counts

The counts in recount3 are raw base-pair coverage counts, similar to those in recount. To further understand them, check the 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

assayNames(rse_gene_SRP009615)
#> [1] "raw_counts"

Using transform_counts() you can scale the counts and assign them to the “counts” assays slot to use them in downstream packages such as DESeq2 and 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 recount for recount2, you can transform the raw base-pair coverage counts (Collado-Torres, Nellore, and Jaffe, 2017) to read counts with compute_read_counts(), RPKM with recount::getRPKM() or TPM values with recount::getTPM(). Check transform_counts() from recount3 for more details.

4.9 Exon

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(
    proj_info,
    type = "exon"
)
#> 2023-05-07 18:01:11.01252 downloading and reading the metadata.
#> 2023-05-07 18:01:11.19325 caching file sra.sra.SRP009615.MD.gz.
#> 2023-05-07 18:01:11.409575 caching file sra.recount_project.SRP009615.MD.gz.
#> 2023-05-07 18:01:11.62738 caching file sra.recount_qc.SRP009615.MD.gz.
#> 2023-05-07 18:01:11.85336 caching file sra.recount_seq_qc.SRP009615.MD.gz.
#> 2023-05-07 18:01:12.102318 caching file sra.recount_pred.SRP009615.MD.gz.
#> 2023-05-07 18:01:12.206247 downloading and reading the featu