/usr/lib/R/site-library/SummarizedExperiment/unitTests/test_nearest-methods.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 | ###
M1 <- matrix(1, 5, 3, dimnames=list(NULL, NULL))
M2 <- matrix(1, 3, 3, dimnames=list(NULL, NULL))
assaysList <- list(gr=SimpleList(m=M1), grl=SimpleList(m=M2))
rowRangesList <-
list(gr=GRanges("chr1", IRanges(1:5, 10)),
grl=split(GRanges("chr1", IRanges(1:5, 10)), c(1,1,2,2,3)))
names(rowRangesList[["grl"]]) <- NULL
colData <- DataFrame(x=letters[1:3])
## a list of one SE with GRanges and one with GRangesList
rseList <-
list(SummarizedExperiment(
assays=assaysList[["gr"]],
rowRanges=rowRangesList[["gr"]],
colData=colData),
SummarizedExperiment(
assays=assaysList[["grl"]],
rowRanges=rowRangesList[["grl"]],
colData=colData))
.GENERIC_SIGNATURES <- list(
precede=c("x", "subject"),
follow=c("x", "subject"),
nearest=c("x", "subject"),
distance=c("x", "y"),
distanceToNearest=c("x", "subject")
)
test_interfaces <- function()
{
method_signatures <- list(
c("RangedSummarizedExperiment", "ANY"),
c("ANY", "RangedSummarizedExperiment"),
c("RangedSummarizedExperiment", "RangedSummarizedExperiment")
)
for (fun in names(.GENERIC_SIGNATURES)) {
generic <- getGeneric(fun)
checkIdentical(.GENERIC_SIGNATURES[[fun]], generic@signature)
for (sig in method_signatures) {
method <- getMethod(fun, sig)
checkIdentical(formals(generic@.Data), formals(method@.Data))
}
}
}
test_nearest_methods <- function()
{
#for (i in 1:2) {
for (i in 1L) {
x <- rseList[[i]]
#for (j in 1:2) {
for (j in 1L) {
y <- rseList[[j]]
for (fun in names(.GENERIC_SIGNATURES)) {
fun <- get(fun)
target <- fun(rowRanges(x), rowRanges(y))
current <- fun(x, rowRanges(y))
checkIdentical(target, current)
current <- fun(rowRanges(x), y)
checkIdentical(target, current)
current <- fun(x, y)
checkIdentical(target, current)
}
}
}
}
|