/usr/lib/R/site-library/SummarizedExperiment/doc/SummarizedExperiment.R is in r-bioc-summarizedexperiment 1.8.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | ## ----style, echo=FALSE, results='asis'-------------------------------------
BiocStyle::markdown()
## ----include = FALSE-------------------------------------------------------
# download current version of SE diagram
#download.file("https://docs.google.com/feeds/download/drawings/Export?id=18OcDb80FpvSGRYnFl-8vUqwNNLaNHrG1I9SWKHCselo&exportFormat=svg", "SE.svg")
download.file("https://docs.google.com/feeds/download/drawings/Export?id=1kiC8Qlo1mhSnLDqkGiRNPSo6GWn3C2duBszCFbJCB-g&exportFormat=svg", "SE.svg")
## ---- echo=FALSE-----------------------------------------------------------
suppressPackageStartupMessages(library(SummarizedExperiment))
suppressPackageStartupMessages(data(airway, package="airway"))
## --------------------------------------------------------------------------
library(SummarizedExperiment)
data(airway, package="airway")
se <- airway
se
## ----assays, eval = FALSE--------------------------------------------------
# assays(se)$counts
## ----assays_table, echo = FALSE--------------------------------------------
knitr::kable(assays(se)$counts[1:10,])
## ----rowRanges-------------------------------------------------------------
rowRanges(se)
## ----colData---------------------------------------------------------------
colData(se)
## ----columnSubset----------------------------------------------------------
# subset for only those samples treated with dexamethasone
se[, se$dex == "trt"]
## ----metadata--------------------------------------------------------------
metadata(se)
## ----metadata-formula------------------------------------------------------
metadata(se)$formula <- counts ~ dex + albut
metadata(se)
## ----constructRSE----------------------------------------------------------
nrows <- 200
ncols <- 6
counts <- matrix(runif(nrows * ncols, 1, 1e4), nrows)
rowRanges <- 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))
colData <- DataFrame(Treatment=rep(c("ChIP", "Input"), 3),
row.names=LETTERS[1:6])
SummarizedExperiment(assays=list(counts=counts),
rowRanges=rowRanges, colData=colData)
## ----constructSE-----------------------------------------------------------
SummarizedExperiment(assays=list(counts=counts), colData=colData)
## ----2d--------------------------------------------------------------------
# subset the first five transcripts and first three samples
se[1:5, 1:3]
## ----colDataExtraction-----------------------------------------------------
se[, se$cell == "N61311"]
## ----getSet----------------------------------------------------------------
counts <- matrix(1:15, 5, 3, dimnames=list(LETTERS[1:5], LETTERS[1:3]))
dates <- SummarizedExperiment(assays=list(counts=counts),
rowData=DataFrame(month=month.name[1:5], day=1:5))
# Subset all January assays
dates[rowData(dates)$month == "January", ]
## ----assay_assays----------------------------------------------------------
assays(se)
assays(se)[[1]][1:5, 1:5]
# assay defaults to the first assay if no i is given
assay(se)[1:5, 1:5]
assay(se, 1)[1:5, 1:5]
## ----overlap---------------------------------------------------------------
# Subset for only rows which are in the interval 100,000 to 110,000 of
# chromosome 1
roi <- GRanges(seqnames="1", ranges=100000:1100000)
subsetByOverlaps(se, roi)
## ----rseSubclass-----------------------------------------------------------
setClass("MyRSESubclass",
contains="RangedSummarizedExperiment",
representation=representation(
slot1="integer",
slot2="function"
## ... maybe more ...
)
)
|