Dear all,
Does anyone know how can one loop through the newick phylogenetic trees
stored in a nexus file and generate an "average" skyline plot with
coalescent intervals?
I have managed to generate the plot with one tree, but is it possible to
create that "consensus/average" plot in R?
tr<-"((((8.1:0, 20.1:0):0, 6.1:3):123, (((((35.1:0, (22.1:0, (43.1:1,
29.1:0):0):0):4, 25.1:6):0, ((42.1:0, 21.1:0):3, (39.1:0, 2.1:0):3):1):8,
(3.1:0, 7.1:0):8):48, (((((15.1:0, 14.1:0):0, 11.1:0):0, 37.1:0):0,
((16.1:1, 30.1:0):0, 13.1:0):1):58, ((31.1:1, 19.1:0):18,
28.1:33):22):14):75):39, ((26.1:6, 17.1:8):60, (((((((41.1:0, 1.1:3):0,
(9.1:0, 27.1:0):1):2, (5.1:0, 10.1:0):3):1, (38.1:1, (4.1:1, (24.1:0,
18.1:0):2):0):0):16, 36.1:19):8, (32.1:0, 33.1:1):29):33, (40.1:18,
((23.1:0, 12.1:1):3, 34.1:2):16):42):1):82);"
tr <- read.tree(text = paste(tr, collapse = ""))
sk1 <- skyline(tr)
sk2 <- skyline(tr, 0.0119)
plot(sk1, show.years=TRUE, subst.rate=0.0023, present.year = 2011,
col=c(grey(.8),1)) lines(sk2, show.years=TRUE, subst.rate=0.0023,
present.year = 2011) legend(.15,500, c("classic",
"generalized"),
col=c(grey(.8),1),lty=1)
Thank you in advance!
Cheers!
[[alternative HTML version deleted]]