relative.phylogenetic: Deviance in Phylogenetic Specificity to Null Models

Description Usage Arguments Details Value Examples

View source: R/specificity_scripts.R

Description

Calculate the deviance in observed phylogenetic specificity to a null model of structural specificity per symbiont and average output per sample.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
relative.phylogenetic(
  x,
  tree,
  null.model = c("taxa.labels", "richness", "frequency", "sample.pool",
    "phylogeny.pool", "independentswap", "trialswap"),
  iterations = 100,
  abundance.weighted = TRUE,
  trim = TRUE,
  notify = TRUE
)

Arguments

x

Data frame. Host by symbiont data frame with hosts populating rows and symbionts populating columns.

tree

Newick formatted host phylogenetic tree. Cophenetic distances will be calculated the function.

null.model

Randomization method. Usage borrowed directly from picante::mpd Specify as "taxa.labels", "richness", "frequency", "sample.pool", "phylogeny.pool", "independentswap" or "trialswap".

iterations

Integer. Indicate the number of randomized communities to generate. NOTE: This function can take some time.

abundance.weighted

Logical. TRUE calculates abundance-weighted mean pairwise phylogenetic distance. FALSE calculates presence-absence mean pairwise phylogenetic distance.

trim

Logical. TRUE removes symbionts that occupy one host species. FALSE keeps all symbionts.

notify

Logical. TRUE prints the current iteration of the for loop.

Details

Please make sure your host or sample identifiers match the labels on the host phylogenetic tree.

Host specificity for a symbiont is evaluated across the entire host community. More positive values indicate a narrower symbiont niche and higher host specificity.

Deviance calculations are measured per symbiont and averaged per host sample. The host specificities of each symbiont are averaged to calculate the mean host specificity for symbionts within a given host. Unlike relative structural, network and beta-specificity, relative phylogenetic specificity is not calculated as the vertical distance between absolute host specificity and the null model with respect to read abundance. Instead, relative phylogenetic specificity is calculated as the difference between absolute phylogenetic specificity and the mean value of phylogenetic specificity from randomized communities divided by the standard deviation of the null distribution of absolute phylogenetic specificity.

For phylogenetic specificity, as the number of host species an symbiont occupies approaches the total number of host species in the community, the range of possible phylogenetic specificity values converges to a single value, or the MPD of the entire plant community. This produces a ‘funnel-shaped’ relationship between MPD and host species richness per symbiont and is often correlated with symbiont abundance. To account for this, relative phylogenetic specificity is calculated as the standardized effect size of MPD to quantify the difference between absolute phylogenetic specificity and the mean value of phylogenetic specificity from randomized communities.

A relative host specificity value greater than zero indicates that an symbiont was more host-specific relative to symbionts with the same read abundances within randomized communities.

see documentation for 'picante' for more documentation regarding the ses.mpd function

Value

A list. First element in the list is a data frame with columns that refer to the host sample identifiers, mean relative phylogenetic specificity, standard error of phylogenetic specificities, number of symbionts per host sample and average symbiont read abundance. All subsequent elements of the list are plots of absolute phylogenetic specificity as a function of natural log symbiont read abundance with the null model in black (derived from host specificity of symbionts from randomized communities in grey) and the symbiont absolute phylogenetic specificities in red. Within graphs, there is an inset equation that refers to the null model expectation.

Examples

1
2
3
# Calculate mean deviance per symbiont per host sample
phy.dev <- relative.phylogenetic(comm.matrix, tree = phylo.tree, null.model = "taxa.labels", iterations = 100)
phy.dev # View data frame of output 

austenapigo/lotus documentation built on Aug. 8, 2021, 10:54 a.m.