/usr/share/doc/r-cran-phangorn/tests/testthat/test_pmlCluster.R is in r-cran-phangorn 2.4.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 | context("Stochastic partitioning")
tree1 <- read.tree(text = "((t1:0.3,t2:0.3):0.1,(t3:0.3,t4:0.3):0.1,t5:0.5);")
tree2 <- read.tree(text = "((t1:0.3,t3:0.3):0.1,(t2:0.3,t4:0.3):0.1,t5:0.5);")
gene1 <- simSeq(tree1, l=200)
gene2 <- simSeq(tree1, l=200)
gene3 <- simSeq(tree1, l=200)
gene4 <- simSeq(tree2, l=200)
gene5 <- simSeq(tree2, l=200)
X <- cbind(gene1, gene2, gene3, gene4, gene5)
weight <- xtabs(~ index+genes,attr(X, "index"))
fit <- pml(tree1, X)
fit <- optim.pml(fit, control=pml.control(trace=0))
test_that("nni optimisation works properly", {
skip_on_cran()
sp <- pmlCluster( ~ edge + nni, fit, weight, p=1:3)
# expect_equal( sp$Partition, c(1,1,1,2,2))
expect_equal( all(sp$Partition == c(1,1,1,2,2)) ||
all(sp$Partition == c(2,2,2,1,1)) , TRUE)
})
|