Skip to contents

This function uses phylogenetics to identify an isolate's nearest neighbor.

Usage

nearest_neighbor_algorithm(
  isolate,
  tip_name_variable,
  phylogenetic_distance,
  variant_distance,
  metadata,
  annotate = NULL,
  variables_of_interest = NULL,
  comparison = NULL,
  comparison_feature = NULL
)

Arguments

isolate

Isolate of interest

tip_name_variable

Name of variable containing tip names. Must be found in the metadata, dataframe. Tip name entries must also correspond to tip names in the tree

phylogenetic_distance

Matrix of phylogenetic distance. Generated by ape::cophenetic.phylo(tree)

variant_distance

(OPTIONAL) Matrix with secondary distance measure, presumably SNPs. If not specified, the first entry will be gathered

metadata

Dataframe with trait and variables of interest

annotate

Boolean (TRUE/FALSE) indicating if annotation is necessary

variables_of_interest

Variables found in the metadata

comparison

Boolean (TRUE/FALSE) indicating whether to restrict analysis to isolates with/without a trait (comparison_feature)

comparison_feature

Name of variable to compare

Value

Dataframe with the nearest neighbor of interest.