s.phylo | R Documentation |
This function generates the phylogeny of species and plots the phylogenetic tree. In particular, given a species-by-site matrix (community), s.phylo:
uses the tax_name function to obtain (from the NCBI or ITIS online databases) the genus and family taxa levels of species in the community. If NCBI is used, getting an API key is recommended. See tax_name for more information. NCBI is used as default in this function;
uses the phylo.maker
function to obtain the phylogeny (an object
of class
: "phylo
") of species in the community using taxa obtained above;
computes the phylogenetic distance matrix using the cophenetic.phylo function and the phylogeny obtained above as input;
plots the phylogenetic tree using the phylogeny obtained above.
s.phylo(
s.data,
p.d.mat,
database = "ncbi",
obs.taxa = FALSE,
taxa.levels = NULL,
Obs.data = FALSE,
phy.d.mat = TRUE,
phylo.plot = TRUE
)
s.data |
A species-by-site presence/absence |
p.d.mat |
As for gbsm. |
database |
The online database used to obtain the taxonomic names (species, genus and family) for a given rank (species list in this function). The options are "ncbi" (default) or "itis". |
obs.taxa |
A Boolean indicating if |
taxa.levels |
Species taxa (i.e. a |
Obs.data |
A Boolean indicating if |
phy.d.mat |
A Boolean indicating if phylogenetic distance matrix should be in the returned list. |
phylo.plot |
Boolean value indicating if the phylogenetic tree (cluster dendrogram) should be plotted. |
Returns a list
with the following outputs:
s.data
: A data.frame
with sites as columns and species as rows.
taxa.levels
: A data.frame
with the following columns:
species
: Species names in s.data
.
genus
: Genus names of species in s.data
.
family
: Family names of species in s.data
.
p.d.matrix
: A symmetric matrix
with dimension names as species and entries indicating the
phylogenetic distance between any two of them (species).
phylo.plot
: A phylogenetic tree (cluster dendrogram) of species in s.data
Binomial nomenclature' (2020) Wikipedia. Available at: https://en.wikipedia.org/wiki/Binomial_nomenclature (Accessed: 09 November 2020).
Lagat, V. K., Latombe, G. and Hui, C., 2021b. Dissecting the effects of random
encounter versus functional trait mismatching on multi-species co-occurrence and
interference with generalised B-spline modelling. DOI: <To be added>
.
## Not run:
remotes::install_github("jinyizju/V.PhyloMaker", force = TRUE)
library(V.PhyloMaker)
my.path <- system.file("extdata/gsmdat", package = "msco")
setwd(my.path)
s.data <- get(load("s.data.csv"))
taxa <- get(load("taxa.levels.csv"))
my.s.phylo <- msco::s.phylo(s.data, p.d.mat = NULL, database = "ncbi", obs.taxa=TRUE,
taxa.levels = taxa, Obs.data=TRUE, phy.d.mat=TRUE, phylo.plot = TRUE)
my.s.data <- my.s.phylo$s.data
my.s.data
my.taxa <- my.s.phylo$taxa.levels
my.taxa
my.p.d.mat <- my.s.phylo$phylogenetic.distance.matrix
my.p.d.mat
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.