Using the recount2 resource and related tools
This workshop is an updated version of the recountWorkshop
from BioC2017 available at LieberInstitute/recountWorkshop that is adapted from the recountWorkflow
available via F1000Research and via Bioconductor (1). This workshop uses a smaller data set to speed up computation and reduce the required computational resources to run this code.
Introduction
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 which are used for several analyses such as identifying differentially expressed genes. The Bioconductor project (2) has many contributed packages that specialize in analyzing this type of data and previous workflows have explained how to use them (3–5). Initial steps are typically focused on generating the count matrices. Some pre-computed matrices have been made available via the ReCount project (6) or Bioconductor Experiment data packages such as the airway
dataset (7). The count matrices in ReCount have helped others access RNA-seq data avoid having to run the processing pipelines required to compute these matrices. However, in the years since ReCount was published, hundreds of new RNA-seq projects have been carried out and researchers have publicly shared the data publicly.
We 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/ (8). 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 (8) 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.
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
(9) to identify expressed regions, some of them could be un-annotated exons and together with the exon-exon junction data uncover potential new isoforms.
recount2 provides gene, exon, and exon-exon junction count matrices both in text format and RangedSummarizedExperiment objects (RSE) (10) as shown in Figure 2. These RSE objects provide information about the expression features (for example gene ids) and the samples. In this workshop 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 (8). recount
also allows sending queries to snaptron
(11) to search for specific exon-exon junctions.
Packages used in the workshop
In this workshop we will use several Bioconductor packages. To reproduce the entirety of this workshop, install the packages using the following code after installing R 3.6.x from CRAN in order to use Bioconductor version 3.9 or newer.
## Install packages from Bioconductor
install.packages("BiocManager")
BiocManager::install(c(
"recount", "GenomicRanges", "DESeq2", "ideal", "regionReport",
"clusterProfiler", "org.Hs.eg.db", "gplots", "derfinder",
"rtracklayer", "GenomicFeatures", "bumphunter", "derfinderPlot",
"sessioninfo"))
Once installed, load all of the packages with the following code.
library("recount")
library("GenomicRanges")
library("DESeq2")
library("ideal")
library("regionReport")
library("clusterProfiler")
library("org.Hs.eg.db")
library("gplots")
library("derfinder")
library("rtracklayer")
library("GenomicFeatures")
library("bumphunter")
library("derfinderPlot")
library("sessioninfo")
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.
Reads in the recount2 resource were aligned with Rail-RNA aligner (12) which is splice-aware and can soft clip reads. 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).
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.
The coverage curve is at the 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
(13) 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.
library("GenomicRanges")
exons <- GRanges("seq", IRanges(start = c(1, 1, 13), end = c(5, 8, 15)))
exons
## GRanges object with 3 ranges and 0 metadata columns:
## seqnames ranges strand
## <Rle> <IRanges> <Rle>
## [1] seq 1-5 *
## [2] seq 1-8 *
## [3] seq 13-15 *
## -------
## seqinfo: 1 sequence from an unspecified genome; no seqlengths
disjoin(exons)
## GRanges object with 3 ranges and 0 metadata columns:
## seqnames ranges strand
## <Rle> <IRanges> <Rle>
## [1] seq 1-5 *
## [2] seq 6-8 *
## [3] seq 13-15 *
## -------
## seqinfo: 1 sequence from an unspecified genome; no seqlengths
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).
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 $\sum_i^n \texttt{coverage}_i$ 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.
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 (??). Note that the resulting scaled read counts are not necessarily integers so it might be neccessary to round them if a differential expression 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 (??) 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 $\frac{36}{45} * 20 = 16$ and in general calculated with Equation (??). The following code shows how to compute the AUC given a set of aligned reads and reproduce a portion of Figure 9.
## Take the example and translate it to R code
library("GenomicRanges")
reads <- GRanges("seq", IRanges(
start = rep(
c(1, 2, 3, 4, 5, 7, 8, 9, 10, 13, 14),
c(3, 1, 2, 1, 2, 1, 2, 1, 2, 4, 1)
), width = rep(
c(1, 3, 2, 3, 1, 2, 1, 3, 2, 3, 2, 1, 3),
c(1, 4, 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, 1)
)
))
## Get the base-level genome coverage curve
cov <- as.integer(coverage(reads)$seq)
## AUC
sum(cov)
## [1] 45
## Code for reproducing the bottom portion of Figure 8.
pdf("base_pair_coverage.pdf", width = 20)
par(mar = c(5, 6, 4, 2) + 0.1)
plot(cov, type = "o", col = "violetred1", lwd = 10, ylim = c(0, 5),
xlab = "Genome", ylab = "Coverage", cex.axis = 2, cex.lab = 3,
bty = "n")
polygon(c(1, seq_len(length(cov)), length(cov)), c(0, cov, 0),
border = NA, density = -1, col = "light blue")
points(seq_len(length(cov)), cov, col = "violetred1", type = "o",
lwd = 10)
dev.off()
The recount
function scale_counts()
computes the scaled read counts for a target library size of 40 million mapped 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.
## Check that the number of reads is less than or equal to 40 million
## after scaling.
library("recount")
rse_scaled <- scale_counts(rse_gene_SRP009615, round = FALSE)
summary(colSums(assays(rse_scaled)$counts)) / 1e6
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 22.62 29.97 34.00 31.96 34.86 36.78
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
(11) allows programatic and high-level queries of the exon-exon junction information and it is 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. A full R interface to Snaptron
is under development.
The base-pair coverage data from recount2 can be used together with derfinder
(9) 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 (Fig 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 differential expression analysis, just like the exon, gene and exon-exon junction matrices.
Gene level analysis
Having reviewed how the coverage counts in recount2 were produced, we can now do a differential expression analysis. We will use data from GSE67333 (14) whose overall design was: We performed directional RNA sequencing on high quality RNA samples extracted from hippocampi of 4 late onset Alzheimer’s disease (LOAD) and 4 age-matched controls. The function download_study()
requires a SRA accession id 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 id, in this case SRP056604.
To facilitate this workshop, we included the data in the recountWorkshop2019
package. It can be located with the system.file()
function as shown below.
## Locate path with the data
library("recountWorkshop2019")
local_path <- system.file("extdata", "SRP056604", package = "recountWorkshop2019")
dir(local_path)
## [1] "bw" "rse_exon.Rdata" "rse_gene.Rdata" "SraRunTable.txt"
## [5] "SRP056604.tsv"
The commands should work with the data hosted from recount2 if there are no problems with the wifi connection. Although we prefer that you use the pre-installed data for this workshop.
library("recount")
## Find the project id by searching abstracts of studies
abstract_search("hippocampi of 4")
## number_samples species
## 1643 8 human
## abstract
## 1643 Our data provide a comprehensive list of transcriptomics alterations and warrant holistic approach including both coding and non-coding RNAs in functional studies aimed to understand the pathophysiology of LOAD Overall design: We performed directional RNA sequencing on high quality RNA samples extracted from hippocampi of 4 late onset Alzheimer's diseas (LOAD) and 4 age-matched controls.
## project
## 1643 SRP056604
## Download the data if it is not there
if(!file.exists(file.path(local_path, "rse_gene.Rdata"))) {
## In case you decide to download the data instead of using the
## pre-installed data
local_path <- "SRP056604"
download_study("SRP056604", type = "rse-gene")
}
## Check that the file was downloaded
file.exists(file.path(local_path, "rse_gene.Rdata"))
## [1] TRUE
## Load the data
load(file.path(local_path, "rse_gene.Rdata"))
The coverage count matrices are provided as RangedSummarizedExperiment objects (RSE) (10). 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 (4). 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()
(15), pulling information from GEO via find_geo()
and geo_characteristics()
, or with custom code. As of 2019, you can also use add_metadata(source = "recount_brain_v2")
to add curated sample metadata from brain studies (16).
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 (8), 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 gtexportal.org, 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
(17).
## One row per sample, one column per phenotype variable
dim(colData(rse_gene))
## [1] 8 21
## Mostly technical variables are included
colnames(colData(rse_gene))
## [1] "project"
## [2] "sample"
## [3] "experiment"
## [4] "run"
## [5] "read_count_as_reported_by_sra"
## [6] "reads_downloaded"
## [7] "proportion_of_reads_reported_by_sra_downloaded"
## [8] "paired_end"
## [9] "sra_misreported_paired_end"
## [10] "mapped_read_count"
## [11] "auc"
## [12] "sharq_beta_tissue"
## [13] "sharq_beta_cell_type"
## [14] "biosample_submission_date"
## [15] "biosample_publication_date"
## [16] "biosample_update_date"
## [17] "avg_read_length"
## [18] "geo_accession"
## [19] "bigwig_file"
## [20] "title"
## [21] "characteristics"
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 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 https://trace.ncbi.nlm.nih.gov/Traces/sra/?run=SRR2071341; that is because it is a paired-end sample (2 reads per spot). These details are important for those interested on writing alternative scaling functions to scale_counts()
.
## Input reads: number reported by SRA might be larger than number
## of reads Rail-RNA downloaded
meta <- all_metadata()
## 2019-06-22 01:52:19 downloading the metadata to /tmp/RtmpnXB7wr/metadata_clean_sra.Rdata
meta[meta$run == 'SRR2071341',
c("read_count_as_reported_by_sra", "reads_downloaded")]
## DataFrame with 1 row and 2 columns
## read_count_as_reported_by_sra reads_downloaded
## <integer> <integer>
## 1 240797206 240797206
summary(meta$proportion_of_reads_reported_by_sra_downloaded[
meta$project == 'SRP045638'])
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.5719 0.9165 0.9788 0.9532 1.0000 1.0000
## AUC information used by scale_counts() by default
head(colData(rse_gene)$auc)
## [1] 14058249889 13996129504 13578647527 14599138400 16423440640 15559854293
## Alternatively, scale_scounts() can use the number of mapped reads
## and other information
colData(rse_gene)[, c("mapped_read_count", "paired_end", "avg_read_length")]
## DataFrame with 8 rows and 3 columns
## mapped_read_count paired_end avg_read_length
## <integer> <logical> <integer>
## SRR1931819 160584474 FALSE 99
## SRR1931818 155722526 FALSE 99
## SRR1931817 164110375 FALSE 99
## SRR1931816 165119594 FALSE 99
## SRR1931815 180961318 FALSE 99
## SRR1931814 170579381 FALSE 99
## SRR1931813 171525236 FALSE 99
## SRR1931812 178912737 FALSE 99
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.
## SHARQ tissue predictions: not present for all studies
head(colData(rse_gene)$sharq_beta_tissue)
## [1] NA NA NA NA NA NA
head(colData(rse_gene_SRP009615)$sharq_beta_tissue)
## [1] "blood" "blood" "blood" "blood" "blood" "blood"
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.
## GEO information was absent for the SRP056604 data set
colData(rse_gene)[, c("geo_accession", "title", "characteristics")]
## DataFrame with 8 rows and 3 columns
## geo_accession title
## <character> <character>
## SRR1931819 GSM1645003 CTRL4
## SRR1931818 GSM1645002 CTRL3
## SRR1931817 GSM1645001 CTRL2
## SRR1931816 GSM1645000 CTRL1
## SRR1931815 GSM1644999 LOAD4
## SRR1931814 GSM1644998 LOAD3
## SRR1931813 GSM1644997 LOAD2
## SRR1931812 GSM1644996 LOAD1
## characteristics
## <CharacterList>
## SRR1931819 age (yrs): 85,subject group: age-matched control,gender: female,...
## SRR1931818 age (yrs): >90,subject group: age-matched control,gender: male,...
## SRR1931817 age (yrs): 83,subject group: age-matched control,gender: male,...
## SRR1931816 age (yrs): 77,subject group: age-matched control,gender: female,...
## SRR1931815 age (yrs): 82,subject group: LOAD (late onset of Alzheimer’s disease),gender: female,...
## SRR1931814 age (yrs): 83,subject group: LOAD (late onset of Alzheimer’s disease),gender: male,...
## SRR1931813 age (yrs): 87,subject group: LOAD (late onset of Alzheimer’s disease),gender: female,...
## SRR1931812 age (yrs): 82,subject group: LOAD (late onset of Alzheimer’s disease),gender: female,...
## GEO information for the SRP009615 data set
head(colData(rse_gene_SRP009615)$geo_accession)
## [1] "GSM836270" "GSM836271" "GSM836272" "GSM836273" "GSM847561" "GSM847562"
head(colData(rse_gene_SRP009615)$title, 2)
## [1] "K562 cells with shRNA targeting SRF gene cultured with no doxycycline (uninduced - UI), rep1."
## [2] "K562 cells with shRNA targeting SRF gene cultured with doxycycline for 48 hours (48 hr), rep1."
head(colData(rse_gene_SRP009615)$characteristics, 2)
## CharacterList of length 2
## [[1]] cells: K562 shRNA expression: no treatment: Puromycin
## [[2]] cells: K562 shRNA expression: yes, targeting SRF treatment: Puromycin, doxycycline
## Similar but not exactly the same wording used for two different samples
colData(rse_gene_SRP009615)$characteristics[[1]]
## [1] "cells: K562" "shRNA expression: no" "treatment: Puromycin"
colData(rse_gene_SRP009615)$characteristics[[11]]
## [1] "cell line: K562"
## [2] "shRNA expression: no shRNA expression"
## [3] "treatment: Puromycin"
## For study SRP056604 we have characteristics information
## Note the > symbol in the age for the second sample
colData(rse_gene)$characteristics[[1]]
## [1] "age (yrs): 85"
## [2] "subject group: age-matched control"
## [3] "gender: female"
## [4] "apoe genotype: 2/3"
## [5] "braak stage: II"
## [6] "tissue: Hippocampus"
colData(rse_gene)$characteristics[[2]]
## [1] "age (yrs): >90"
## [2] "subject group: age-matched control"
## [3] "gender: male"
## [4] "apoe genotype: 3/3"
## [5] "braak stage: II"
## [6] "tissue: Hippocampus"
Since we have the characteristics
information for study SRP056604, lets extract some data from them. We can extract the case
status, sex
and age
.
## Get the case status: either LOAD or control
colData(rse_gene)$case <- factor(
sapply(colData(rse_gene)$characteristics, function(x)
ifelse(any(grepl("LOAD", x)), "LOAD", "control"))
)
## Get the sex
colData(rse_gene)$sex <- factor(
sapply(colData(rse_gene)$characteristics, function(x)
ifelse(any(grepl("female", x)),
"female", "male"))
)
## Extract the age. Note that one of them is a bit more complicated.
colData(rse_gene)$age <- sapply(colData(rse_gene)$characteristics,
function(x) {
y <- x[grep("age.*(yrs)", x)]
as.integer(gsub("age.*\\(yrs\\): |>", "", y))
}
)
Now that we have added the biological metadata variables, we can explore them.
table(colData(rse_gene)$case, colData(rse_gene)$sex)
##
## female male
## control 2 2
## LOAD 3 1
table(colData(rse_gene)$case, colData(rse_gene)$age)
##
## 77 82 83 85 87 90
## control 1 0 1 1 0 1
## LOAD 0 2 1 0 1 0
From the previous tables, case seems to be balanced by sex and age.
As shown in Figure 2, we can expand the biological metadata information by adding predictions based on RNA-seq data (15). 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.
## Before adding predictions
dim(colData(rse_gene))
## [1] 8 24
## Add the predictions
rse_gene <- add_predictions(rse_gene)
## 2019-06-22 01:52:22 downloading the predictions to /tmp/RtmpnXB7wr/PredictedPhenotypes_v0.0.06.rda
## Loading objects:
## PredictedPhenotypes
## After adding the predictions
dim(colData(rse_gene))
## [1] 8 36
## Explore the variables
colData(rse_gene)[, 25:ncol(colData(rse_gene))]
## DataFrame with 8 rows and 12 columns
## reported_sex predicted_sex accuracy_sex
## <factor> <factor> <numeric>
## SRR1931819 NA male 0.862637362637363
## SRR1931818 NA male 0.862637362637363
## SRR1931817 NA female 0.862637362637363
## SRR1931816 NA female 0.862637362637363
## SRR1931815 NA female 0.862637362637363
## SRR1931814 NA female 0.862637362637363
## SRR1931813 NA male 0.862637362637363
## SRR1931812 NA female 0.862637362637363
## reported_samplesource predicted_samplesource
## <factor> <factor>
## SRR1931819 tissue tissue
## SRR1931818 tissue tissue
## SRR1931817 tissue tissue
## SRR1931816 tissue tissue
## SRR1931815 tissue tissue
## SRR1931814 tissue tissue
## SRR1931813 tissue tissue
## SRR1931812 tissue tissue
## accuracy_samplesource reported_tissue predicted_tissue
## <numeric> <factor> <factor>
## SRR1931819 0.892349726775956 NA Brain
## SRR1931818 0.892349726775956 NA Brain
## SRR1931817 0.892349726775956 NA Brain
## SRR1931816 0.892349726775956 NA Brain
## SRR1931815 0.892349726775956 NA Brain
## SRR1931814 0.892349726775956 NA Brain
## SRR1931813 0.892349726775956 NA Brain
## SRR1931812 0.892349726775956 NA Brain
## accuracy_tissue reported_sequencingstrategy
## <numeric> <factor>
## SRR1931819 0.518824712322645 SINGLE
## SRR1931818 0.518824712322645 SINGLE
## SRR1931817 0.518824712322645 SINGLE
## SRR1931816 0.518824712322645 SINGLE
## SRR1931815 0.518824712322645 SINGLE
## SRR1931814 0.518824712322645 SINGLE
## SRR1931813 0.518824712322645 SINGLE
## SRR1931812 0.518824712322645 SINGLE
## predicted_sequencingstrategy accuracy_sequencingstrategy
## <factor> <numeric>
## SRR1931819 SINGLE 0.908574650610174
## SRR1931818 SINGLE 0.908574650610174
## SRR1931817 SINGLE 0.908574650610174
## SRR1931816 SINGLE 0.908574650610174
## SRR1931815 SINGLE 0.908574650610174
## SRR1931814 SINGLE 0.908574650610174
## SRR1931813 SINGLE 0.908574650610174
## SRR1931812 SINGLE 0.908574650610174
From the predictions, we see that all samples are predicted to be from the brain, which matches the samples description. We also have predicted sex which we can compare against the reported sex.
table("Observed" = colData(rse_gene)$sex,
"Predicted" = colData(rse_gene)$predicted_sex)
## Predicted
## Observed female male Unassigned
## female 3 2 0
## male 2 1 0
We have 4 sex prediction mismatches, which is very high. Let’s explore whether the sex is matching is related to other variables.
## Is the sex matching? TRUE for yes.
colData(rse_gene)$matching_sex <- as.character(colData(rse_gene)$sex) ==
as.character(colData(rse_gene)$predicted_sex)
## Matching sex vs other variables
table('Matched Sex' = colData(rse_gene)$matching_sex, colData(rse_gene)$case)
##
## Matched Sex control LOAD
## FALSE 2 2
## TRUE 2 2
table('Matched Sex' = colData(rse_gene)$matching_sex, colData(rse_gene)$age)
##
## Matched Sex 77 82 83 85 87 90
## FALSE 0 0 2 1 1 0
## TRUE 1 2 0 0 0 1
boxplot(colData(rse_gene)$mapped_read_count ~ colData(rse_gene)$matching_sex,
ylab = "Mapped read count", xlab = "Matching sex")
There are no discernible differences by case, age or mapped read count when compared with the matching sex status.
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 SRP056604 has redundant information with the characteristics
and the SRA Run selector https://trace.ncbi.nlm.nih.gov/Traces/study/?acc=SRP056604. However, this might not be the case for other projects. While the SRA Run Selector information is redundant in this case, we can practice adding it. 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 SRP056604 project.
## Save the information from
## https://trace.ncbi.nlm.nih.gov/Traces/study/?acc=SRP056604
## to a table. We saved the file as SRP056604/SraRunTable.txt.
file.exists(file.path(local_path, "SraRunTable.txt"))
## [1] TRUE
## Read the table
sra <- read.table(file.path(local_path, "SraRunTable.txt"),
header = TRUE, sep = "\t")
## Explore it
head(sra)
## BioSample_s Experiment_s MBases_l MBytes_l Run_s SRA_Sample_s
## 1 SAMN03448725 SRX970047 17703 12139 SRR1931812 SRS885256
## 2 SAMN03448726 SRX970048 17024 11659 SRR1931813 SRS885255
## 3 SAMN03448730 SRX970049 16854 11560 SRR1931814 SRS885254
## 4 SAMN03448728 SRX970050 17806 12561 SRR1931815 SRS885253
## 5 SAMN03448727 SRX970051 16721 11576 SRR1931816 SRS885252
## 6 SAMN03448729 SRX970052 16418 11424 SRR1931817 SRS885251
## Sample_Name_s apoe_genotype_s braak_stage_s gender_s
## 1 GSM1644996 3/3 VI female
## 2 GSM1644997 3/3 V female
## 3 GSM1644998 3/3 VI male
## 4 GSM1644999 3/3 VI female
## 5 GSM1645000 2/3 I female
## 6 GSM1645001 Not available II male
## source_name_s subject_group_s
## 1 LOAD_hippocampi LOAD (late onset of Alzheimer’s disease)
## 2 LOAD_hippocampi LOAD (late onset of Alzheimer’s disease)
## 3 LOAD_hippocampi LOAD (late onset of Alzheimer’s disease)
## 4 LOAD_hippocampi LOAD (late onset of Alzheimer’s disease)
## 5 age-matched control_hippocampi age-matched control
## 6 age-matched control_hippocampi age-matched control
## Assay_Type_s AvgSpotLen_l BioProject_s Center_Name_s Consent_s
## 1 RNA-Seq 99 PRJNA279526 GEO public
## 2 RNA-Seq 99 PRJNA279526 GEO public
## 3 RNA-Seq 99 PRJNA279526 GEO public
## 4 RNA-Seq 99 PRJNA279526 GEO public
## 5 RNA-Seq 99 PRJNA279526 GEO public
## 6 RNA-Seq 99 PRJNA279526 GEO public
## InsertSize_l Instrument_s LibraryLayout_s LibrarySelection_s
## 1 0 Illumina HiSeq 2000 SINGLE cDNA
## 2 0 Illumina HiSeq 2000 SINGLE cDNA
## 3 0 Illumina HiSeq 2000 SINGLE cDNA
## 4 0 Illumina HiSeq 2000 SINGLE cDNA
## 5 0 Illumina HiSeq 2000 SINGLE cDNA
## 6 0 Illumina HiSeq 2000 SINGLE cDNA
## LibrarySource_s LoadDate_s Organism_s Platform_s ReleaseDate_s
## 1 TRANSCRIPTOMIC 2015-03-26 Homo sapiens ILLUMINA 2015-04-01
## 2 TRANSCRIPTOMIC 2015-03-26 Homo sapiens ILLUMINA 2015-04-01
## 3 TRANSCRIPTOMIC 2015-03-26 Homo sapiens ILLUMINA 2015-04-01
## 4 TRANSCRIPTOMIC 2015-03-26 Homo sapiens ILLUMINA 2015-04-01
## 5 TRANSCRIPTOMIC 2015-03-26 Homo sapiens ILLUMINA 2015-04-01
## 6 TRANSCRIPTOMIC 2015-03-26 Homo sapiens ILLUMINA 2015-04-01
## SRA_Study_s tissue_s
## 1 SRP056604 Hippocampus
## 2 SRP056604 Hippocampus
## 3 SRP056604 Hippocampus
## 4 SRP056604 Hippocampus
## 5 SRP056604 Hippocampus
## 6 SRP056604 Hippocampus
## We will remove some trailing '_s' from the variable names
colnames(sra) <- gsub("_s$", "", colnames(sra))
## Add the sra_ prefix to the variable names
colnames(sra) <- paste0("sra_", colnames(sra))
## Choose some variables we want to add
sra_vars <- paste0("sra_", c("braak_stage", "gender", "tissue"))
## Re-organize the SRA table based on the SRA Run ids we have
sra <- sra[match(colData(rse_gene)$run, sra$sra_Run), ]
## Double check the order
identical(colData(rse_gene)$run, as.character(sra$sra_Run))
## [1] TRUE
## Append the variables of interest
colData(rse_gene) <- cbind(colData(rse_gene), sra[, sra_vars])
## Final dimensions
dim(colData(rse_gene))
## [1] 8 40
## Explore result
colData(rse_gene)[, 38:ncol(colData(rse_gene))]
## DataFrame with 8 rows and 3 columns
## sra_braak_stage sra_gender sra_tissue
## <factor> <factor> <factor>
## SRR1931819 II female Hippocampus
## SRR1931818 II male Hippocampus
## SRR1931817 II male Hippocampus
## SRR1931816 I female Hippocampus
## SRR1931815 VI female Hippocampus
## SRR1931814 VI male Hippocampus
## SRR1931813 V female Hippocampus
## SRR1931812 VI female Hippocampus
## The sex information from the 'characteristics' and the
## SRA Run Selector match
table(colData(rse_gene)$sra_gender, colData(rse_gene)$sex)
##
## female male
## female 5 0
## male 0 3
Add curated metadata for brain studies
To facilitate analyses of brain studies we further curated 62 SRA projects and merged them with GTEx and TCGA brain samples to create recount-brain
(16) which contains brain sample metadata (Fig 13). SRP056604 is one of those 62 projects so we can easily include all this metadata to our RSE object using the add_metadata()
function in recount
. It works very similar to add_predictions()
.
We can use add_predictions()
without specifying the rse
argument as shown below to download the full recount-brain
curated metadata (Fig 14).
## Don't specify the rse argument to download the full recount_brain table
recount_brain <- add_metadata(source = 'recount_brain_v2')
## 2019-06-22 01:52:23 downloading the recount_brain metadata to /tmp/RtmpnXB7wr/recount_brain_v2.Rdata
## Loading objects:
## recount_brain
dim(recount_brain)
## [1] 6547 65
## Explore some of the variables for SRP056604
recount_brain[recount_brain$Study_full == 'SRP056604', c('age', 'age_units',
'sex', 'rin', 'pmi', 'pmi_units', 'pathology', 'disease_status')]
## age age_units sex rin pmi pmi_units pathology
## SRP056604.1 82 Years female 6.90 2.33 Hours Braak Stage VI
## SRP056604.2 87 Years female 6.50 2.00 Hours Braak Stage V
## SRP056604.3 83 Years male 7.00 2.83 Hours Braak Stage VI
## SRP056604.4 82 Years female 6.70 3.00 Hours Braak Stage VI
## SRP056604.5 77 Years female NA 2.50 Hours Braak Stage I
## SRP056604.6 83 Years male 6.50 4.50 Hours Braak Stage II
## SRP056604.7 90 Years male 8.60 2.00 Hours Braak Stage II
## SRP056604.8 85 Years female 8.32 1.00 Hours Braak Stage II
## disease_status
## SRP056604.1 Disease
## SRP056604.2 Disease
## SRP056604.3 Disease
## SRP056604.4 Disease
## SRP056604.5 Control
## SRP056604.6 Control
## SRP056604.7 Control
## SRP056604.8 Control
Or we can specify the rse
argument and append these columns to our RSE object (Fig 14). In the case of the SRP056604 project, by using add_metadata()
we can skip over all the steps of downloading the SRA table and processing the GEO characteristics information, plus get additional information that was absent from the previous data sources such as the postmorterm interval (PMI) and the RNA integrity number (RIN).
dim(colData(rse_gene))
## [1] 8 40
rse_gene <- add_metadata(rse_gene, source = 'recount_brain_v2')
## 2019-06-22 01:52:25 downloading the recount_brain metadata to /tmp/RtmpnXB7wr/recount_brain_v2.Rdata
## Loading objects:
## recount_brain
## 2019-06-22 01:52:26 found 8 out of 8 samples in the recount_brain metadata
dim(colData(rse_gene))
## [1] 8 104
Overall, you can explore interactively recount-brain
at jhubiostatistics.shinyapps.io/recount-brain/. Finally, note how add_metadata()
is designed to be expanded for more curated metadata, so if you would like to provide more data please let us know!
DE setup
Now that we have all the metadata available we can perform a differential expression analysis. Lets look for differences by case when adjusting for the sex, age of the sample and PMI.
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)
.
## Scale counts
rse_gene_scaled <- scale_counts(rse_gene)
## To highlight that we scaled the counts
rm(rse_gene)
DE analysis
Now that we have scaled the counts, there are multiple differential expression packages we could use as described elsewhere (3,4). Since we have very few samples per group, we will use DESeq2
(18). The model we will use will test for differential expression between LOAD and control samples, adjusting for sex and age. In a real use case we might have to explore the results with different models.
library("DESeq2")
## Specify design and switch to DESeq2 format
dds <- DESeqDataSet(rse_gene_scaled, ~ sex + age + pmi + case)
## converting counts to integer mode
## the design formula contains a numeric variable with integer values,
## specifying a model with increasing fold change for higher values.
## did you mean for this to be a factor? if so, first convert
## this variable to a factor using the factor() function
## Perform DE analysis
dds <- DESeq(dds, test = "LRT", reduced = ~ sex + age + pmi,
fitType = "local")
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## 1 rows did not converge in beta, labelled in mcols(object)$fullBetaConv. Use larger maxit argument with nbinomLRT
## Explore results
plotMA(dds, main="DESeq2 results for SRP056604",
contrast = c('case', 'LOAD', 'control'), alpha = 0.01)
We can use ideal
(19) to make a volcano plot of the DE results.
res <- results(dds, contrast = c('case', 'LOAD', 'control'), alpha = 0.01)
## Make a volcano plot
library("ideal")
plot_volcano(res, FDR = 0.01)
Having run the DE analysis, we can explore some of the top results either with an MA plot and a volcano plot. Both reveal strong differential expression signal for several genes.
DE report
Now that we have the differential expression results, we can use some of the tools with the biocView ReportWriting to create a report. One of them is regionReport
(20) which can create reports from DESeq2
(18) and edgeR
(21) results. It can also handle limma-voom
(22) results by making them look like DESeq2
results.
We can now create the report, which should open automatically in a browser.
## Make a report with the results
library("regionReport")
DESeq2Report(dds, res = res, project = "SRP056604",
intgroup = c("sex", "case"), outdir = ".",
output = "SRP056604_main-results")
If the report does not open automatically, we can open it with browseURL()
.
browseURL("SRP056604_main-results.html")
GO enrichment
Using clusterProfiler
(23) we can then perform several enrichment analyses. The gene names from the recount2 objects use Gencode ids, which do not work by default with org.Hs.eg.db
. To make sure they do, we can simply change the ids to Ensembl ids. Here we show how to perform an enrichment analysis using the biological process ontology. We will the genes that have a p-value as the universe background.
library("clusterProfiler")
library("org.Hs.eg.db")
## Remember that dds had ENSEMBL ids for the genes
ensembl <- gsub("\\..*", "", rownames(dds))
head(ensembl)
## [1] "ENSG00000000003" "ENSG00000000005" "ENSG00000000419" "ENSG00000000457"
## [5] "ENSG00000000460" "ENSG00000000938"
## Not all genes have a p-value
table(!is.na(res$padj))
##
## FALSE TRUE
## 15799 42238
## Perform enrichment analysis for Biological Process (BP)
## Note that the argument is keytype instead of keyType in Bioconductor 3.5
enrich_go <- enrichGO(gene = ensembl[which(res$padj < 0.05)],
OrgDb = org.Hs.eg.db, keyType = "ENSEMBL", ont = "BP",
pAdjustMethod = "BH", pvalueCutoff = 0.01, qvalueCutoff = 0.05,
universe = ensembl[!is.na(res$padj)])
## Visualize enrichment results
dotplot(enrich_go)
## wrong orderBy parameter; set to default `orderBy = "x"`
Several other analyses can be performed with the resulting list of differentially expressed genes as described previously (3,4), although that is beyond the scope of this workshop.
Secondary analysis
Since we noticed that the sex predictions and the reported sex do not match for half of the samples, we can check if there are any genes associated with whether the sex matched.
## DE analysis checking what genes are different by matching sex
dds2 <- DESeqDataSet(rse_gene_scaled, ~ matching_sex)
## converting counts to integer mode
dds2 <- DESeq(dds2, test = "LRT", reduced = ~ 1, fitType = "local")
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
res2 <- results(dds2, alpha = 0.01)
## Visually inspect results
plotMA(res2, main="DESeq2 results for SRP056604 - sex predictions")
## Lets add gene symbols to the volcano plot, they are stored in
## the rowRanges slot of the rse object
rowRanges(rse_gene_scaled)
## GRanges object with 58037 ranges and 3 metadata columns:
## seqnames ranges strand |
## <Rle> <IRanges> <Rle> |
## ENSG00000000003.14 chrX 100627109-100639991 - |
## ENSG00000000005.5 chrX 100584802-100599885 + |
## ENSG00000000419.12 chr20 50934867-50958555 - |
## ENSG00000000457.13 chr1 169849631-169894267 - |
## ENSG00000000460.16 chr1 169662007-169854080 + |
## ... ... ... ... .
## ENSG00000283695.1 chr19 52865369-52865429 - |
## ENSG00000283696.1 chr1 161399409-161422424 + |
## ENSG00000283697.1 chrX 149548210-149549852 - |
## ENSG00000283698.1 chr2 112439312-112469687 - |
## ENSG00000283699.1 chr10 12653138-12653197 - |
## gene_id bp_length symbol
## <character> <integer> <CharacterList>
## ENSG00000000003.14 ENSG00000000003.14 4535 TSPAN6
## ENSG00000000005.5 ENSG00000000005.5 1610 TNMD
## ENSG00000000419.12 ENSG00000000419.12 1207 DPM1
## ENSG00000000457.13 ENSG00000000457.13 6883 SCYL3
## ENSG00000000460.16 ENSG00000000460.16 5967 C1orf112
## ... ... ... ...
## ENSG00000283695.1 ENSG00000283695.1 61 <NA>
## ENSG00000283696.1 ENSG00000283696.1 997 <NA>
## ENSG00000283697.1 ENSG00000283697.1 1184 HSFX3
## ENSG00000283698.1 ENSG00000283698.1 940 <NA>
## ENSG00000283699.1 ENSG00000283699.1 60 MIR4481
## -------
## seqinfo: 25 sequences (1 circular) from an unspecified genome; no seqlengths
res2$symbol <- sapply(rowRanges(rse_gene_scaled)$symbol, "[[", 1)
## Select some DE genes
intgenes <- res2$symbol[which(res2$padj < 0.0005)]
intgenes <- intgenes[!is.na(intgenes)]
## Make the volcano plot
plot_volcano(res2, FDR = 0.01, intgenes = intgenes)
## Warning: Removed 44 rows containing missing values (geom_point).
We can create a report just like before.
DESeq2Report(dds2, res = res2, project = "SRP056604 - matching sex",
intgroup = c("sex", "predicted_sex"), outdir = ".",
output = "SRP056604_sex-predictions")
Checking the chromosome of the DE genes by matching sex status shows that most of these genes are not in chromosomes X and Y as shown below.
sort(table(seqnames(rowRanges(rse_gene_scaled))[which(res2$padj < 0.01)]))
##
## chr13 chr14 chr16 chr18 chr21 chrY chrM chr1 chr5 chr9 chr10 chr2
## 0 0 0 0 0 0 0 1 1 1 1 2
## chr4 chr7 chr22 chrX chr3 chr6 chr12 chr20 chr8 chr15 chr19 chr11
## 2 2 2 2 3 3 3 3 4 4 4 5
## chr17
## 5
Other features
As described in Figure 1, recount2 provides data for expression features beyond genes. In this section we perform a differential expression analysis using the 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 differential expression 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, and then perform the differential expression analysis using limma-voom
.
## Download the data if it is not there
if(!file.exists(file.path(local_path, "rse_exon.Rdata"))) {
## In case you decide to download the data instead of using the
## pre-installed data
local_path <- "SRP056604"
download_study("SRP056604", type = "rse-exon")
}
## Load the data
load(file.path(local_path, "rse_exon.Rdata"))
## Scale and add the metadata (it is in the same order)
identical(colData(rse_exon)$run, colData(rse_gene_scaled)$run)
## [1] TRUE
colData(rse_exon) <- colData(rse_gene_scaled)
rse_exon_scaled <- scale_counts(rse_exon)
## To highlight that we scaled the counts
rm(rse_exon)
## Filter lowly expressed exons: reduces the object size
## and run time
filter_exon <- rowMeans(assays(rse_exon_scaled)$counts) > 5
round(table(filter_exon) / length(filter_exon) * 100, 2)
## filter_exon
## FALSE TRUE
## 62.88 37.12
## Perform the filtering and change default names
rse_e <- rse_exon_scaled[filter_exon, ]
rowRanges(rse_e)$gene_id <- rownames(rse_e)
rownames(rse_e) <- paste0("exon_", seq_len(nrow(rse_e)))
## Create DESeq2 object for the exon data
dds_exon <- DESeqDataSet(rse_e, ~ sex + age + pmi + case)
## converting counts to integer mode
## the design formula contains a numeric variable with integer values,
## specifying a model with increasing fold change for higher values.
## did you mean for this to be a factor? if so, first convert
## this variable to a factor using the factor() function
## Perform DE analysis
dds_exon <- DESeq(dds_exon, test = "LRT", reduced = ~ sex + age + pmi,
fitType = "local")
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
res_exon <- results(dds_exon, contrast = c('case', 'LOAD', 'control'),
alpha = 0.01)
## Explore results
plotMA(dds_exon, main="DESeq2 results for SRP056604 -exon level",
contrast = c('case', 'LOAD', 'control'), alpha = 0.01)
plot_volcano(res_exon, FDR = 0.01)
Just like at the gene level, we see several exons differentially expressed between LOAD and controls samples. 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.
## Get the gene ids for genes that are DE at the gene level or that have at
## least one exon with DE signal.
genes_w_de_exon <- unique(rowRanges(rse_e)$gene_id[which(res_exon$padj < 0.01)])
genes_de <- rownames(rse_gene_scaled)[which(res$padj < 0.01)]
## Make a venn diagram
library("gplots")
vinfo <- venn(list("genes" = genes_de, "exons" = genes_w_de_exon),
names = c("genes", "exons"), show.plot = FALSE)
plot(vinfo) +
title("Genes with DE signal: at the gene and exon levels")
## integer(0)
Not all differentially expressed genes have differentially expressed exons, nor genes with at least one differentially expressed exon are necessarily differentially expressed. This is in line with what was described in Figure 2B of Soneson et al., 2015 (24).
This was just a quick example of how we can perform differential expression 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 at al., 2018 (25). 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 below.
## Keep only the DE exons that are from a gene that is also DE
top_exon_de <- res_exon[intersect(which(res_exon$padj < 0.01),
which(rowRanges(rse_e)$gene_id %in%
attr(vinfo, "intersections")[["genes:exons"]])), ]
## Add the gene id
top_exon_de$gene_id <- rowRanges(rse_e)$gene_id[match(rownames(top_exon_de),
rownames(rse_e))]
## Find the fold change that is the most extreme among the DE exons of a gene
exon_max_fc <- tapply(top_exon_de$log2FoldChange, top_exon_de$gene_id,
function(x) { x[which.max(abs(x))] })
## Keep only the DE genes that match the previous selection
top_gene_de <- res[match(names(exon_max_fc), rownames(res)), ]
## Make the plot
plot(top_gene_de$log2FoldChange, exon_max_fc, pch = 20,
col = adjustcolor("black", 1/2),
ylab = "Most extreme log FC at the exon level among DE exons",
xlab = "Log fold change (FC) at the gene level",
main = "DE genes with at least one DE exon")
abline(a = 0, b = 1, col = "red")
abline(h = 0, col = "grey80")
abline(v = 0, col = "grey80")
The fold change for most exons shown above agrees with the gene level fold change. In data from other projects, some of the fold changes 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
(9). 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
(26) 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 12 for the SRP056604 project. We chose chromosome 12 based on the number of DE genes per chromosome
sort(table(seqnames(rowRanges(rse_gene_scaled)[which(res$padj < 0.01)])),
decreasing = TRUE)
##
## chr1 chr7 chr12 chrM chr6 chr15 chr2 chr17 chr11 chr14 chr19 chr4
## 10 8 7 7 6 6 5 5 4 4 4 3
## chr5 chr9 chr10 chr16 chr21 chr22 chr3 chr8 chr13 chr18 chrX chr20
## 3 3 3 3 3 3 2 2 2 2 2 1
## chrY
## 0
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()
.
## Define expressed regions for study SRP056604, only for chromosome 12
regions <- expressed_regions("SRP056604", "chr12", cutoff = 5L,
maxClusterGap = 3000L, outdir = local_path)
## 2019-06-22 02:02:10 loadCoverage: loading BigWig file /usr/local/lib/R/site-library/recountWorkshop2019/extdata/SRP056604/bw/mean_SRP056604.bw
## 2019-06-22 02:02:27 loadCoverage: applying the cutoff to the merged data
## 2019-06-22 02:03:33 filterData: originally there were 133275309 rows, now there are 133275309 rows. Meaning that 0 percent was filtered.
## 2019-06-22 02:03:33 findRegions: identifying potential segments
## 2019-06-22 02:03:33 findRegions: segmenting information
## 2019-06-22 02:03:33 .getSegmentsRle: segmenting with cutoff(s) 5
## 2019-06-22 02:03:39 findRegions: identifying candidate regions
## 2019-06-22 02:03:41 findRegions: identifying region clusters
## Explore the resulting expressed regions
regions
## GRanges object with 45415 ranges and 6 metadata columns:
## seqnames ranges strand | value
## <Rle> <IRanges> <Rle> | <numeric>
## 1 chr12 14557-14609 * | 5.51228961404764
## 2 chr12 14694-14944 * | 18.5175433177872
## 3 chr12 15085-15153 * | 32.1930030463398
## 4 chr12 15489-15589 * | 15.5183322169993
## 5 chr12 15889-16065 * | 51.5721219623156
## ... ... ... ... . ...
## 45411 chr12 133204363-133204806 * | 14.7140764245042
## 45412 chr12 133205808-133205818 * | 5.28275680541992
## 45413 chr12 133206109-133206245 * | 9.16745478219359
## 45414 chr12 133206247-133206273 * | 5.30814688294022
## 45415 chr12 133206625-133206646 * | 5.22780539772727
## area indexStart indexEnd cluster clusterL
## <numeric> <integer> <integer> <Rle> <Rle>
## 1 292.151349544525 14557 14609 1 16374
## 2 4647.90337276459 14694 14944 1 16374
## 3 2221.31721019745 15085 15153 1 16374
## 4 1567.35155391693 15489 15589 1 16374
## 5 9128.26558732986 15889 16065 1 16374
## ... ... ... ... ... ...
## 45411 6533.04993247986 133204363 133204806 4711 4503
## 45412 58.1103248596191 133205808 133205818 4711 4503
## 45413 1255.94130516052 133206109 133206245 4711 4503
## 45414 143.319965839386 133206247 133206273 4711 4503
## 45415 115.01171875 133206625 133206646 4711 4503
## -------
## seqinfo: 1 sequence from an unspecified genome
summary(width(regions))
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.0 9.0 61.0 88.3 120.0 5483.0
table(width(regions) >= 60)
##
## FALSE TRUE
## 22465 22950
## Keep only the ones that are at least 60 bp long
regions <- regions[width(regions) >= 60]
length(regions)
## [1] 22950
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()
by defaults scales the counts. We will round them to integers in order to use DESeq2
.
## Compute coverage matrix for study SRP056604, only for chromosome 12
## Takes about 45 seconds with local data
## and about 70 seconds with data from the web (outdir = NULL)
system.time(rse_er <- coverage_matrix("SRP056604", "chr12", regions,
chunksize = length(regions), outdir = local_path, round = TRUE))
## 2019-06-22 02:03:50 railMatrix: processing regions 1 to 22950
## 2019-06-22 02:03:50 railMatrix: processing file /usr/local/lib/R/site-library/recountWorkshop2019/extdata/SRP056604/bw/SRR1931819.bw
## 2019-06-22 02:03:55 railMatrix: processing file /usr/local/lib/R/site-library/recountWorkshop2019/extdata/SRP056604/bw/SRR1931818.bw
## 2019-06-22 02:03:59 railMatrix: processing file /usr/local/lib/R/site-library/recountWorkshop2019/extdata/SRP056604/bw/SRR1931817.bw
## 2019-06-22 02:04:03 railMatrix: processing file /usr/local/lib/R/site-library/recountWorkshop2019/extdata/SRP056604/bw/SRR1931816.bw
## 2019-06-22 02:04:07 railMatrix: processing file /usr/local/lib/R/site-library/recountWorkshop2019/extdata/SRP056604/bw/SRR1931815.bw
## 2019-06-22 02:04:13 railMatrix: processing file /usr/local/lib/R/site-library/recountWorkshop2019/extdata/SRP056604/bw/SRR1931814.bw
## 2019-06-22 02:04:17 railMatrix: processing file /usr/local/lib/R/site-library/recountWorkshop2019/extdata/SRP056604/bw/SRR1931813.bw
## 2019-06-22 02:04:23 railMatrix: processing file /usr/local/lib/R/site-library/recountWorkshop2019/extdata/SRP056604/bw/SRR1931812.bw
## user system elapsed
## 30.814 2.656 37.624
## Use the expanded metadata we built for the gene model
colData(rse_er) <- colData(rse_gene_scaled)
Now that we have an integer count matrix for the expressed regions, we can proceed with the differential expression analysis just like we did at the gene and exon feature levels.
## Define DESeq2 object
dds_er <- DESeqDataSet(rse_er, ~ sex + age + pmi + case)
## converting counts to integer mode
## the design formula contains a numeric variable with integer values,
## specifying a model with increasing fold change for higher values.
## did you mean for this to be a factor? if so, first convert
## this variable to a factor using the factor() function
dds_er <- DESeq(dds_er, test = "LRT", reduced = ~ sex + age + pmi,
fitType = "local")
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
res_er <- results(dds_er, alpha = 0.05, contrast = c('case', 'LOAD', 'control'))
## Visually inspect results
plotMA(res_er, main="DESeq2 results for SRP056604 - DERs",
contrast = c('case', 'LOAD', 'control'), alpha = 0.05)
## Warning in plot.window(...): "contrast" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "contrast" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...): "contrast" is
## not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...): "contrast" is
## not a graphical parameter
## Warning in box(...): "contrast" is not a graphical parameter
## Warning in title(...): "contrast" is not a graphical parameter
plot_volcano(res_er, FDR = 0.05)
We can also create a report, just like before.
DESeq2Report(dds_er, res = res_er, project = "SRP056604 - DERs",
intgroup = c("sex", "case"), outdir = ".",
output = "SRP056604_DERs")
Having identified the differentially expressed regions (DERs), we can sort all regions by their adjusted p-value.
## Sort regions by q-value
regions_by_padj <- regions[order(res_er$padj, decreasing = FALSE)]
## Look at the top 10
regions_by_padj[1:10]
## GRanges object with 10 ranges and 6 metadata columns:
## seqnames ranges strand | value
## <Rle> <IRanges> <Rle> | <numeric>
## 19184 chr12 56652770-56653028 * | 7.86537271853119
## 19183 chr12 56646007-56646220 * | 49.9344735880878
## 19191 chr12 56660076-56660174 * | 6.98547002040979
## 3971 chr12 6968608-6968702 * | 6.2045835745962
## 19211 chr12 56666626-56666848 * | 10.0683972782084
## 19226 chr12 56670429-56670523 * | 7.24982975909584
## 3545 chr12 6581473-6581591 * | 104.96965337
## 19189 chr12 56657528-56657606 * | 5.61126856260662
## 39548 chr12 120645698-120646104 * | 24.1329821392125
## 19200 chr12 56662428-56662558 * | 6.35009503182564
## area indexStart indexEnd cluster clusterL
## <numeric> <integer> <integer> <Rle> <Rle>
## 19184 2037.13153409958 56652770 56653028 1996 36189
## 19183 10685.9773478508 56646007 56646220 1995 10725
## 19191 691.561532020569 56660076 56660174 1996 36189
## 3971 589.435439586639 6968608 6968702 309 5639
## 19211 2245.25259304047 56666626 56666848 1996 36189
## 19226 688.733827114105 56670429 56670523 1996 36189
## 3545 12491.38875103 6581473 6581591 286 86353
## 19189 443.290216445923 56657528 56657606 1996 36189
## 39548 9822.12373065948 120645698 120646104 4162 26897
## 19200 831.862449169159 56662428 56662558 1996 36189
## -------
## seqinfo: 1 sequence from an unspecified genome
width(regions_by_padj[1:10])
## [1] 259 214 99 95 223 95 119 79 407 131
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
(27), wiggleplotr
(28) and derfinderPlot
(9). 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. For this workshop, we have the data locally so we will use those files.
## Construct the list of BigWig URLs
## They have the following form:
## http://duffel.rail.bio/recount/
## project id
## /bw/
## sample run id
## .bw
bws_web <- paste0("http://duffel.rail.bio/recount/SRP056604/bw/",
colData(rse_er)$bigwig_file)
## Note that they are also present in the recount_url data.frame
bws_url <- recount_url$url[match(colData(rse_er)$bigwig_file,
recount_url$file_name)]
identical(bws_web, bws_url)
## [1] TRUE
## Local bigwigs
bws <- file.path(local_path, "bw", colData(rse_er)$bigwig_file)
all(file.exists(bws))
## [1] TRUE
## Use the sample run ids as the sample names
names(bws) <- colData(rse_er)$run
We will visualize the DERs using derfinderPlot
, similar to what was done in Jaffe et al., 2015 (29). We will first add a little padding to the regions: 100 base-pairs on each side.
## Add 100 bp padding on each side
regions_resized <- resize(regions_by_padj[1:10],
width(regions_by_padj[1:10]) + 200, fix = "center")
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.
## Get the bp coverage data for the plots
library("derfinder")
regionCov <- getRegionCoverage(regions = regions_resized, files = bws,
targetSize = 40 * 1e6 * 100, totalMapped = colData(rse_er)$auc,
verbose = FALSE)
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, we first need to import the data. Since we are working only with chromosome 21 for this example, we can then subset it. Next we need to add the relevant chromosome information. Some of the annotation functions we will 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.
## Import the Gencode v25 hg38 gene annotation
library("rtracklayer")
## Check if the file exists locally (already subsetted to chr12)
gtf_file <- system.file("extdata", "gencode.v25.annotation.chr12.gtf.gz",
package = "recountWorkshop2019")
## If the file doesn't exist, use the data from the web
gtf_file <- ifelse(file.exists(gtf_file), gtf_file, paste0(
"ftp://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_25/",
"gencode.v25.annotation.gtf.gz")
)
## Import the GTF file
gencode_v25_hg38 <- import(gtf_file)
## Keep only the chr12 info
gencode_v25_hg38 <- keepSeqlevels(gencode_v25_hg38, "chr12",
pruning.mode = "coarse")
## Get the chromosome information for hg38
library("GenomicFeatures")
chrInfo <- getChromInfoFromUCSC("hg38")
## Download and preprocess the 'chrominfo' data frame ... OK
chrInfo$chrom <- as.character(chrInfo$chrom)
chrInfo <- chrInfo[chrInfo$chrom %in% seqlevels(regions), ]
chrInfo$isCircular <- FALSE
## Assign the chromosome information to the object we will use to
## create the txdb object
si <- with(chrInfo, Seqinfo(as.character(chrom), length, isCircular,
genome = "hg38"))
seqinfo(gencode_v25_hg38) <- si
## Switch from Gencode gene ids to Ensembl gene ids
gencode_v25_hg38$gene_id <- gsub("\\..*", "", gencode_v25_hg38$gene_id)
## Create the TxDb object
gencode_v25_hg38_txdb <- makeTxDbFromGRanges(gencode_v25_hg38)
## Warning in .get_cds_IDX(type, phase): The "phase" metadata column contains non-NA values for features of
## type stop_codon. This information was ignored.
## Explore the TxDb object
gencode_v25_hg38_txdb
## TxDb object:
## # Db type: TxDb
## # Supporting package: GenomicFeatures
## # Genome: hg38
## # transcript_nrow: 11419
## # exon_nrow: 39709
## # cds_nrow: 15918
## # Db created by: GenomicFeatures package from Bioconductor
## # Creation time: 2019-06-22 02:06:16 +0000 (Sat, 22 Jun 2019)
## # GenomicFeatures version at creation time: 1.37.1
## # RSQLite version at creation time: 2.1.1
## # DBSCHEMAVERSION: 1.2
Now that we have a TxDb object for Gencode v25 on hg38 coordinates, we can use bumphunter
’s (30) 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.
library("bumphunter")
## Annotate all transcripts for gencode v25 based on the TxDb object
## we built previously.
ann_gencode_v25_hg38 <- annotateTranscripts(gencode_v25_hg38_txdb,
annotationPackage = "org.Hs.eg.db",
mappingInfo = list("column" = "ENTREZID", "keytype" = "ENSEMBL",
"multiVals" = "first"))
## Getting TSS and TSE.
## Getting CSS and CSE.
## Getting exons.
## Annotating genes.
## 'select()' returned 1:many mapping between keys and columns
## Annotate the regions of interest
## Note that we are using the original regions, not the resized ones
nearest_ann <- matchGenes(regions_by_padj[1:10], ann_gencode_v25_hg38)
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()
.
## Create the genomic state object using the gencode TxDb object
gs_gencode_v25_hg38 <- makeGenomicState(gencode_v25_hg38_txdb,
chrs = seqlevels(regions))
## 'select()' returned 1:1 mapping between keys and columns
## Annotate the original regions
regions_ann <- annotateRegions(regions_resized,
gs_gencode_v25_hg38$fullGenome)
## 2019-06-22 02:07:20 annotateRegions: counting
## 2019-06-22 02:07:20 annotateRegions: annotating
We can finally use plotRegionCoverage()
to visualize the top 10 regions coloring by whether they are LOAD or control samples. Known exons are shown in dark blue, introns in light blue.
library("derfinderPlot")
plotRegionCoverage(regions = regions_resized, regionCoverage = regionCov,
groupInfo = colData(rse_er)$case,
nearestAnnotation = nearest_ann,
annotatedRegions = regions_ann,
txdb = gencode_v25_hg38_txdb,
scalefac = 1, ylab = "Coverage (RP40M, 100bp)",
ask = FALSE, verbose = FALSE)
In the previous plots we can see that some DERs are longer than known exons, others match known exons, and some are un-annotated expressed regions.
Summary
In this workshop 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 including from recount-brain
. We showed how to perform a differential expression 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 workshop constitutes a strong basis to leverage the recount2 and recount-brain
data for human RNA-seq analyses.
Session information
## Pandoc information
rmarkdown::pandoc_version()
## [1] '2.3.1'
## Time for reproducing this workflow, in minutes
round(proc.time()[3] / 60, 1)
## elapsed
## 15.6
options(width = 100)
library("sessioninfo")
session_info()
## Warning in system("timedatectl", intern = TRUE): running command 'timedatectl' had status 1
## ─ Session info ───────────────────────────────────────────────────────────────────────────────────
## setting value
## version R version 3.6.0 (2019-04-26)
## os Debian GNU/Linux 9 (stretch)
## system x86_64, linux-gnu
## ui X11
## language (EN)
## collate en_US.UTF-8
## ctype en_US.UTF-8
## tz Etc/UTC
## date 2019-06-22
##
## ─ Packages ───────────────────────────────────────────────────────────────────────────────────────
## package * version date lib
## acepack 1.4.1 2016-10-29 [1]
## annotate 1.63.0 2019-05-02 [1]
## AnnotationDbi * 1.47.0 2019-05-02 [1]
## AnnotationFilter 1.9.0 2019-05-02 [1]
## AnnotationForge 1.27.0 2019-05-02 [1]
## assertthat 0.2.1 2019-03-21 [1]
## backports 1.1.4 2019-04-10 [1]
## base64enc 0.1-3 2015-07-28 [1]
## BiasedUrn 1.07 2015-12-28 [1]
## bibtex 0.4.2 2017-06-30 [1]
## Biobase * 2.45.0 2019-05-02 [1]
## BiocGenerics * 0.31.4 2019-06-10 [1]
## BiocManager * 1.30.4 2018-11-13 [1]
## BiocParallel * 1.19.0 2019-05-02 [1]
## BiocStyle 2.13.2 2019-06-12 [1]
## biomaRt 2.41.3 2019-06-06 [1]
## Biostrings 2.53.0 2019-05-02 [1]
## biovizBase 1.33.0 2019-05-02 [1]
## bit 1.1-14 2018-05-29 [1]
## bit64 0.9-7 2017-05-08 [1]
## bitops 1.0-6 2013-08-17 [1]
## blob 1.1.1 2018-03-25 [1]
## blogdown 0.13.1 2019-06-22 [1]
## bookdown 0.11.1 2019-06-20 [1]
## BSgenome 1.53.0 2019-05-04 [1]
## bumphunter * 1.27.0 2019-05-02 [1]
## Category 2.51.0 2019-05-02 [1]
## caTools 1.17.1.2 2019-03-06 [1]
## checkmate 1.9.3 2019-05-03 [1]
## cli 1.1.0 2019-03-19 [1]
## cluster 2.0.8 2019-04-05 [2]
## clusterProfiler * 3.13.0 2019-05-02 [1]
## codetools 0.2-16 2018-12-24 [2]
## colorspace 1.4-1 2019-03-18 [1]
## cowplot 0.9.4 2019-01-08 [1]
## crayon 1.3.4 2017-09-16 [1]
## crosstalk 1.0.0 2016-12-21 [1]
## curl 3.3 2019-01-10 [1]
## d3heatmap 0.6.1.2 2018-02-01 [1]
## data.table 1.12.2 2019-04-07 [1]
## DBI 1.0.0 2018-05-02 [1]
## DEFormats 1.13.0 2019-05-02 [1]
## DelayedArray * 0.11.2 2019-06-17 [1]
## derfinder * 1.19.2 2019-06-10 [1]
## derfinderHelper 1.19.1 2019-05-22 [1]
## derfinderPlot * 1.19.1 2019-05-22 [1]
## DESeq2 * 1.25.1 2019-06-07 [1]
## dichromat 2.0-0 2013-01-24 [1]
## digest 0.6.19 2019-05-20 [1]
## DO.db 2.9 2019-06-17 [1]
## doParallel 1.0.14 2018-09-24 [1]
## doRNG 1.7.1 2018-06-22 [1]
## DOSE 3.11.0 2019-05-02 [1]
## downloader 0.4 2015-07-09 [1]
## dplyr 0.8.1 2019-05-14 [1]
## DT 0.7 2019-06-11 [1]
## edgeR 3.27.5 2019-06-17 [1]
## enrichplot 1.5.0 2019-05-02 [1]
## ensembldb 2.9.2 2019-06-08 [1]
## europepmc 0.3 2018-04-20 [1]
## evaluate 0.14 2019-05-28 [1]
## farver 1.1.0 2018-11-20 [1]
## fastmatch 1.1-0 2017-01-28 [1]
## fdrtool 1.2.15 2015-07-08 [1]
## fgsea 1.11.0 2019-05-02 [1]
## foreach * 1.4.4 2017-12-12 [1]
## foreign 0.8-71 2018-07-20 [2]
## Formula 1.2-3 2018-05-03 [1]
## gdata 2.18.0 2017-06-06 [1]
## genefilter 1.67.1 2019-05-11 [1]
## geneLenDataBase 1.21.0 2019-05-05 [1]
## geneplotter 1.63.0 2019-05-02 [1]
## GenomeInfoDb * 1.21.1 2019-05-15 [1]
## GenomeInfoDbData 1.2.1 2019-06-17 [1]
## GenomicAlignments 1.21.2 2019-05-12 [1]
## GenomicFeatures * 1.37.1 2019-05-24 [1]
## GenomicFiles 1.21.0 2019-05-02 [1]
## GenomicRanges * 1.37.12 2019-06-17 [1]
## GEOquery 2.53.0 2019-05-02 [1]
## GGally 1.4.0 2018-05-17 [1]
## ggbio 1.33.0 2019-05-02 [1]
## ggforce 0.2.2 2019-04-23 [1]
## ggplot2 3.2.0 2019-06-16 [1]
## ggplotify 0.0.3 2018-08-03 [1]
## ggraph 1.0.2 2018-07-07 [1]
## ggrepel 0.8.1 2019-05-07 [1]
## ggridges 0.5.1 2018-09-27 [1]
## glue 1.3.1 2019-03-12 [1]
## GO.db * 3.8.2 2019-06-17 [1]
## GOSemSim 2.11.0 2019-05-02 [1]
## goseq 1.37.0 2019-05-02 [1]
## GOstats 2.51.0 2019-05-02 [1]
## gplots * 3.0.1.1 2019-01-27 [1]
## graph * 1.63.0 2019-05-02 [1]
## gridBase 0.4-7 2014-02-24 [1]
## gridExtra 2.3 2017-09-09 [1]
## gridGraphics 0.4-1 2019-05-20 [1]
## GSEABase 1.47.0 2019-05-02 [1]
## gtable 0.3.0 2019-03-25 [1]
## gtools 3.8.1 2018-06-26 [1]
## highr 0.8 2019-03-20 [1]
## Hmisc 4.2-0 2019-01-26 [1]
## hms 0.4.2 2018-03-10 [1]
## htmlTable 1.13.1 2019-01-07 [1]
## htmltools 0.3.6 2017-04-28 [1]
## htmlwidgets 1.3 2018-09-30 [1]
## httpuv 1.5.1 2019-04-05 [1]
## httr 1.4.0 2018-12-11 [1]
## ideal * 1.9.0 2019-05-02 [1]
## igraph 1.2.4.1 2019-04-22 [1]
## IHW 1.13.0 2019-05-02 [1]
## IRanges * 2.19.10 2019-06-11 [1]
## iterators * 1.0.10 2018-07-13 [1]
## jsonlite 1.6 2018-12-07 [1]
## KernSmooth 2.23-15 2015-06-29 [2]
## knitcitations 1.0.8 2017-07-04 [1]
## knitr 1.23 2019-05-18 [1]
## knitrBootstrap 1.0.2 2018-05-24 [1]
## labeling 0.3 2014-08-23 [1]
## later 0.8.0 2019-02-11 [1]
## lattice 0.20-38 2018-11-04 [2]
## latticeExtra 0.6-28 2016-02-09 [1]
## lazyeval 0.2.2 2019-03-15 [1]
## limma 3.41.5 2019-06-17 [1]
## locfit * 1.5-9.1 2013-04-20 [1]
## lpsymphony 1.13.0 2019-05-02 [1]
## lubridate 1.7.4 2018-04-11 [1]
## magrittr 1.5 2014-11-22 [1]
## markdown 1.0 2019-06-07 [1]
## MASS 7.3-51.4 2019-03-31 [2]
## Matrix 1.2-17 2019-03-22 [2]
## matrixStats * 0.54.0 2018-07-23 [1]
## memoise 1.1.0 2017-04-21 [1]
## mgcv 1.8-28 2019-03-21 [2]
## mime 0.7 2019-06-11 [1]
## munsell 0.5.0 2018-06-12 [1]
## nlme 3.1-139 2019-04-09 [2]
## NMF 0.21.0 2018-03-06 [1]
## nnet 7.3-12 2016-02-02 [2]
## org.Hs.eg.db * 3.8.2 2019-06-17 [1]
## OrganismDbi 1.27.0 2019-05-04 [1]
## pcaExplorer 2.11.1 2019-06-04 [1]
## pheatmap 1.0.12 2019-01-04 [1]
## pillar 1.4.1 2019-05-28 [1]
## pkgconfig 2.0.2 2018-08-16 [1]
## pkgmaker 0.27 2018-05-25 [1]
## plyr 1.8.4 2016-06-08 [1]
## png 0.1-7 2013-12-03 [1]
## polyclip 1.10-0 2019-03-14 [1]
## prettyunits 1.0.2 2015-07-13 [1]
## progress 1.2.2 2019-05-16 [1]
## promises 1.0.1 2018-04-13 [1]
## ProtGenerics 1.17.2 2019-05-13 [1]
## purrr 0.3.2 2019-03-15 [1]
## qvalue 2.17.0 2019-05-02 [1]
## R6 2.4.0 2019-02-14 [1]
## RBGL 1.61.0 2019-05-02 [1]
## RColorBrewer 1.1-2 2014-12-07 [1]
## Rcpp 1.0.1 2019-03-17 [1]
## RCurl 1.95-4.12 2019-03-04 [1]
## readr 1.3.1 2018-12-21 [1]
## recount * 1.11.5 2019-06-10 [1]
## recountWorkshop2019 * 0.99.1 2019-06-18 [1]
## RefManageR 1.2.12 2019-04-03 [1]
## regionReport * 1.19.1 2019-05-22 [1]
## registry 0.5-1 2019-03-05 [1]
## rentrez 1.2.2 2019-05-02 [1]
## reshape 0.8.8 2018-10-23 [1]
## reshape2 1.4.3 2017-12-11 [1]
## Rgraphviz 2.29.0 2019-05-02 [1]
## rintrojs 0.2.2 2019-05-29 [1]
## rlang 0.3.4 2019-04-07 [1]
## rmarkdown 1.13 2019-05-22 [1]
## rngtools 1.3.1.1 2019-04-26 [1]
## rpart 4.1-15 2019-04-12 [2]
## Rsamtools 2.1.2 2019-05-09 [1]
## RSQLite 2.1.1 2018-05-06 [1]
## rstudioapi 0.10 2019-03-19 [1]
## rtracklayer * 1.45.1 2019-05-12 [1]
## rvcheck 0.1.3 2018-12-06 [1]
## S4Vectors * 0.23.13 2019-06-17 [1]
## scales 1.0.0 2018-08-09 [1]
## sessioninfo * 1.1.1 2018-11-05 [1]
## shiny 1.3.2 2019-04-22 [1]
## shinyAce 0.3.3 2019-01-03 [1]
## shinyBS 0.61 2015-03-31 [1]
## shinydashboard 0.7.1 2018-10-17 [1]
## slam 0.1-45 2019-02-26 [1]
## SparseM * 1.77 2017-04-23 [1]
## stringi 1.4.3 2019-03-12 [1]
## stringr 1.4.0 2019-02-10 [1]
## SummarizedExperiment * 1.15.3 2019-06-16 [1]
## survival 2.44-1.1 2019-04-01 [2]
## threejs 0.3.1 2017-08-13 [1]
## tibble 2.1.3 2019-06-06 [1]
## tidyr 0.8.3 2019-03-01 [1]
## tidyselect 0.2.5 2018-10-11 [1]
## topGO * 2.37.0 2019-05-02 [1]
## triebeard 0.3.0 2016-08-04 [1]
## tweenr 1.0.1 2018-12-14 [1]
## UpSetR 1.4.0 2019-05-22 [1]
## urltools 1.7.3 2019-04-14 [1]
## VariantAnnotation 1.31.3 2019-05-19 [1]
## viridis 0.5.1 2018-03-29 [1]
## viridisLite 0.3.0 2018-02-01 [1]
## withr 2.1.2 2018-03-15 [1]
## xfun 0.7 2019-05-14 [1]
## XML 3.98-1.20 2019-06-06 [1]
## xml2 1.2.0 2018-01-24 [1]
## xtable 1.8-4 2019-04-21 [1]
## XVector 0.25.0 2019-05-02 [1]
## yaml 2.2.0 2018-07-25 [1]
## zlibbioc 1.31.0 2019-05-02 [1]
## source
## CRAN (R 3.6.0)
## Bioconductor
## Bioconductor
## Bioconductor
## Bioconductor
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Bioconductor
## Bioconductor
## CRAN (R 3.6.0)
## Bioconductor
## Bioconductor
## Bioconductor
## Bioconductor
## Bioconductor
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Github (seandavi/blogdown@e8175c0)
## Github (seandavi/bookdown@90d1b71)
## Bioconductor
## Bioconductor
## Bioconductor
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Bioconductor
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Bioconductor
## Bioconductor
## Bioconductor
## Bioconductor
## Bioconductor
## Bioconductor
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Bioconductor
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Bioconductor
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Bioconductor
## Bioconductor
## Bioconductor
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Bioconductor
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Bioconductor
## Bioconductor
## Bioconductor
## Bioconductor
## Bioconductor
## Bioconductor
## Bioconductor
## Bioconductor
## Bioconductor
## Bioconductor
## CRAN (R 3.6.0)
## Bioconductor
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Bioconductor
## Bioconductor
## Bioconductor
## Bioconductor
## CRAN (R 3.6.0)
## Bioconductor
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Bioconductor
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Bioconductor
## CRAN (R 3.6.0)
## Bioconductor
## Bioconductor
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Bioconductor
## CRAN (R 3.6.0)
## Bioconductor (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Bioconductor
## Bioconductor
## Bioconductor
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Bioconductor
## CRAN (R 3.6.0)
## Bioconductor
## CRAN (R 3.6.0)
## Bioconductor
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Bioconductor
## Github (LieberInstitute/recountWorkshop2019@14d8066)
## CRAN (R 3.6.0)
## Bioconductor
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Bioconductor
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Bioconductor
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Bioconductor
## CRAN (R 3.6.0)
## Bioconductor
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Bioconductor
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Bioconductor
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Bioconductor
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## CRAN (R 3.6.0)
## Bioconductor
## CRAN (R 3.6.0)
## Bioconductor
##
## [1] /usr/local/lib/R/site-library
## [2] /usr/local/lib/R/library
Author contributions
LCT, AN and AEJ wrote the workflow from which this workshop is adapted. LCT wrote this workshop.
Competing interests
No competing interests were disclosed.
Grant information
LCT and AEJ were supported by NIH grant R21 MH109956-01.
Acknowledgments
We would like to acknowledge the Andrew Jaffe and Alexis Battle lab members for feedback on the explanatory pictures and the written recountWorkflow manuscript.
References
1. Collado-Torres L, Nellore A, Jaffe AE. Recount workflow: Accessing over 70,000 human rna-seq samples with bioconductor [version 1; referees: 1 approved, 2 approved with reservations]. F1000Research [Internet]. 2017; Available from: https://f1000research.com/articles/6-1558/v1
2. Huber W, Carey VJ, Gentleman R, Anders S, Carlson M, Carvalho BS, et al. Orchestrating high-throughput genomic analysis with bioconductor. Nature methods. 2015;12(2):115–21.
3. Law CW, Alhamdoosh M, Su S, Smyth GK, Ritchie ME. RNA-seq analysis is easy as 1-2-3 with limma, Glimma and edgeR. F1000Research. 2016;5(May):1408.
4. Love MI, Anders S, Kim V, Huber W. RNA-Seq workflow: gene-level exploratory analysis and differential expression. F1000Research. 2016;4(May):1070.
5. Chen Y, Lun ATL, Smyth GK. From reads to genes to pathways: differential expression analysis of RNA-Seq experiments using Rsubread and the edgeR quasi-likelihood pipeline. F1000Research. 2016;5(May):1438.
6. Frazee AC, Langmead B, Leek JT. ReCount: A multi-experiment resource of analysis-ready RNA-seq gene count datasets. BMC bioinformatics. 2011;12:449.
7. Himes, E. B, Jiang, X., Wagner, P., et al. RNA-Seq Transcriptome Profiling Identifies CRISPLD2 as a Glucocorticoid Responsive Gene that Modulates Cytokine Function in Airway Smooth Muscle Cells. PLoS ONE. 2014;9(6):e99625.
8. Collado-Torres L, Nellore A, Kammers K, Ellis SE, Taub MA, Hansen KD, et al. Reproducible RNA-seq analysis using recount2. Nature Biotechnology. 2017 Apr;35(4):319–21.
9. Collado-Torres L, Nellore A, Frazee AC, Wilks C, Love MI, Langmead B, et al. Flexible expressed region analysis for RNA-seq with derfinder. Nucleic Acids Research. 2017 Jan;45(2):e9–9.
10. Morgan M, Obenchain V, Hester J, Pagès H. SummarizedExperiment: SummarizedExperiment container. 2019.
11. Wilks C, Gaddipati P, Nellore A, Langmead B. Snaptron: Querying splicing patterns across tens of thousands of RNA-seq samples. Bioinformatics [Internet]. 2018 Jan [cited 2019 May 29];34(1):114–6. Available from: https://academic.oup.com/bioinformatics/article/34/1/114/4101942
12. Nellore A, Collado-Torres L, Jaffe AE, Alquicira-Hernández J, Wilks C, Pritt J, et al. Rail-RNA: Scalable analysis of RNA-seq splicing and coverage. Bioinformatics (Oxford, England). 2016 Sep;
13. Lawrence M, Huber W, Pages H, Aboyoun P, Carlson M, Gentleman R, et al. Software for computing and annotating genomic ranges. PLoS computational biology. 2013;9(8):e1003118.
14. Magistri M, Velmeshev D, Makhmutova M, Faghihi MA. Transcriptomics Profiling of Alzheimer’s Disease Reveal Neurovascular Defects, Altered Amyloid-β Homeostasis, and Deregulated Expression of Long Noncoding RNAs. Journal of Alzheimer’s disease: JAD. 2015;48(3):647–65.
15. Ellis SE, Collado-Torres L, Jaffe AE, Leek JT. Improving the value of public rna-seq expression data by phenotype prediction. Nucl Acids Res [Internet]. 2018; Available from: https://doi.org/10.1093/nar/gky102
16. Razmara A, Ellis SE, Sokolowski DJ, Davis S, Wilson MD, Leek JT, et al. Recount-brain: A curated repository of human brain rna-seq datasets metadata. bioRxiv [Internet]. 2019; Available from: https://doi.org/10.1101/618025
17. Colaprico A, Silva TC, Olsen C, Garofano L, Cava C, Garolini D, et al. TCGAbiolinks: An r/bioconductor package for integrative analysis of tcga data. Nucleic Acids Research. 2015;
18. Love MI, Huber W, Anders S. Moderated estimation of fold change and dispersion for rna-seq data with deseq2. Genome biology. 2014;15(12):1–21.
19. Marini F. Ideal: Interactive differential expression analysis [Internet]. 2018. Available from: http://bioconductor.org/packages/ideal/
20. Collado-Torres L, Jaffe AE, Leek JT. regionReport: Interactive reports for region-level and feature-level genomic analyses [version2; referees: 2 approved, 1 approved with reservations]. F1000Research. 2016 Jun;4:1–10.
21. Robinson MD, McCarthy DJ, Smyth GK. edgeR: a bioconductor package for differential expression analysis of digital gene expression data. Bioinformatics (Oxford, England). 2010 Jan;26(1):139–40.
22. Law CW, Chen Y, Shi W, Smyth GK. Voom: Precision weights unlock linear model analysis tools for rna-seq read counts. Genome Biol. 2014;15(2):R29.
23. Yu G, Wang L-G, Han Y, He Q-Y. ClusterProfiler: An r package for comparing biological themes among gene clusters. OMICS: A Journal of Integrative Biology. 2012;16(5):284–7.
24. Soneson C, Love MI, Robinson MD. Differential analyses for RNA-seq: transcript-level estimates improve gene-level inferences. [version 2; referees: 2 approved]. F1000Research. 2015;4(0):1521.
25. Jaffe AE, Straub RE, Shin JH, Tao R, Gao Y, Collado-Torres L, et al. Developmental and genetic regulation of the human cortex transcriptome illuminate schizophrenia pathogenesis. Nature Neuroscience [Internet]. 2018 Aug [cited 2019 Apr 9];21(8):1117. Available from: https://www.nature.com/articles/s41593-018-0197-y
26. Lawrence M, Gentleman R, Carey V. Rtracklayer: An r package for interfacing with genome browsers. Bioinformatics. 2009;25:1841–2.
27. Bravo HC, Chelaru F, Smith L, Goldstein N, Kancherla J, Walter M, et al. Epivizr: R interface to epiviz web app. 2019.
28. Alasoo K. Wiggleplotr: Make read coverage plots from bigwig files. 2019.
29. Jaffe AE, Shin J, Collado-Torres L, Leek JT, Tao R, Li C, et al. Developmental regulation of human cortex transcription and its clinical relevance at single base resolution. Nature Neuroscience. 2015 Jan;18(1):154–61.
30. Jaffe AE, Murakami P, Lee H, Leek JT, Fallin DM, Feinberg AP, et al. Bump hunting to identify differentially methylated regions in epigenetic epidemiology studies. International journal of epidemiology. 2012;41(1):200–9.