Phylocom is coming to R!

ecology
phylogenetics
r
Tags: #<Tag:0x00007f57f82ae278> #<Tag:0x00007f57f82adff8> #<Tag:0x00007f57f82ade68>

#1

Phylocom http://phylodiversity.net/phylocom/ is a great tool for analysis of phylogenetic community structure and character evolution

It’s a C library, but due to how it’s built it’s not straight-forward to wrap it in R via Rcpp. However, Jeroen has figured out how to wrap the library in R the best way possible - it should be cross-platform, and doesn’t require users to separately download and install Phylocom.

Thus, a new R package phylocomr, check it out at https://github.com/ropensci/phylocomr - It’s got interfaces to the 3 executables phylocom, phylomatic, and ecovolve, and we’re in the process of making higher level interfaces to all user facing things you can do with Phylocom - handling inputs and outputs from within R, so you don’t have to worry about files and paths and such (unless you want to).

I should mention that the great R package picante by Kembel et al. already has some functionality that Phylocom has. Check out Steve Kembel’s notes on the distinction between the two: https://github.com/ropensci/phylocomr/issues/2#issuecomment-266457515 And we’ll note these differences/trade-offsin the phylocomr docs

Installation

devtools::install_github("ropensci/phylocomr", dependencies = "Suggests", force = TRUE)
library(phylocomr)
library(phytools)

Some example usage:

ecovolve

ph_ecovolve(speciation = 0.05, extinction = 0.005, time_units = 50)
#> balance: 0.209524, time: 50, lineages: 14
#> [1] "((dead2:1.000000,(dead7:3.000000,((sp20:9.000000,(sp24:4.000000,(sp29:1.000000,sp30:1.000000)node16:3.000000)node13:5.000000)node10:1.000000,(sp22:5.000000,sp23:5.000000)node12:5.000000)node9:7.000000)node6:31.000000)node1:1.000000,(((sp17:18.000000,(sp18:12.000000,sp19:12.000000)node8:6.000000)node5:2.000000,(sp21:6.000000,(sp25:2.000000,sp26:2.000000)node14:4.000000)node11:14.000000)node4:16.000000,(sp27:1.000000,sp28:1.000000)node15:35.000000)node3:13.000000)node0:1.000000;"
#> attr(,"status")
#> [1] 1

phylomatic

taxa_str <- readLines(system.file("examples/taxa", package = "phylocomr"))
phylo_str <- readLines(system.file("examples/phylo", package = "phylocomr"))
ph_phylomatic(taxa = taxa_str, phylo = phylo_str)
#> [1] "(lobelia_conferta:5.000000,(mapania_africana:1.000000,narcissus_cuatrecasasii:1.000000):1.000000)poales_to_asterales;"
#> attr(,"taxa_file")
#> [1] "/var/folders/gs/4khph0xs0436gmd2gdnwsg080000gn/T//Rtmpdd0V98/taxa_6dfd394e3678"
#> attr(,"phylo_file")
#> [1] "/var/folders/gs/4khph0xs0436gmd2gdnwsg080000gn/T//Rtmpdd0V98/phylo_6dfd3dda1dac"

bladj

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(system.file("examples/phylo_bladj", package = "phylocomr"))
(res <- ph_bladj(ages = ages_df, phylo = phylo_str))
#> [1] "((((((lomatium_concinnum:20.250000,campanula_vandesii:20.250000):20.250000,(((veronica_candidissima:10.125000,penstemon_paniculatus:10.125000)plantaginaceae:10.125000,justicia_oblonga:20.250000):10.125000,marsdenia_gilgiana:30.375000):10.125000):10.125000,epacris_alba-compacta:50.625000)ericales_to_asterales:10.125000,((daphne_anhuiensis:20.250000,syzygium_cumini:20.250000)malvids:20.250000,ditaxis_clariana:40.500000):20.250000):10.125000,thalictrum_setulosum:70.875000)eudicots:10.125000,((dendrocalamus_giganteus:27.000000,guzmania_densiflora:27.000000)poales:27.000000,warczewiczella_digitata:54.000000):27.000000)malpighiales:1.000000;"
plot(phytools::read.newick(text = res))

Todo

We still have work to do, filling in methods wrapping the various Phylocom methods, so keep an eye on the github repo https://github.com/ropensci/phylocomr

let us know

Let us know if you have any problems with phylocomr, have feature requests, etc.


Use Phylomatic locally on your own machine from R
#2

testing testing testing