项目作者: ropensci

项目描述 :
Phylogenetic Biodiversity Query Tools
高级语言: R
项目地址: git://github.com/ropensci/phylodiv.git
创建时间: 2018-03-21T17:24:52Z
项目社区:https://github.com/ropensci/phylodiv

开源协议:Other

下载


phylodiv

Build Status
Build status
codecov.io
rstudio mirror downloads
cran version

phylodiv: Phylogenetic Biodiversity Query Tools

Installation

Development version from GitHub

  1. if (!require("remotes")) install.packages("remotes")
  2. remotes::install_github("ropensci/phylodiv")
  1. BiocManager::install("ggtree")
  1. library('phylodiv')

The idea

  1. # given a tree
  2. tree
  3. # read the tree
  4. pd_read()
  5. # collect all higher taxonomic information from those names
  6. pd_taxa()
  7. # compose a phylogeny based query
  8. pd_query()
  9. # send the query to a biodiversity backend, e.g., GBIF
  10. pd_biodiv()
  11. # visualize results
  12. pd_viz()

given a tree

  1. library(ape)
  2. heli <- c("Helianthus agrestis", "Helianthus angustifolius", "Helianthus annuus",
  3. "Helianthus deserticola", "Helianthus divaricatus", "Helianthus eggertii",
  4. "Helianthus gracilentus", "Helianthus hirsutus", "Helianthus inexpectatus",
  5. "Helianthus laciniatus", "Helianthus maximiliani",
  6. "Helianthus nuttallii", "Helianthus occidentalis", "Helianthus paradoxus",
  7. "Helianthus pauciflorus", "Helianthus petiolaris", "Helianthus porteri",
  8. "Helianthus verticillatus", "Helianthus winteri")
  9. tree <- rcoal(length(heli))
  10. (tree$tip.label <- heli)
  11. #> [1] "Helianthus agrestis" "Helianthus angustifolius"
  12. #> [3] "Helianthus annuus" "Helianthus deserticola"
  13. #> [5] "Helianthus divaricatus" "Helianthus eggertii"
  14. #> [7] "Helianthus gracilentus" "Helianthus hirsutus"
  15. #> [9] "Helianthus inexpectatus" "Helianthus laciniatus"
  16. #> [11] "Helianthus maximiliani" "Helianthus nuttallii"
  17. #> [13] "Helianthus occidentalis" "Helianthus paradoxus"
  18. #> [15] "Helianthus pauciflorus" "Helianthus petiolaris"
  19. #> [17] "Helianthus porteri" "Helianthus verticillatus"
  20. #> [19] "Helianthus winteri"

read the tree

  1. (res <- pd_read(tree))
  2. #> <PhyloDiv>
  3. #> trees: 1

The PhyloDiv object

  1. class(res)
  2. #> [1] "PhyloDiv" "R6"
  3. names(res)
  4. #> [1] ".__enclos_env__" "data" "query"
  5. #> [4] "trees" "clone" "to_json"
  6. #> [7] "to_list" "fetch_hierarchies" "add_tree"
  7. #> [10] "initialize" "print"

collect all higher taxonomic information from those names

  1. (res <- pd_taxa(res))
  2. #> <PhyloDiv>
  3. #> trees: 1
  4. res$trees
  5. #> [[1]]
  6. #> <PhyloDivOne>
  7. #> tips: 19
  8. #> nodes: 18
  9. #> hierarchies: TRUE

compose a phylogeny based query

  1. res <- pd_query(res, c("Helianthus agrestis", "Helianthus angustifolius", "Helianthus petiolaris"))
  2. res$query
  3. #> [1] "Helianthus agrestis" "Helianthus angustifolius"
  4. #> [3] "Helianthus petiolaris"

send the query to a biodiversity backend, e.g., GBIF

  1. (res <- pd_biodiv(res, type = 'facet', by = "country"))
  2. #> <PhyloDiv>
  3. #> trees: 1

visualize results

  1. pd_vis(res, type = "facet")

plot of chunk unnamed-chunk-11

metadata

  1. pd_meta() # print to cosole
  2. pd_meta(file = (file <- tempfile())) # save to file
  3. jsonlite::fromJSON(file)

Thinking out loud

general questions

  • how do people interact with phylogenies in R? that is how to they most often refer to nodes/tips?
  • what about the use case of comparing 1 or more phylogenies against one another?

pd_read:

  • make sure to handle any local or remote tree, and many R tree objects

pd_taxa:

  • add option to use taxizedb to handle large data problems better
  • is there a way to programatically label upstream nodes after collecting taxonomic hierarchies?

pd_query:

  • this is the most slippery problem
  • two major approaches: taxonomic or phylogenetic
    • taxonomic e.g., if user wants specific names (e.g., i want species A, B, and C)
    • phylogenetic e.g., if user wants to see clade A compared to clade B
  • what to do if a user wants higher node in the tree for which we don’t know the name?
    • are there tools to guess these names?
    • possibly just error with message telling user to name that node?

pd_biodiv options include (assuming using GBIF):

  • get all occurrences (via rgbif::occ_data()), slowish; need caching mechanism
  • get just count data (via rgbif::occ_data(), but just get counts), fast; probably no need for caching mechanism
  • GBIF downloads (via rgbif::occ_download()), slowish, but only option to “get all the data”; need caching mechanism

pd_vis options include:

  • base plots, plain ol maps
  • GBIF maps API, rasters:
    • with base plots, static maps
    • with leaflet, interactive maps
  • do we support maps of occurences matched against a phylogeny? or is that not needed?
  • perhaps other R packages can be leveraged here

Meta

  • Please report any issues or bugs.
  • License: MIT
  • Get citation information for phylodiv in R doing citation(package = 'phylodiv')
  • Please note that this project is released with a Contributor Code of Conduct.
    By participating in this project you agree to abide by its terms.

rofooter