/usr/lib/R/site-library/phangorn/doc/phangorn-specials.R is in r-cran-phangorn 1.99.14-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 | ### R code from vignette source 'phangorn-specials.Rnw'
###################################################
### code chunk number 1: phangorn-specials.Rnw:46-48
###################################################
options(width=70)
foo <- packageDescription("phangorn")
###################################################
### code chunk number 2: phangorn-specials.Rnw:70-76
###################################################
library(phangorn)
data = matrix(c("r","a","y","g","g","a","c","-","c","t","c","g",
"a","a","t","g","g","a","t","-","c","t","c","a",
"a","a","t","-","g","a","c","c","c","t","?","g"),
dimnames = list(c("t1", "t2", "t3"),NULL), nrow=3, byrow=TRUE)
data
###################################################
### code chunk number 3: phangorn-specials.Rnw:79-81
###################################################
gapsdata1 = phyDat(data)
gapsdata1
###################################################
### code chunk number 4: phangorn-specials.Rnw:84-87
###################################################
gapsdata2 = phyDat(data, type="USER", levels=c("a","c","g","t","-"),
ambiguity = c("?", "n"))
gapsdata2
###################################################
### code chunk number 5: phangorn-specials.Rnw:91-106
###################################################
contrast = matrix(data = c(1,0,0,0,0,
0,1,0,0,0,
0,0,1,0,0,
0,0,0,1,0,
1,0,1,0,0,
0,1,0,1,0,
0,0,0,0,1,
1,1,1,1,0,
1,1,1,1,1),
ncol = 5, byrow = TRUE)
dimnames(contrast) = list(c("a","c","g","t","r","y","-","n","?"),
c("a", "c", "g", "t", "-"))
contrast
gapsdata3 = phyDat(data, type="USER", contrast=contrast)
gapsdata3
###################################################
### code chunk number 6: phangorn-specials.Rnw:137-142
###################################################
tree = unroot(rtree(3))
fit = pml(tree, gapsdata3)
fit = optim.pml(fit, optQ=TRUE, subs=c(1,0,1,2,1,0,2,1,2,2),
control=pml.control(trace=0))
fit
###################################################
### code chunk number 7: phangorn-specials.Rnw:205-215
###################################################
library(phangorn)
primates = read.phyDat("primates.dna", format="phylip", type="DNA")
tree <- NJ(dist.ml(primates))
dat <- phyDat(as.character(primates), "CODON")
fit <- pml(tree, dat)
fit0 <- optim.pml(fit, control = pml.control(trace = 0))
fit1 <- optim.pml(fit, model="codon1", control=pml.control(trace=0))
fit2 <- optim.pml(fit, model="codon2", control=pml.control(trace=0))
fit3 <- optim.pml(fit, model="codon3", control=pml.control(trace=0))
anova(fit0, fit2, fit3, fit1)
###################################################
### code chunk number 8: plotAll
###################################################
trees = allTrees(5)
par(mfrow=c(3,5), mar=rep(0,4))
for(i in 1:15)plot(trees[[i]], cex=1, type="u")
###################################################
### code chunk number 9: figAll
###################################################
getOption("SweaveHooks")[["fig"]]()
trees = allTrees(5)
par(mfrow=c(3,5), mar=rep(0,4))
for(i in 1:15)plot(trees[[i]], cex=1, type="u")
###################################################
### code chunk number 10: phangorn-specials.Rnw:242-243
###################################################
trees = nni(trees[[1]])
###################################################
### code chunk number 11: phangorn-specials.Rnw:254-255
###################################################
toLatex(sessionInfo())
|