Skip to contents

Plot presence/absence of taxa by each cluster in phylota object.

Usage

plot_phylota_pa(phylota, cids, txids, cnms = cids, txnms = txids)

Arguments

phylota

Phylota object

cids

Vector of cluster IDs

txids

Vector of taxonomic IDs

cnms

Cluster names

txnms

Taxonomic names

Value

geom_object

Details

Cluster names and taxonomic names can be given to the function, by default IDs are used.

Examples

library(phylotaR)
data(cycads)
# drop all but first ten
cycads <- drop_clstrs(cycads, cycads@cids[1:10])
# plot all
p <- plot_phylota_pa(phylota = cycads, cids = cycads@cids, txids = cycads@txids)
print(p)  # lots of information, difficult to interpret

# get genus-level taxonomic names
genus_txids <- get_txids(cycads, txids = cycads@txids, rnk = 'genus')
genus_txids <- unique(genus_txids)
# dropping missing
genus_txids <- genus_txids[genus_txids !=  '']
genus_nms <- get_tx_slot(cycads, genus_txids, slt_nm = 'scnm')
# make alphabetical for plotting
genus_nms <- sort(genus_nms, decreasing = TRUE)
# generate geom_object
p <- plot_phylota_pa(phylota = cycads, cids = cycads@cids, txids = genus_txids,
                     txnms = genus_nms)
# plot
print(p)  # easier to interpret