/usr/lib/R/site-library/Biostrings/UnitTests/runit-XString.R is in r-bioc-biostrings 2.32.1-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 | test_constructors <- function()
{
dst <- DNAString("ACGTAT") # just check this does not throw an error
checkException( dst <- DNAString("ACFTC") , silent=TRUE)
rst <- RNAString("ACGUAU") # just check this does not throw an error
checkException( rst <- RNAString("ACGTC") , silent=TRUE)
ast <- AAString("EQHIILF") # just check this does not throw an error
#checkException( ast <- AAString("ACXTCZ") , silent=TRUE) # AAString()
# doesn't check its input yet
}
test_alphabet <- function()
{
s <- BString("ACGTAT")
checkEquals(NULL, alphabet(s))
s <- DNAString("ACGTAT")
checkEquals(DNA_ALPHABET, alphabet(s))
}
test_length <- function()
{
rs <- "ACGTAT"
bs <- BString("ACGTAT")
checkEquals(nchar(rs), length(bs))
checkEquals(nchar(rs), nchar(bs))
}
test_subsetting <- function()
{
s <- BString("ACGT")
## out of bounds
checkException(s[10], silent=TRUE)
checkEquals("AT", as.character(s[c(1,4)]))
checkEquals("CGT", as.character(s[-1]))
## replacement
s[1] <- "T"
checkEquals("TCGT", as.character(s))
}
test_comparison <- function()
{
ref_str <- "ACGTA"
bs1_acgta <- BString(ref_str)
bs2_acgta <- BString(ref_str)
bs_aatt <- BString("AATT")
checkTrue(bs1_acgta == bs2_acgta)
checkTrue(ref_str == bs1_acgta)
checkTrue(bs1_acgta != bs_aatt)
ds1_acgta <- DNAString(ref_str)
ds2_acgta <- DNAString(ref_str)
checkTrue(ds1_acgta == ds2_acgta)
## comparison between instances of different XString subclasses
## not possible
checkException(bs1_acgta == ds1_acgta, silent=TRUE)
}
test_subseq <- function()
{
bs <- BString("ACGTA")
checkEquals("GTA", as.character(subseq(bs, start = 3))) # test "==" between "character"
# and "BString" done elsewhere
checkEquals("TA", as.character(subseq(bs, start = -2)))
}
|