This file is indexed.

/usr/lib/R/site-library/Biostrings/unitTests/test_findPalindromes.R is in r-bioc-biostrings 2.46.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
###

test_findPalindromes_on_non_nucleotide_sequence <- function()
{
    text1 <- BString("ABCDCBA")
    current <- findPalindromes(text1, min.armlength=2)
    checkIdentical(IRanges(1, 7), ranges(current))
    current <- findPalindromes(text1, min.armlength=2, max.looplength=0)
    checkIdentical(IRanges(), ranges(current))

    text2 <- BString("xesopeReste etseReposeygohangasalamiImalasagnahogz")
    current <- findPalindromes(text2, max.looplength=2)
    checkIdentical(IRanges(c(2, 24), c(22, 49)), ranges(current))
    checkIdentical(c(10L, 12L), palindromeArmLength(current))

    text3 <- BString("AATAAACTNTCAAATYCCY")
    current <- findPalindromes(text3, min.armlength=2)
    checkIdentical(IRanges(c(1, 3, 16), c(5, 15, 19)), ranges(current))
}

test_findPalindromes_on_nucleotide_sequence <- function()
{
    x1 <- DNAString("AATAAACTNTCAAATYCCY")  # same sequence as 'text3'
    for (class in c("DNAString", "RNAString")) {
        x <- as(x1, class)
        current <- findPalindromes(x, min.armlength=2)
        checkIdentical(IRanges(), ranges(current))
        current <- findPalindromes(x, min.armlength=2, max.looplength=10)
        checkIdentical(IRanges(2, 15), ranges(current))
    }

    x2 <- DNAString("AATTT")
    for (class in c("DNAString", "RNAString")) {
        x <- as(x2, class)
        current <- findPalindromes(x, min.armlength=2)
        target <- IRanges(1, 4:5)
        checkIdentical(target, ranges(current))
        current <- findPalindromes(x, min.armlength=2, max.looplength=0)
        checkIdentical(target[1], ranges(current))
    }

    x3 <- DNAString("TTTAA")
    for (class in c("DNAString", "RNAString")) {
        x <- as(x3, class)
        current <- findPalindromes(x, min.armlength=2)
        target <- IRanges(1:2, 5)
        checkIdentical(target, ranges(current))
        current <- findPalindromes(x, min.armlength=2, max.looplength=0)
        checkIdentical(target[2], ranges(current))
    }

    x4 <- DNAString("AAATTT")
    for (class in c("DNAString", "RNAString")) {
        x <- as(x4, class)
        current <- findPalindromes(x, min.armlength=2)
        target <- IRanges(c(1, 1, 2), c(5, 6, 6))
        checkIdentical(target, ranges(current))
        current <- findPalindromes(x, min.armlength=3)
        checkIdentical(target[2], ranges(current))
        current <- findPalindromes(x, min.armlength=4)
        checkIdentical(target[0], ranges(current))
    }

    ## With nested palindromes.

    x5 <- DNAString("CTTGAAATTTGAAG")
    for (class in c("DNAString", "RNAString")) {
        x <- as(x5, class)
        target0 <- IRanges(c(2, 2, 5,  5,  1,  6,  8,  9),
                           c(6, 7, 9, 10, 14, 10, 13, 13))
        current <- findPalindromes(x, min.armlength=2, max.looplength=0)
        checkIdentical(target0[4], ranges(current))
        current <- findPalindromes(x, min.armlength=2, max.looplength=1)
        checkIdentical(target0[-c(2, 5, 7)], ranges(current))
        for (i in 2:7) {
            current <- findPalindromes(x, min.armlength=2, max.looplength=i)
            checkIdentical(target0[-5], ranges(current))
        }
        current <- findPalindromes(x, min.armlength=2, max.looplength=8)
        checkIdentical(target0, ranges(current))
    }

    x6 <- DNAString("AAGAATTGTT")
    for (class in c("DNAString", "RNAString")) {
        x <- as(x6, class)
        target0 <- IRanges(c(1, 4, 1, 4), c(7, 7, 10, 10))
        for (i in 0:2) {
            current <- findPalindromes(x, min.armlength=2, max.looplength=i)
            checkIdentical(target0[2], ranges(current))
        }
        for (i in 3:5) {
            current <- findPalindromes(x, min.armlength=2, max.looplength=i)
            checkIdentical(target0[-3], ranges(current))
        }
        current <- findPalindromes(x, min.armlength=2, max.looplength=6)
        checkIdentical(target0, ranges(current))
    }

    # With IUPAC ambiguity codes. Ambiguity codes are not allowed in the arms
    # of a palindrome!

    x7 <- DNAString("NNNNNN")
    for (class in c("DNAString", "RNAString")) {
        x <- as(x7, class)
        current <- findPalindromes(x, min.armlength=2)
        checkIdentical(IRanges(), ranges(current))
    }

    x8 <- DNAString("ACCGNAAATTTNCGGT")
    for (class in c("DNAString", "RNAString")) {
        x <- as(x8, class)
        current <- findPalindromes(x, min.armlength=2)
        checkIdentical(IRanges(c(6, 6, 7), c(10, 11, 11)), ranges(current))
        current <- findPalindromes(x, min.armlength=4)
        checkIdentical(IRanges(), ranges(current))
        current <- findPalindromes(x, min.armlength=3, max.looplength=8)
        checkIdentical(IRanges(c(6, 1), c(11, 16)), ranges(current))
    }
}

test_palindromeArmLength <- function()
{
    x2 <- DNAString("AATTT")
    for (class in c("DNAString", "RNAString")) {
        x <- as(x2, class)
        checkIdentical(2L, palindromeArmLength(x))
        pals <- findPalindromes(x, min.armlength=2)
        checkIdentical(c(2L, 2L), palindromeArmLength(pals))
    }

    x3 <- DNAString("TTTAA")
    for (class in c("DNAString", "RNAString")) {
        x <- as(x3, class)
        checkIdentical(2L, palindromeArmLength(x))
        pals <- findPalindromes(x, min.armlength=2)
        checkIdentical(c(2L, 2L), palindromeArmLength(pals))
    }

    x4 <- DNAString("AAATTT")
    for (class in c("DNAString", "RNAString")) {
        x <- as(x4, class)
        checkIdentical(3L, palindromeArmLength(x))
        pals <- findPalindromes(x, min.armlength=2)
        checkIdentical(c(2L, 3L, 2L), palindromeArmLength(pals))
    }

    x5 <- DNAString("CTTGAAATTTGAAG")
    for (class in c("DNAString", "RNAString")) {
        x <- as(x5, class)
        checkIdentical(3L, palindromeArmLength(x))
        pals <- findPalindromes(x, min.armlength=2, max.looplength=8)
        checkIdentical(c(2L, 2L, 2L, 3L, 3L, 2L, 2L, 2L),
                       palindromeArmLength(pals))
    }
}