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-11-16 06:22:49 UTC |
Source: | https://github.com/bomeara/popularitree |
Generate a sample of species, weighted by their score
generate_sample(taxon_scores, ntax, phy, pd_weighting, min.prob = 0.01, max.prob = 0.99)
generate_sample(taxon_scores, ntax, phy, pd_weighting, min.prob = 0.01, max.prob = 0.99)
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 |
A list: selected=vector of names of sampled taxa to include, and score=sum of the taxon metrics for these taxa
This assumes you will have a data.frame of popularity measures and then sum to combine the columns into a single measure.
popularitree(phy, ntax, measures, pd_weighting = 0.5, nrep = 10000)
popularitree(phy, ntax, measures, pd_weighting = 0.5, nrep = 10000)
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 |
A phylo object pruned to the number of taxa
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))
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
species_get_common(species)
species_get_common(species)
species |
Species name |
Common name (ideally) or species name
Get a sum of hits of a species relative to a standard
species_gtrends_popularity(species, standard = "Myrmeocystus mexicanus", verbose = TRUE)
species_gtrends_popularity(species, standard = "Myrmeocystus mexicanus", verbose = TRUE)
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 |
The sum of relative hits over the time period
Return 1 if a species has a common name in NCBI, 0 otherwise
species_ncbi_common_exists(species)
species_ncbi_common_exists(species)
species |
The focal species to examine |
1 or 0
species_ncbi_common_exists('Puma concolor') species_ncbi_common_exists('Pomatomus saltatrix')
species_ncbi_common_exists('Puma concolor') species_ncbi_common_exists('Pomatomus saltatrix')
Compute popularity measures
tree_compute_measures(phy)
tree_compute_measures(phy)
phy |
An input phylogeny |
data.frame of measures
Convert tips to common names if possible
tree_convert_to_common(phy)
tree_convert_to_common(phy)
phy |
A phylogeny |
Phylogeny with names changed