knitr::opts_chunk$set( comment = "#>", warning = FALSE, message = FALSE, fig.path = "man/figures/" )
phylocomr
gives you access to the Phylocom C library, licensed under BSD 2-clause
ecovolve
/ph_ecovolve
- interface to ecovolve
executable, and a higher
level interfacephylomatic
/ph_phylomatic
- interface to phylomatic
executable, and a higher
level interfacephylocom
- interface to phylocom
executableph_aot
- higher level interface to aot
ph_bladj
- higher level interface to bladj
ph_comdist
/ph_comdistnt
- higher level interface to comdistph_comstruct
- higher level interface to comstructph_comtrait
- higher level interface to comtraitph_pd
- higher level interface to Faith's phylogenetic diversityAs a convenience you can pass ages, sample and trait data.frame's, and phylogenies as strings, to phylocomr
functions. However, phylocomr
has to write these data.frame's/strings to disk (your computer's file system) to be able to run the Phylocom code on them. Internally, phylocomr
is writing to a temporary file to run Phylocom code, and then the file is removed.
In addition, you can pass in files instead of data.frame's/strings. These are not themselves used. Instead, we read and write those files to temporary files. We do this for two reasons. First, Phylocom expects the files its using to be in the same directory, so if we control the file paths that becomes easier. Second, Phylocom is case sensitive, so we simply standardize all taxon names by lower casing all of them. We do this case manipulation on the temporary files so that your original data files are not modified.
Stable version:
install.packages("phylocomr")
Development version:
remotes::install_github("ropensci/phylocomr")
library("phylocomr") library("ape")
ph_ecovolve(speciation = 0.05, extinction = 0.005, time_units = 50)
taxa_file <- system.file("examples/taxa", package = "phylocomr") phylo_file <- system.file("examples/phylo", package = "phylocomr") (taxa_str <- readLines(taxa_file)) (phylo_str <- readLines(phylo_file)) ph_phylomatic(taxa = taxa_str, phylo = phylo_str)
use various different references trees
library(brranching) library(ape) r2 <- ape::read.tree(text=brranching::phylomatic_trees[['R20120829']]) smith2011 <- ape::read.tree(text=brranching::phylomatic_trees[['smith2011']]) zanne2014 <- ape::read.tree(text=brranching::phylomatic_trees[['zanne2014']]) # R20120829 tree taxa_str <- c( "asteraceae/bidens/bidens_alba", "asteraceae/cirsium/cirsium_arvense", "fabaceae/lupinus/lupinus_albus" ) ph_phylomatic(taxa = taxa_str, phylo = r2) # zanne2014 tree taxa_str <- c( "zamiaceae/dioon/dioon_edule", "zamiaceae/encephalartos/encephalartos_dyerianus", "piperaceae/piper/piper_arboricola" ) ph_phylomatic(taxa = taxa_str, phylo = zanne2014) # zanne2014 subtree zanne2014_subtr <- ape::extract.clade(zanne2014, node='Loganiaceae') zanne_subtree_file <- tempfile(fileext = ".txt") ape::write.tree(zanne2014_subtr, file = zanne_subtree_file) taxa_str <- c( "loganiaceae/neuburgia/neuburgia_corynocarpum", "loganiaceae/geniostoma/geniostoma_borbonicum", "loganiaceae/strychnos/strychnos_darienensis" ) ph_phylomatic(taxa = taxa_str, phylo = zanne2014_subtr) ph_phylomatic(taxa = taxa_str, phylo = zanne_subtree_file)
traits_file <- system.file("examples/traits_aot", package = "phylocomr") phylo_file <- system.file("examples/phylo_aot", package = "phylocomr") traitsdf_file <- system.file("examples/traits_aot_df", package = "phylocomr") traits <- read.table(text = readLines(traitsdf_file), header = TRUE, stringsAsFactors = FALSE) phylo_str <- readLines(phylo_file) ph_aot(traits = traits, phylo = phylo_str)
ages_file <- system.file("examples/ages", package = "phylocomr") phylo_file <- system.file("examples/phylo_bladj", package = "phylocomr") ages_df <- data.frame( a = c('malpighiales','salicaceae','fabaceae','rosales','oleaceae', 'gentianales','apocynaceae','rubiaceae'), b = c(81,20,56,76,47,71,18,56) ) phylo_str <- readLines(phylo_file) (res <- ph_bladj(ages = ages_df, phylo = phylo_str)) plot(ape::read.tree(text = res))
phylocomr
in R doing citation(package = 'phylocomr')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.