||
SummarizedExperiment for Coordinating Experimental Assays, Samples, andRegions of Interest
我们经常操作的表,列为samples,行为observation,另外附带有meta-data 用于描述行或者列的信息,SummarizedExperiment提供一种方法:操作meta-data的同时也对assay进行了相应的操作。
第一部分:挖掘se
library(SummarizedExperiment)
data(airway, package="airway")
se <- airway
se
## class: RangedSummarizedExperiment ## dim: 64102 8 ## metadata(1): ''## assays(1): counts## rownames(64102): ENSG00000000003 ENSG00000000005 ... LRG_98 LRG_99## rowData names(0):## colnames(8): SRR1039508 SRR1039509 ... SRR1039520 SRR1039521## colData names(9): SampleName cell ... Sample BioSample
前面的是方法!
调用表达数据:
assays(se)$counts
调看samples数据:
colData(se)
调看基因feature信息
rowRanges(se)
rowData(se)
subset:
se[,se$dex==”trt”]
meta-data:
metadata(se)
第二部分:构建自己se
nrows<-200ncols<-6#assayscounts<-matrix(runif(nrows*ncols, 1, 1e4), nrows)#row features informationrowRanges<-GRanges(rep(c("chr1", "chr2"), c(50, 150)), IRanges(floor(runif(200, 1e5, 1e6)), width=100), strand=sample(c("+", "-"), 200, TRUE), feature_id=sprintf("ID%03d", 1:200))#sample informationcolData<-DataFrame(Treatment=rep(c("ChIP", "Input"), 3), row.names=LETTERS[1:6])#combine togetherSummarizedExperiment(assays=list(counts=counts), rowRanges=rowRanges, colData=colData)
#subsetting
# subset the first five transcripts and first three samplesse[1:5, 1:3]
$ operates on colData() columns, for easy sample extraction.
se[, se$cell == "N61311"]
assay不同于assays
# Subset for only rows which are in the interval 100,000to 110,000 of
# chromosome 1
依据row feature进行筛选
roi <- GRanges(seqnames="1", ranges=100000:1100000)
subsetByOverlaps(se, roi)
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-9-1 16:20
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社