Trying to create a phylogenetic tree with quantitative evolutionary distances with packages rotl and ape

This is what I tried. The problems are described in the comments. Thank you in advance <3

Install necessary packages

install.packages("rotl")
install.packages("ape")

Load required libraries

library(rotl)
library(ape)

Define the list of species

species_list <- c("Panthera leo persica", "Ara glaucogularis", "Helogale parvula”, ”Rangifer tarandus fennicus", "Cebuella pygmaea", "Macropus rufogriseus", "Elaphe taeniura friesei", "Tayassu pecari")

Get OTT ids for the species from the OTL (Tree of life) database

ott_ids <- tnrs_match_names(species_list)$ott_id
print(ott_ids)

Fetch the phylogenetic tree from Open Tree of Life

tree <- tol_induced_subtree(ott_ids = ott_ids)
*## In Console it gives a warning message on singleton nodes

print(tree$tree)
*## In Console: NULL

These would be the next steps that we would do if we wouldn't have gotten stuck

Convert the tree to an 'ape' format

phylo_tree <- ape::read.tree(text=tree$tree)
*## In Console it gives a warning message: In ape::read.tree(text = tree$tree) : empty character string

Calculate distances from humans

distances_from_humans <- cophenetic(phylo_tree)["Homo_sapiens", species_list]

Print the computed distances

print(distances_from_humans)

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.