The SummarizedExperiment container每个由数字或其他模式的类似矩阵的对象表示。
行通常表示感兴趣的基因组范围和列代表样品。
```{r front, child="front.Rmd", echo=FALSE}
```
## Dependencies
This document has the following dependencies:
[AppleScript] 纯文本查看 复制代码 ```{r dependencies, warning=FALSE, message=FALSE}
library(GenomicRanges)
library(airway)
library(Biobase)
```
Use the following commands to install these packages in R.
[AppleScript] 纯文本查看 复制代码
```{r biocLite, eval=FALSE}
source("http://www.bioconductor.org/biocLite.R")
biocLite(c("GenomicRanges", "airway"))
```
## Corrections
Improvements and corrections to this document can be submitted on its [GitHub](https://github.com/kasperdanielh ... rizedExperiment.Rmd) in its [repository](https://github.com/kasperdanielhansen/genbioconductor).
## Overview
展示`SummarizedExperiment` 类,`ExpressionSet`类的延伸,包含`GRanges`.
这个类适合存储处理过的数据
## Start
事例数据如下,存储为`SummarizedExperiment`类,这个数据展示为一个 RNA 序列的实验,我们只是为了用它说明这个类
[AppleScript] 纯文本查看 复制代码 ```{r airway}
library(airway)
data(airway)
airway
```
:
这看起来与“ExpressionSet”类似 - 但与之不同。
我们有8个样本和64102个特征(基因)。
对象的某些方面与“ExpressionSet”非常相似,虽然名称和类型略有不同:
`colData`包含表示(样本)信息,像“ExpressionSet”的`pData`。 它返回一个“DataFrame”而不是“data.frame”:
[AppleScript] 纯文本查看 复制代码
```{r colData}
colData(airway)
```
用 `$` 得到某一列:
[AppleScript] 纯文本查看 复制代码 ```{r getColumn}
airway$cell
```
`exptData` 如同 `experimentData` from `ExpressionSet`.
[AppleScript] 纯文本查看 复制代码
```{r exptData}
exptData(airway)#
```
`colnames` 类似 `sampleNames` (`ExpressionSet`中); `rownames` 如同 `featureNames`.
```{r names}
colnames(airway)
head(rownames(airway))
```
测量数据由“assay”和“assays”进行访问。 `assay(OBJECT, NAME)`可以包含多个测量矩阵(全部相同的维度)。 您可以通过“测定”获得所有这些,您可以通过`assay(OBJECT, NAME)`选择特定的一个,您可以在打印对象或使用“testNames”时查看名称。 在这种情况下,有一个叫`counts`的矩阵:
[AppleScript] 纯文本查看 复制代码 ```{r assay}
airway
assayNames(airway)
assays(airway)
head(assay(airway, "counts"))
```
到目前为止,这是所有可以存储在“ExpressionSet”中的信息。 新的事情是`SummarizedExperiment`允许一个代表不同功能的`rowRanges`(或`granges`)数据。 这个想法是这些“GRanges”告诉我们为特定功能汇总了哪一部分基因组。
[AppleScript] 纯文本查看 复制代码 ```{r rowRanges}
length(rowRanges(airway))
dim(airway)
rowRanges(airway)
```
In total we have around 64k "genes" or "transcripts" and around 745k different exons.
看看`rowRanges`是一个`GRangesList`(它也可以是一个'GRanges`)。 列表的每个元素都代表一个特征,并且该特征的“GRanges”告诉我们基因(或转录本)中外显子的坐标。 因为这些是基因,对于每个“GRanges”,所有范围应该具有相同的“strand”和“seqnames”,但是这不是强制的。
总共我们有大约64k“基因”或“转录本”和约745k个不同的外显子。
[AppleScript] 纯文本查看 复制代码 ```{r numberOfExons}
length(rowRanges(airway))
sum(elementNROWS(rowRanges(airway)))
```
对于某些操作,首先不需要使用`rowRanges`,可以直接在对象上使用操作。 这里有一个`start()`的例子:
[AppleScript] 纯文本查看 复制代码 ```{r start}
start(rowRanges(airway))
start(airway)
```
您可以使用`granges`作为`rowRanges`的同义词。
子集的工作方式如“ExpressionSet”:有两个维度,第一个维度是特征(基因),第二个维度是样本。
因为`SummarizedExperiment`包含一个`GRanges [List]`,你也可以使用`subsetByOverlaps`,就像
[AppleScript] 纯文本查看 复制代码 ```{r subsetByOverlaps}
gr <- GRanges(seqnames = "1", ranges = IRanges(start = 1, end = 10^7))
subsetByOverlaps(airway, gr)
```
|