The service will be shut down on April 1st. Please see this page for more information.

Community Phylogenetics

Primary Contact(s) Created Required Software
[WWW]Sharon Y. Strauss & [WWW]Jean H. Burns 5 March 2009 [WWW]Phylocom
Example Datafiles Last edited Presentation
phylo sample traits 11 March 2010 Phylocom.pdf


Phylogenies play an increasingly important role in understanding the composition of ecological communities. A variety of methods have now been developed to investigate community composition in a phylogenetic context. [WWW]Phylocom is a command-line program for conducting analyses of phylogenetic structure in communities, written by Cambell Webb, David Ackerly, and Steven Kembel. This tutorial will teach [WWW]Phylocom basics, including calculation of standard metrics of phylogenetic over- and under-dispersion of communities and the use of null models to test significance of these metrics.


The instructions below will walk you through a few basic analyses to get you started in [WWW]Phylocom. The manual provided with the free [WWW]Phylocom download will be referred to throughout this tutorial. Before beginning, you'll need to follow the manual's instructions for downloading and starting up the program. Steven Vamosi also has detailed instructions about how to get started on his website [WWW]Phylocom instructions.

We recommend saving the commands you type to a text file so that you have a record of your analyses. By cutting and pasting your text file into [WWW]Phylocom your analysis can also be easily replicated. We also recommend annotating this file with notes about what you've done and why. Open a new text file now in [WWW]TextWrangler. Save your text file with the name "Phylocom_Commands".

We're now ready to start analyzing an example data set [WWW]Phylocom. Several example files come with the basic [WWW]Phylocom download. Locate the phylo, sample and trait files in the example_data folder and copy these files into the phylocom-4.0.1b folder (i.e., move them up one folder in your file directory). These sample files can also be download from the sample data file links above.

Part I: Analyses of Community Structure

