Skip to content

19. Chapter 19

Francisco Gálvez Prada edited this page Jun 20, 2022 · 2 revisions

Chapter 19 – Metrics and Models of Community Phylogenetics

Sources

R packages

"ape" (Paradis et al 2004)

"ade4" (Dray & Dufour, 2007; Chessel et al. 2004; Dray et al. 2007)

"MASS" (Venables & Ripey, 2004)

"picante" (Kembel et al., 2010)

"apTreeshape" (Bartolussi et al. 2012)

"spacodiR" (Eastman et al., 2013)

"phylobase" (R Hackathon et al. 2013)

"phyloseq" (McMurdie & Holmes, 2013)

Data

METRIC CODE ("metrics.R"), Novel code to calculate community phylogenetic metrics

WRAPPER CODE ("functions.R"), Wrapper code to rapidly calculate the shape, evenness, and dispersion metrics described in the chapter

FIGURE 2 ANALYSES ("figures.R"), Code used to generate figure 2 in the chapter, and use the above files to calculate metrics and compare them

PGLMM ANALYSES ("pglmm.R"), Code to calculate the PGLMM models in the chapter

METRIC TABLES ("tables.pdf"), Description of additional metrics and their placement into the framework described in the chapter. Also the abbreviations used in figure 2 in the chapter.

Codes


Example


The file functions.R shows how the metrics described in the chapter can be calculated. However, below is a more annotated example that shows how the functions can be used.


#Load the functions written for the chapter
source(‘functions.R’)

## Loading required package: apTreeshape

	
  1. Attaching package: ‘apTreeshape’
  2. The following object is masked from ‘package:phylobase’:
  3. ancestor

#Load example data from ‘picante’
data(phylocom)
#Prune species from the phylogeny missing from the community data
tree <- drop.tip(phylocom$phy, setdiff(phylocom$phy$tip.label, colnames(phylocom$sample)))
#Calculate metrics! (ignore the warnings)
shape <- shape.metrics(phylocom$sample, tree)

evenness <- evenness.metrics(phylocom$sample, tree)

dispersion <- dispersion.metrics(phylocom$sample, tree)
#Take a quick look!
head(shape)

##            PSV   PSR SR   MPD PD   regPD Ic  Gamma TDI_Dplus TDI_SRDplus
		
  • clump1 0.4857 3.886 8 4.857 16 -4.8824 9 -1.131 7.929 63.43
  • clump2a 0.6000 4.800 8 6.000 17 -4.8235 6 -1.131 8.000 64.00
  • clump2b 0.7143 5.714 8 7.143 18 -3.8235 6 -1.061 7.714 61.71
  • clump4 0.8286 6.629 8 8.286 22 0.1765 5 -1.131 8.357 66.86
  • even 0.8857 7.086 8 8.857 30 9.1176 6 -2.222 8.571 68.57
  • random 0.8429 6.743 8 8.429 27 4.2353 11 -1.471 7.500 60.00
  • PEsumvar Eed Hed
  • clump1 0.03563 NA NA
  • clump2a 0.04493 NA NA
  • clump2b 0.03985 NA NA
  • clump4 0.04539 NA NA
  • even 0.04985 NA NA
  • random 0.02268 NA NA

  • References

    • Bortolussi, N., Durand, E., Blum, M., and Francois, O. (2012). apTreeshape: analyses of phylogenetic treeshape. R package version 1.4-5. http://CRAN.R-project.org/package=apTreeshape
    • Chessel, D. and Dufour, A.B. and Thioulouse, J. (2004): The ade4 package-I- One-table methods. R News. 4: 5-10.
    • Dray, S. and Dufour, A.B. (2007): The ade4 package: implementing the duality diagram for ecologists. Journal of Statistical Software.22(4): 1-20.
    • Dray, S. and Dufour, A.B. and Chessel, D. (2007): The ade4 package-II: Two-table and K-table methods. R News. 7(2): 47-52
    • Eastman, J., Paine, T., and Hardy, O. (2013). spacodiR: spatial and phylogenetic analysis of community diversity. R package version 0.13.0115. http://CRAN.R-project.org/package=spacodiR
    • Kembel, S.W., Cowan, P.D., Helmus, M.R., Cornwell, W.K., Morlon, H., Ackerly, D.D., Blomberg, S.P., and Webb, C.O.. 2010. Picante: R tools for integrating phylogenies and ecology. Bioinformatics 26:1463-1464.
    • McMurdie, P.J., and Holmes, S. (2013) PLoS ONE 8(4):e61217. phyloseq: An R package for reproducible interactive analysis and graphics of microbiome census data.
    • Paradis E, Claude J, Strimmer K (2004) APE: analyses of phylogenetics and evolution in R language. Bioinformatics 20:289-290
    • R Core Team (2014). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL http://www.R-project.org/.
    • R Hackathon et al. (2013). phylobase: Base package for phylogeneticstructures and comparative data. R package version 0.6.5.2.http://CRAN.R-project.org/package=phylobase
    • Venables, W. N. & Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth Edition. Springer, New York. ISBN 0-387-95457-0

    Clone this wiki locally