Description Usage Arguments Details Value Examples
View source: R/specificity_scripts.R
Calculate the deviance in absolute network specificity to a null model of network specificity per symbiont and average output per host sample.
1 2 3 4 5 6 7 | relative.network(
x,
randomized = null.net,
abundance.weighted = TRUE,
trim = TRUE,
notify = TRUE
)
|
x |
Data frame. Host by symbiont data frame with hosts populating rows and symbionts populating columns. |
randomized |
Data frame. Output from null.network function. |
abundance.weighted |
Logical. TRUE calculates the Paired Difference Index per symbiont. FALSE calculates the Resource Range Index per symbiont. |
trim |
Logical. TRUE removes symbionts that occupy one host species from contributing to host specificity average per host sample. FALSE keeps all symbionts per host sample. |
notify |
Logical. TRUE prints the current iteration of the for loop. NOTE: This function can take some time. |
Hosts are labeled by their species name with a period and number identifier (e.g., hostA.1) to differentiate host samples that are of the same species. This naming scheme is required because host specificity is quantified at the level of host species and not host samples. If this naming scheme does not apply to your experimental design, you should still add in identifiers (e.g., .1, .2, .3, etc.) after each host species or sample identifer.
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.
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.
If your preferred null model is not represented in bipartite::nullmodel you can use any other function to generate randomized communities (e.g., vegan::permatswap) outside of 'lotus'. Make sure your output is formatted as a list and you can supply this to the 'randomized' argument in any deviance-related function.
A list. First element in the list is a data frame with columns that refer to the host sample identifiers, mean relative network specificity, standard error of network specificities, number of symbionts per host sample and average symbiont read abundance. All subsequent elements of the list are plots of absolute network 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 network specificities in red. Within graphs, there is an inset equation that refers to the null model expectation.
1 2 3 | # Calculate mean network specificity per symbiont per host sample
net.dev <- relative.network(comm.matrix, randomized = null.net, abundance.weighted = TRUE)
net.dev # View data frame of output
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.