/usr/lib/R/site-library/phangorn/doc/Ancestral.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 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 | ### R code from vignette source 'Ancestral.Rnw'
###################################################
### code chunk number 1: Ancestral.Rnw:44-47
###################################################
options(width=70)
options("show.signif.stars" = FALSE)
foo <- packageDescription("phangorn")
###################################################
### code chunk number 2: Ancestral.Rnw:62-68
###################################################
library(phangorn)
library(magrittr)
fdir <- system.file("extdata/trees", package = "phangorn")
primates <- read.phyDat(file.path(fdir, "primates.dna"), format = "phylip", type = "DNA")
tree <- pratchet(primates, trace=0) %>% acctran(primates)
parsimony(tree, primates)
###################################################
### code chunk number 3: Ancestral.Rnw:74-76
###################################################
anc.acctran <- ancestral.pars(tree, primates, "ACCTRAN")
anc.mpr <- ancestral.pars(tree, primates, "MPR")
###################################################
### code chunk number 4: Ancestral.Rnw:83-85 (eval = FALSE)
###################################################
## library(seqLogo)
## seqLogo( t(subset(anc.mpr, getRoot(tree), 1:20)[[1]]), ic.scale=FALSE)
###################################################
### code chunk number 5: Ancestral.Rnw:99-101 (eval = FALSE)
###################################################
## source("https://bioconductor.org/biocLite.R")
## biocLite("seqLogo")
###################################################
### code chunk number 6: Ancestral.Rnw:104-106
###################################################
options(SweaveHooks=list(fig=function()
par(mar=c(2.1, 4.1, 2.1, 2.1))))
###################################################
### code chunk number 7: plotMPR
###################################################
par(mfrow=c(2,1))
plotAnc(tree, anc.mpr, 17)
title("MPR")
plotAnc(tree, anc.acctran, 17)
title("ACCTRAN")
###################################################
### code chunk number 8: figMPR
###################################################
getOption("SweaveHooks")[["fig"]]()
par(mfrow=c(2,1))
plotAnc(tree, anc.mpr, 17)
title("MPR")
plotAnc(tree, anc.acctran, 17)
title("ACCTRAN")
###################################################
### code chunk number 9: Ancestral.Rnw:133-135
###################################################
fit = pml(tree, primates)
fit = optim.pml(fit, model="F81", control = pml.control(trace=0))
###################################################
### code chunk number 10: Ancestral.Rnw:147-149
###################################################
anc.ml = ancestral.pml(fit, "ml")
anc.bayes = ancestral.pml(fit, "bayes")
###################################################
### code chunk number 11: plotMLB
###################################################
par(mfrow=c(2,1))
plotAnc(tree, anc.ml, 17)
title("ML")
plotAnc(tree, anc.bayes, 17)
title("Bayes")
###################################################
### code chunk number 12: figMLB
###################################################
getOption("SweaveHooks")[["fig"]]()
par(mfrow=c(2,1))
plotAnc(tree, anc.ml, 17)
title("ML")
plotAnc(tree, anc.bayes, 17)
title("Bayes")
###################################################
### code chunk number 13: Ancestral.Rnw:173-174
###################################################
toLatex(sessionInfo())
|