Package 'phyndr'

Title: Matches Tip and Trait Data
Description: Use topological or taxonomic information to maximize the overlap of phylogenetic and comparative data.
Authors: Rich FitzJohn, Matt Pennell and Will Cornwell
Maintainer: Matt Pennell <[email protected]>
License: BSD_2_clause + file LICENSE
Version: 0.1.0
Built: 2026-05-07 05:50:39 UTC
Source: https://github.com/traitecoevo/phyndr

Help Index


Generate all distinct sets of tip labels from a phyndr tree

Description

Generate all distinct sets of tip labels from a phyndr tree

Usage

phyndr_combn(phy, max_n = 1000)

Arguments

phy

A phyndr tree

max_n

Maximum number of trees to generate; if the number of distinct trees is larger than this, we'll throw an error instead.


Number of distinct trees

Description

Number of possible distinct trees that can be generated from a phyndr set.

Usage

phyndr_n_distinct(phy)

Arguments

phy

A phyndr phylogeny


Sample one distinct set of tip labels from a phyndr tree

Description

Sample distinct set of tip labels from a phyndr tree. phyndr_sample returns a tree (phylo object) while phyndr_sample_n generates a list of trees.

Usage

phyndr_sample(phy)

phyndr_sample_n(phy, n)

Arguments

phy

A phyndr tree

n

Number of trees to generate


Phyndr taxonomic

Description

Taxonomic method of phyndr that works with generalised sets of taxonomic information. Requires a nested set of taxonomic classes (e.g, genus, family, order, etc) but does not assume that these classes are necessarily monophyletic. phyndr_genus does this for the genus level only but attempts to automatically detect genera from the tree (assuming that tips are all genus/species pairs, with genus and species separated by either an underscore or space).

Usage

phyndr_taxonomy(phy, data_species, taxonomy)

phyndr_genus(phy, data_species)

Arguments

phy

An ape phylogeny

data_species

A vector of species names for which we have trait data. Species names in both the tree and in this vector must be separated with underscores, not with spaces.

taxonomy

A data.frame with taxonomic information. Row names must be present and must list every species in phy and every species in data_species. One or more columns must be present; the first column is the lowest (finest) taxonomic grouping and the last column is the highest (coarsest) taxonomic grouping. The names are arbitrary but will be used in creating mangled names in the resulting phylogeny.

Details

The algorithm (not including recursion and substitute whatever taxonomic level for genus).

1: drop genera if there is a species match for that genus, but don't drop the actual matches.

2: work out which genera can be collapsed to a single tip due to monophyly.

2a. For each genus, determine if they are monophyletic

2b. Then, for genera that are not monophyletic determine which can be made monophyletic by dropping groups that are not represented in the data set.

2c. Collapse each genus down, dropping only genera that are required to achieve monophyly.

3. For each collapsed node we'll mangle the name to "genus::name" and then make a list of suitable species in the tree and data set; for now stored as clades.


phyndr for topo trees

Description

phyndr for topo trees

Usage

phyndr_topology(phy, data_species, topology)

Arguments

phy

An ape phylogeny. The tree must be ultrametric and this is enforced on entry.

data_species

A vector of species names for which we have trait data. Species names in both the tree and in this vector must be separated with underscores, not with spaces.

topology

A topological tree used to determine patterns of relatedness among species in phy. The better resolved this tree is and the better the overlap it has with phy and data_species the more useful this will be. Branch length information is not used.