pd_query: Construct phylogenetically based query

Description Usage Arguments Use cases Examples

View source: R/pd_query.R

Description

Construct phylogenetically based query

Usage

1
pd_query(x, query)

Arguments

x

an object of class 'phylodiv'

query

query statement

Use cases

Taxonomy based queries (leverages taxa), e.g: - taxa A vs. taxa B (bypass the tree in this case, but do make sure the taxa are in the tree?) - taxa A, taxa B, taxa C, etc. (bypass the tree in this case, but do make sure the taxa are in the tree?)

Phylogeny based queries (no solution for this yet): - all taxa downstream from A (use tree to get clade from A) - all taxa upstream from A (use tree to get higher taxa above A) - all taxa not in genus B (use tree to get all tips not in genus B; in other words, drop clade B)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
## Not run: 
library(ape)
data(chiroptera)
st <- ape::subtrees(chiroptera)[[393]]
st <- ape::subtrees(chiroptera)[[2]]
x <- pd_read(st)
res <- pd_taxa(x)

# with a taxmap
res
res$hierarchies
res$taxmap
pd_query(res, startsWith(taxon_names, "Pteropus"))

# with metacoder::parse_phylo()
library(ape)
data(bird.orders)
x <- pd_read(bird.orders)
x <- pd_tax(x)
res <- pd_taxa2(x) 
res$taxmap
res <- pd_query(res, startsWith(taxon_names, "C"))


# A compared to sister clade
spp <- c("Eptesicus serotinus", "Eptesicus fuscus", 
  "Eptesicus furinalis", "Eptesicus brasiliensis")
pd_query(res, spp)
# pd_query(res, "Eptesicus bobrinskoi", "Eptesicus bar")

# A compared to B
# pd_query(res, A ~ B)

# A compared to B
# pd_query(res, A ~ B)

## End(Not run)

ropensci/phylodiv documentation built on March 13, 2020, 3:14 p.m.