This file is indexed.

/usr/lib/R/site-library/GenomicFeatures/unitTests/test_mapIdsToRanges.R is in r-bioc-genomicfeatures 1.30.0+dfsg-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
txdb <- local({
    fl <- system.file(package = "GenomicFeatures", "extdata",
                      "sample_ranges.rds")
    makeTxDbFromGRanges(readRDS(fl))
})

test_mapIdsToRanges_improper_inputs <- function()
{
    checkException(mapIdsToRanges(txdb, keys = ""),
        "must be a named list")

    checkException(mapIdsToRanges(txdb, keys = "ENST000000271582"),
        "must be a named list")

    checkException(mapIdsToRanges(txdb, keys = list("ENST000000271582")),
        "must be a named list")

    checkException(mapIdsToRanges(txdb,
                                  keys = list(tx_name = "ENST000000271582"),
                                  column = 1),
        "'columns' must be 'NULL' or a character vector")
}

test_mapIdsToRanges_same_order <- function()
{
    keys <- list(tx_name = c("ENST00000371582", "ENST00000371588",
        "ENST00000494752", "ENST00000614008", "ENST00000496771"))
    res <- mapIdsToRanges(txdb, keys = keys, type = "tx")
    checkEquals(names(res), keys[[1]])

    # shuffle the order and make sure it remains equivalent
    for (i in seq_len(10)) {
        keys$tx_name <- sample(keys$tx_name)
        res <- mapIdsToRanges(txdb, keys = keys, type = "tx")
        checkEquals(names(res), keys[[1]])
    }
}

test_mapIdsToRanges_missing_results <- function()
{
    keys <- list(tx_name = c("ENST00000371582", "NOT_FOUND", "ENST00000494752"))
    res <- mapIdsToRanges(txdb, keys = keys, type = "tx")
    checkEquals(names(res), keys$tx_name)

    # shuffle the order and make sure it remains equivalent
    for (i in seq_len(10)) {
        keys$tx_name <- sample(keys$tx_name)
        res <- mapIdsToRanges(txdb, keys = keys, type = "tx")
        checkEquals(names(res), keys$tx_name)
    }
}

test_mapIdsToRanges_duplicate_ranges <- function()
{
    # both of these transcripts are from the same gene
    keys <- list(tx_name = c("ENST00000371582", "ENST00000494752"))
    res <- mapIdsToRanges(txdb, keys = keys, type = "gene")

    #names match input
    checkEquals(names(res), keys[[1]])
    # but values are the same
    checkTrue(all.equal(res[[1]], res[[2]], check.attributes = FALSE))
}

test_mapIdsToRanges_duplicate_ids <- function() {
    keys <- list(tx_name = c("ENST00000371582", "ENST00000494752",
                             "ENST00000371582"))
    res <- mapIdsToRanges(txdb, keys = keys, type = "gene")
    checkEquals(names(res), keys[[1]])
    checkEquals(res[[1]], res[[3]])
}

test_mapRangesToIds_empty <- function()
{
    checkException(mapRangesToIds(txdb, NULL), list())

    checkException(mapRangesToIds(txdb, list()), list())
}

test_mapRangesToIds_matches <- function()
{
    keys <- list(tx_name = c("ENST00000371582", "ENST00000371588",
        "ENST00000494752", "ENST00000614008", "ENST00000496771"))
    res <- mapIdsToRanges(txdb, keys = keys, type = "gene")

    res2 <- mapRangesToIds(txdb, res, "tx")
    checkTrue(keys$tx_name[1] %in% res2[[1]]$tx_name)

    checkTrue(keys$tx_name[2] %in% res2[[2]]$tx_name)
}