/usr/lib/R/site-library/Biobase/doc/Qviews.R is in r-bioc-biobase 2.14.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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | ### R code from vignette source 'Qviews.Rnw'
###################################################
### code chunk number 1: doa
###################################################
if (!("Biobase" %in% search())) library(Biobase)
if (!("ALL" %in% search())) library(ALL)
if (!("ALL" %in% objects())) data(ALL)
###################################################
### code chunk number 2: getaEF (eval = FALSE)
###################################################
## library(Biobase)
## library(ALL)
## data(ALL)
## ALL
###################################################
### code chunk number 3: mkprov
###################################################
dataSource = function(dsn) {
if (!is(dsn, "character")) dsn = try(deparse(substitute(dsn)))
if (inherits(dsn, "try-error")) stop("can't parse dsn arg")
dd = data()$results
if (is.na(match(dsn, dd[,"Item"]))) return(NULL)
paste("package:", dd[ dd[,"Item"] == dsn, "Package" ], sep="")
}
###################################################
### code chunk number 4: newmeth
###################################################
setGeneric("peek", function(x,maxattr=10)standardGeneric("peek"))
setMethod("peek", c("eSet", "numeric"), function(x,maxattr=10) {
ds = dataSource(deparse(substitute(x)))
if (!is.null(ds)) ds = paste(" [from ", ds, "]", sep="")
else ds = ""
cat(deparse(substitute(x)), ds, ":\n", sep="")
cat("Platform annotation: ", annotation(x),"\n")
cat("primary assay results are:\n")
print(dim(x))
cat("sample attributes are:\n")
vn = rownames(varMetadata(x))
ld = substr(varMetadata(x)$labelDescription,1,50)
dd = data.frame("labelDescription[truncated]"=ld)
rownames(dd) = vn
if ((ndd <- nrow(dd)) <= maxattr) show(dd)
else {
cat("first", maxattr, "of", ndd, "attributes:\n")
show(dd[1:maxattr,,drop=FALSE])
}
cat("----------\n")
cat("use varTable to see values/freqs of all sample attributes\n")
cat("----------\n")
})
setMethod("peek", c("eSet", "missing"), function(x,maxattr=10) {
ds = dataSource(deparse(substitute(x)))
if (!is.null(ds)) ds = paste(" [from ", ds, "]", sep="")
else ds = ""
cat(deparse(substitute(x)), ds, ":\n", sep="")
cat("Platform annotation: ", annotation(x),"\n")
cat("primary assay results are:\n")
print(dim(x))
cat("sample attributes are:\n")
vn = rownames(varMetadata(x))
ld = substr(varMetadata(x)$labelDescription,1,50)
dd = data.frame("labelDescription[truncated]"=ld)
rownames(dd) = vn
if ((ndd <- nrow(dd)) <= maxattr) show(dd)
else {
cat("first", maxattr, "of", ndd, "attributes:\n")
show(dd[1:maxattr,,drop=FALSE])
}
cat("----------\n")
cat("use varTable to see values/freqs of all sample attributes\n")
cat("----------\n")
})
setGeneric("varTable", function(x, full=FALSE, max=Inf) standardGeneric("varTable"))
setMethod("varTable", c("eSet", "missing", "ANY"), function(x, full=FALSE, max=Inf) varTable(x, FALSE, max))
setMethod("varTable", c("eSet", "logical", "ANY"), function(x, full=FALSE, max=Inf) {
ans = lapply( names(pData(x)), function(z)table(x[[z]]) )
tans = lapply(ans, names)
kp = 1:min(max,length(tans))
if (!full) ans = sapply(tans, selectSome, 3)[kp]
else ans = tans[kp]
names(ans) = names(pData(x))[kp]
ans
})
setGeneric("varNames", function(x) standardGeneric("varNames"))
setMethod("varNames", "eSet", function(x) names(pData(x)))
###################################################
### code chunk number 5: lka
###################################################
peek(ALL)
###################################################
### code chunk number 6: lkv
###################################################
varNames(ALL)
###################################################
### code chunk number 7: lkvn
###################################################
varTable(ALL, max=4)
###################################################
### code chunk number 8: lkvn
###################################################
varTable(ALL, full=TRUE, max=4)
|