Simple example of use of the R object ExpressionSet
, ideal for the storage of gene expression or similarly structured omic data.
knitr::opts_chunk$set(message=FALSE, warning=FALSE, eval=TRUE) devtools::load_all(".") library(Biobase)
library(BS831) library(Biobase) # The package with the ExpressionSet definition, among others
ExpressionSet
objectAn expression set is a data object consisting of three entities: the expression matrix (exprs
), the phenotye data (pData
), and the feature data (fData
).
Figure 1: ExpressionSet object
We upload an expression set already available. It corresponds to a subset of samples from a gene expression dataset of head and neck squamous carcinoma (HNSC) primary tissue samples from the TCGA project.
# Load toy dataset data(HNSC_RNASeq_toy_ES) ## if BS831 not installed you can read the data from the Google Drive folder: ## HNSC_RNASeq_toy_ES <- readRDS(file.path(Sys.getenv("OMPATH"),"data/HNSC_RNASeq_toy_ES.rds")) ## rename for easier handling hnsc <- HNSC_RNASeq_toy_ES dim(hnsc) # the expression data dim(Biobase::pData(hnsc)) # the phenotypic annotation head(Biobase::pData(hnsc)) dim(Biobase::fData(hnsc)) # the genes' annotation head(Biobase::fData(hnsc))
One of the advantages of using an ExpressionSet is that the three component objects are always properly paired, and subsetting can be carried out straightforwardly.
tmp <- hnsc[1:100,1:10] dim(tmp) # the expression data dim(Biobase::pData(tmp)) # the phenotypic annotation dim(Biobase::fData(tmp)) # the genes' annotation
SummarizedExperiment
objectFigure 2: SummarizedExperiment object [source].
The ExpressionSet
is generally used for array-based experiments and gene expression data, where the rows are features, and the SummarizedExperiment
is generally used for sequencing-based experiments, where the rows are GenomicRanges.
ExpressionSet
to SummarizedExperiment
It is possible to easily map an ExpressionSet
to a SummarizedExperiment
.
library(SummarizedExperiment) sexp <- SummarizedExperiment::makeSummarizedExperimentFromExpressionSet(hnsc) names(assays(sexp)) head(SummarizedExperiment::colData(sexp)) # equivalent to pData head(SummarizedExperiment::rowData(sexp)) # equivalent to fData
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.