/usr/share/doc/r-cran-phangorn/tests/testthat/test_modelTest.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 | context("modelTest")
X <- allSitePattern(4)
attr(X, "type") <- "DNA"
tree <- read.tree(text = "((t1:0.2,t2:0.3):0.1,t3:0.2,t4:0.3);")
fit <- pml(tree, X, k=4, bf = c(1:4)/10) # F81 + Gamma
weights <- 1000*exp(fit$site)
attr(X, "weight") <- weights
set.seed(42)
# tree <- read.tree(text = "((t1:0.2,t2:0.3):0.1,t3:0.2);")
Y <- simSeq(tree, l=500, type = "AA", model="WAG")
test_that("modelTest works properly", {
skip_on_cran()
MT <- modelTest(X, tree = tree,
control = pml.control(epsilon = 1e-08, maxit = 10, trace = 0))
expect_equal(MT$Model[which.min(MT$BIC)], "F81+G")
# amino acid models
MT_AA <- modelTest(Y, tree = tree, model=c("JTT", "WAG"), FREQ = TRUE,
control = pml.control(epsilon = 1e-08, maxit = 10, trace = 0))
expect_equal(MT_AA$Model[which.min(MT_AA$BIC)], "WAG")
})
|