1. Start [WWW]Phylocom by opening the Terminal and navigating to the appropriate folder (this line will depend on where you've placed phylocom on your computer):

cd /Users/Jean/Desktop/phylocom-4.1

Then start [WWW]Phylocom by typing:


You should see a welcome screen that looks something like this


2. One major focus of community phylogenetics is the identification of phylogenetic under- or over-dispersion of communities. To calculate test statistics used to address this question - NRI/NTI - for each sample, and compare to a random expectation you type:

./phylocom comstruct  > results.xls

This performs the simulation with the default parameters. The default parameters use null model #2, which samples species as random draws from the phylogeny, without replacement (see the [WWW]Phylocom manual, page 11 for more details). The default number of randomizations is 999. The greater than sign in this line (>}) tells [WWW]Phylocom to write the output to a file called results.txt in your phylocom-4.0.1b folder.

Return to the OSX Finder application, navigate to the phylocom-4.0.1b folder, and open results.txt in simple text editor or a spreadsheet application like Microsoft EXCEL (to open in EXCEL, you may have to select the file and chose file/open with . . . ). You should see a file like this (because you have done a randomization test values may not be identical to those shown):

Figure 2. Results for comstruct ComstructOutput.jpg

Interpreting Results from Phylocom:

These metrics are whole community metrics:
Each plot ID is listed in the first column,
MPD = the mean phylogenetic distance
MPD.rnd = the mean phylogenetic distance from the random samples = the standard deviation of the MPD random
MPD.rankLow = the number of runs in the randomization where the MPD random was lower than the observed MPD.
MPD.rankHigh = the number of runs in the randomization where the MPD random was higher than the observed MPD.

So, for the clump1 plot, MPD.rnd (8.30) is greater than MPD observed (4.85). To calculate the p-value (probability that the observed value is this much lower than the expected based on chance alone) p = (MPD.rankHi/(999+1)). In this case it is < 0.001 .

NRI = The net relatedness index. A standardized metric of relatedness.
NRIsample = -1 * (MPDsample - MPD randomsample)/sd(MPDrandomsample)
Positive values indicate underdispersed communities (phylogenetic clustering)
Negative values indicate overdispersed communities (phylogenetic evenness).

These metrics are nearest taxon metrics:
MNTD = mean nearest phylogenetic taxon index
MNTD.rnd = mean nearest phylogenetic taxon index for the randomizations = standard deviation of the mean nearest phylogenetic taxon index for the randomizations
NTI = nearest taxon index
NTI = -1 * (MNTDsample - MNTDrandomsample)/(sd(MNTDrandomsample)

Again, positive values indicate phylogenetic clustering (in this case, individual taxa are more closely related to co-occurring nearest relatives than expected by chance).
Negative values indicate evenness.

You will want to save this file with a new name, as an excel file, so that you don't loose the results when you run the next analysis.

What "expected by chance" means depends on the null model you choose:

3. You might want to specify a different null model or different numbers of random runs. These commands will calculate the NRI/NTI for each sample, and compare to the random expectation specified in the model statement model=0, the "phylogeny shuffle" option with 999 runs. This null model randomizes phylogenetic relationships among species.

./phylocom comstruct -m 0 -r 999 > results.xls

Figure 3: View the results here:

Compare this results file with the results from the previous output.

The default null model is null model "2": Species in each sample are random draws, without replacement, from the phylogeny pool. This asks whether the species are more phylogenetically clumped or even than expected by chance, given the regional species pool=phylogeny you have specified.

See pages 10-11 of the phylocom manual for details about the null models.

Other null models available in phylocom are: "1" species in each sample are random draws from sample pool without replacement. "3" independent swap algorithm of Gotelli and Entsminger 2003. See also Hardy (2008) for additional null models.

What "expected by chance" means also depends on your definition of the regional species pool. We will not manipulate this here, but different regional species pools (e.g. setting it equal to the sample pool, equal to some larger region) will yield different results.

4.You can also incorporate abundance into the NRI/NTI calculations, so that you can ask whether the abundance distributions are phylogenetically clumped or even.

./phylocom comstruct -m 0 -a > results.xls

Open the resulting text file in excel.

Figure 4. Output for model 0 with abundances.

5. Calculate the distance from each species to its nearest neighbor (NN) or to the average community (AV):
./phylocom icomdist > results.xls

Open the resulting text file in excel.

The distance (AV or NN) from each species to each other species in the community is given in column E. Scroll down and notice the NN values. Many values for NN are 0. Why do you think this is?

6. Determine the position of phylogenetic clumping or evenness in a community sample:
./phylocom nodesig > results.nex

This command will generate a nexus file, with nodes (for each sample) with significantly clumped or even samples marked with (SIGMORE or SIGLESS notes).

Open the resulting nexus file in mesquite. Choose view trees.

Use the ? tool to view the notes on any branch. You can also view the notes under text (tab at the top of the tree view window), scroll down to the annotated branches tree.
You should see notes like this:
*(12): SIGMORE
*(34): SIGLESS

Indicating the these five nodes have more taxa than expected by chance in that sample (there are 6 trees, one corresponding to each sample).

7. Comtrait calculates the trait dispersion within a file and compares it to a null model:
-m specifies the model. 0 = trait shuffled across species. -r specifies the number of randomizations. -x specifies the metric. Variance (metric 1) appears as the default metric.
./phylocom comtrait -m 0 -r 999 -x 1 > results.xls

Open the result file in excel.

SESMetric is the standardized effect size of the metric (e.g. the variance in the trait). Use rankLow and rankHi as in the comdist function to calculate significance.

For example, Trait B in clump 2b has a SESMetric of -2.83, which is clearly lower than expected by chance (p = 0/1000). Thus the trait has a lower dispersion than expected by chance for this sample, suggesting that the trait is conserved. If the trait involved in community assembly in conserved, and the community is clumped, then we might expect that habitat filtering plays a role in community assembly (see Webb et al. 2002, Table 1, below).


Table from Webb et al. 2002. Predictions for the interpretation of community dispersion patterns, given some knowledge of how the ecological traits related to community assembly are dispersed on the phylogeny.


Other metrics used by comtrait are:
4 Trait range

Try running the model using these other metrics and compare.

Other null models are:
1 Species are random draws from sample pool.
2 Species are random draws from traits data.
3 Independent swap (checkerboard).

Part II: Analyses of Trait Evolution

8. Phylocom can also conduct a number of trait related analyses, including tests for phylogenetic signal on traits and phylogenetic independent contrasts,

./phylocom aotf > results.xls

Explore the output from the aotf function.

Scroll down for the independent contrasts output.

Scroll down more for phylogenetic signal and PIC correlations.

The output is described in detail in the phylocom manual (page 21 - ).

Part III: Further Exploration

To start from your own data:
Create excel files

Names to create phylogeny: with the Family, Genus, Specific epithet

Paste the phylogeny in newick format into Text Wrangler. Save as "phylo" with unix line endings with a hard return at the end. Delete the euphyllophyte and the corresponding "(" at the beginning, for the typical phylomatic phylogeny. The gaps in the phylogeny (tabs) may need to be deleted by hand.

Create a sample file with: Plot name, Abundance, Name-as-in phylogeny. Save as "sample"

Create the traits file:
The first two lines with look like this:
Type 0
name native

Then enter the data below:
spp1 1

Save as "traits"

Save files with Unix line endings and a single hard return at the end of the file.

All of the taxa in the files Must be in the phylogeny.

Running phylocom in R

The R package picante contains some of the functions available in the stand-alone phylocom application. The reference manual for picante is [WWW]here. If you need help getting started with R, you can check out this tutorial or head over to the [WWW]R phylogenetics Wiki.

More Useful Help with Phylocom

Check Steven Vamosi's web page for more helpful [WWW]Phylocom instructions.


Phylocom [WWW]manual

Ackerly DD, Schwilk DW, Webb CO (2006) Niche evolution and adaptive radiation: testing the order of trait divergence. Ecology,87, S50–S61.

Anderson TM, Lachance MA, Starmer WT (2004) The relationship of phylogeny to community structure: the cactus yeast community. American Naturalist, 164, 709–721.

Barker GM (2002) Phylogenetic diversity: a quantitative framework for measurement of priority and achievement in biodiversity conservation. Biological Journal of the Linnean Society, 76, 165–194.

Barnes DKA (2003) Competition asymmetry with taxon divergence.Proceedings of the Royal Society B: Biological Sciences, 270, 557–562.

Barraclough TG, Vogler AP (2000) Detecting the geographical pattern of speciation from species-level phylogenies. AmericanNaturalist, 155, 419–434.

Cahill JF Jr, Kembel SW, Lamb EG, Keddy PA (2008) Does phylogenetic relatedness influence the strength of competition among vascular plants? Perspectives in Plant Ecology, Evolution and Systematics, 10, 41–50.

Cavender-Bares J, Lehman C (2007) [WWW]EcoPhyl.

Cavender-Bares J, Ackerly DD, Baum DA, Bazzaz FA (2004) Phylogenetic overdispersion in Floridian oak communities.American Naturalist, 163, 823–843.

Cavender-Bares J, Keen A, Miles B (2006) Phylogenetic structure ofFloridian plant communities depends on taxonomic and spatialscale. Ecology, 87, S109–S122.

Emerson BC, Gillespie RG (2008) Phylogenetic analysis of communityassembly and structure over space and time. Trends in Ecology &Evolution, 23, 619–630.

Hardy OJ (2008) Testing the spatial phylogenetic structure of local communities: statistical performances of different null modelsand test statistics on a locally neutral community. Journal of Ecology, 96, 914–926.

Hardy OJ, Senterre B (2007) Characterizing the phylogenetic structure of communities by an additive partitioning of phylogenetic diversity. Journal of Ecology, 95, 493–506.

Helmus MR, Bland TJ, Williams CK, Ives AR (2007a) Phylogeneticmeasures of biodiversity. American Naturalist, 169, E68–E83.

Helmus MR, Savage K, Diebel MW, Maxted JT, Ives AR (2007b) Separating the determinants of phylogenetic community structure. Ecology Letters, 10, 917–925.

Horner-Devine MC, Bohannan BJM (2006) Phylogenetic clusteringand overdispersion in bacterial communities. Ecology, 87, S100–S108.

Kelly CK (1999) On the relationship between function and phylogenetic relatedness: environmental severity and community structure. XVI. International Botanical Congress Abstracts.

Kembel SW, Hubbell SP (2006) The phylogenetic structure of a Neotropical forest tree community. Ecology, 87, S86–S89.

Kembel SW, Ackerly DD, Blomberg SP, Cowan P, Helmus MR,Webb CO (2008) [WWW]Picante: Tools for Integrating Phylogenies and Ecology.

Kraft NJB, Cornwell WK, Webb CO, Ackerly DD (2007) Trait evolution, community assembly, and the phylogenetic structure of ecological communities. American Naturalist, 170,271–283.

Silvertown J, McConway K, Gowing D et al. (2006) Absence of phylogenetic signal in the niche structure of meadow plant communities. Proceedings of the Royal Society B: Biological Sciences,273, 39–44.

Simberloff DS (1970) Taxonomic diversity of island biotas. Evolution,24, 23–47.

Šimková A, Gelnar M, Morand S (2001) Order and disorder inectoparasite communities: the case of congeneric gill monogeneans(Dactylogyrus spp.). International Journal for Parasitology,31, 1205–1210.

Slingsby JA, Verboom GA (2006) Phylogenetic relatedness limitsco-occurrence at fine spatial scales: evidence from the schoenoidsedges (Cyperaceae: Schoeneae) of the Cape Floristic Region,South Africa. American Naturalist, 168, 14–27.

Steers HL (2001) Comparative analysis of community structure. PhD Thesis. University of Oxford, Oxford, UK.

Stephens PR, Wiens JJ (2004) Convergence, divergence, and homogenization in the ecological structure of emydid turtle communities: the effects of phylogeny and dispersal. American Naturalist, 164, 244–254.

Stevens PF (2001 Onwards) [WWW]Angiosperm Phylogeny Website. Version8, June 2007 (and more or less continuously updated since).

Swenson NG, Enquist BJ, Pither J, Thompson J, Zimmerman JK(2006) The problem and promise of scale dependency in community phylogenetics. Ecology, 87, 2418–2424.

Tate AW, Hershey AE (2003) Selective feeding by larval dytiscids (Coleoptera: Dytiscidae) and effects of fish predation on upperlittoral zone macroinvertebrate communities of arctic lakes.Hydrobiologia, 497, 13–23.

Tilman D (1982) Resource Competition and Community Structure.Monographs in Population Biology. Princeton University Press,Princeton.

Tofts R, Silvertown J (2002) Community assembly from the local species pool: an experimental study using congeneric species pairs. Journal of Ecology, 90, 385–393.

Travis J, Keen WH, Juilianna J (1985) The role of relative body size in a predator-prey relationship between dragonfly naiads and larval anurans. Oikos, 45, 59–65.

Valiente-Banuet A, Verdú M (2007) Facilitation can increase the phylogenetic diversity of plant communities. Ecology Letters, 10,1029–1036.

Vamosi SM (2003) The presence of other fish species affects speciation in threespine sticklebacks. Evolutionary EcologyResearch, 5, 717–730.

Vamosi SM (2005) On the role of enemies in divergence and diversification of prey: a review and synthesis. Canadian Journal of Zoology, 83, 894–910.

Vamosi SM, Naydani CJ, Vamosi JC (2007) Body size and speciesrichness along geographical gradients in Albertan diving beetle(Coleoptera: Dytiscidae) communities. Canadian Journal ofZoology, 85, 443–449.

Vamosi SM, Schluter D (2004) Character shifts in the defensivearmor of sympatric sticklebacks. Evolution, 58, 376–385.

Vamosi JC, Vamosi SM (2007) Body size, rarity, and phylogenetic community structure: insights from diving beetle assemblages of Alberta. Diversity and Distributions, 13, 1–10.

Vamosi et al. 2009. Emerging patterns in the comparative analysis of phylogenetic community structure. Molecular Ecology. 18: 572-592.

Verdú M, Pausas JG (2007) Fire drives phylogenetic clustering in Mediterranean Basin woody plant communities. Journal of Ecology, 95, 1316–1323.

Webb CO (2000) Exploring the phylogenetic structure of ecological communities: an example for rain forest trees. American Naturalist,156, 145–155.

Webb CO, Peart DR (2000) Habitat associations of trees and seedlings in a Bornean rain forest. Journal of Ecology, 88, 464–478.

Webb CO, Ackerly DD, McPeek MA, Donoghue MJ (2002)Phylogenies and community ecology. Annual Review of Ecology and Systematics, 33, 475–505

Webb CO, Gilbert GS, Donoghue MJ (2006) Phylodiversity dependent seedling mortality, size structure, and disease in a Bornean rain forest. Ecology, 87, S123–S131.

Webb CO, Ackerly DD, Kembel SW (2008) [WWW]Phylocom: Software forthe Analysis of Community Phylogenetic Structure and Trait Evolution,Version 4.0.1.

Webb CO, Cannon CH, Davies SJ (2008) Ecological organization,biogeography, and the phylogenetic structure of rainforest tree communities. In: Tropical Forest Community Ecology (Carson W, Schnitzer S). Blackwell Publishing, Oxford, UK.

Weiblen GD, Webb CO, Novotny V, Basset Y, Miller SE (2006) Phylogenetic dispersion of host use in a tropical insect herbivore community. Ecology, 87, S62–S75.


Note: You must be logged in to add comments

2009-04-16 03:12:58   When species names are collected per plot, how should we present them so that they will be suitable for Phylocom? —

2009-04-16 03:14:34   When species names are recorded per plot, how should we present them before starting the run? —

2009-12-09 16:43:59   Great resource! Thanks for linking to my page, I've returned the favour @ [WWW] — Steve V. —

2010-03-06 13:15:22   When species names are collected on a per plot basis, check out the example files "sample" downloadable from above, for an example of how to format the data for phylocom. Jean B. —

2010-05-19 07:57:49   How I calculate the significance value of PicR from the results output? —

2011-05-30 12:58:07   how should we measure the trait in the unknow community? white to me mail

This is a Wiki Spot wiki. Wiki Spot is a 501(c)3 non-profit organization that helps communities collaborate via wikis.