Package 'popularitree'

Title: Subsamples a tree to get popular taxa
Description: Often you want to show a reduced summary tree. Taxa chosen should span all the tree (for example, a tree of mammals should not have just primates) but also be recognizable groups to your audience. This lets you select a final tree size you want, criteria you want to use, and finds the tree that maximizes the criteria.
Authors: Brian O'Meara [aut, cre]
Maintainer: Brian O'Meara <[email protected]>
License: GPL-2
Version: 0.0.0.9000
Built: 2024-08-18 04:19:15 UTC
Source: https://github.com/bomeara/popularitree

Help Index


Generate a sample of species, weighted by their score

Description

Generate a sample of species, weighted by their score

Usage

generate_sample(taxon_scores, ntax, phy, pd_weighting, min.prob = 0.01,
  max.prob = 0.99)

Arguments

taxon_scores

The vector of scores for taxa

ntax

The number of taxa you want returned

phy

Phylogeny to prune

pd_weighting

How much to weight the pd vs the popularity

min.prob

The minimum probability of sampling for a taxon

max.prob

The maximum probability of sampling for a taxon

Value

A list: selected=vector of names of sampled taxa to include, and score=sum of the taxon metrics for these taxa


Get a smaller tree with popular taxa spanning the diversity

Description

This assumes you will have a data.frame of popularity measures and then sum to combine the columns into a single measure.

Usage

popularitree(phy, ntax, measures, pd_weighting = 0.5, nrep = 10000)

Arguments

phy

A phylo object

ntax

The final number of taxa you want

measures

Data.frame of the measures of popularity

pd_weighting

How much to weight the pd vs the popularity

nrep

How many replicates to use

Value

A phylo object pruned to the number of taxa

Examples

big.phy <- rotl::get_study("ot_308")[[1]]
big.phy <- geiger::drop.random(big.phy, ape::Ntip(big.phy) - 20)
measures <- tree_compute_measures(big.phy)
small.phy <- popularitree(phy=big.phy, ntax=5, measures, nrep=100)
par(mfcol=c(1,3))
plot(big.phy)
plot(small.phy)
plot(tree_convert_to_common(small.phy))

Return common name if known, otherwise return scientific name

Description

Return common name if known, otherwise return scientific name

Usage

species_get_common(species)

Arguments

species

Species name

Value

Common name (ideally) or species name


Get a sum of hits of a species relative to a standard

Description

Get a sum of hits of a species relative to a standard

Usage

species_gtrends_popularity(species, standard = "Myrmeocystus mexicanus",
  verbose = TRUE)

Arguments

species

The focal species to look at search interest over

standard

Since Google Trends always compares popularity, give a standard species to use

verbose

If TRUE, chat about what species is being examined

Value

The sum of relative hits over the time period


Return 1 if a species has a common name in NCBI, 0 otherwise

Description

Return 1 if a species has a common name in NCBI, 0 otherwise

Usage

species_ncbi_common_exists(species)

Arguments

species

The focal species to examine

Value

1 or 0

Examples

species_ncbi_common_exists('Puma concolor')
species_ncbi_common_exists('Pomatomus saltatrix')

Compute popularity measures

Description

Compute popularity measures

Usage

tree_compute_measures(phy)

Arguments

phy

An input phylogeny

Value

data.frame of measures


Convert tips to common names if possible

Description

Convert tips to common names if possible

Usage

tree_convert_to_common(phy)

Arguments

phy

A phylogeny

Value

Phylogeny with names changed