I wanted to create a phylogenetic tree where I can trace a certain dimension throughout clades. I followed the tutorial by Winternitz 2016, but now I run into some problems.
Here is what I did so far:
tablename<- read.table(file("clipboard"), header=TRUE)
library(adegenet)
library(ape)
library(caper)
library(devtools)
library(geiger)
library(picante)
library(phytools)
library(stringr)
library(TreeTools)
supertree<-ReadTntTree("Pathname", tipLabels =1:36)
plot(supertree,no.margin=TRUE,edge.width=2) #to check if my tree is displayed correctly
Now I have the problem that my tree has (created by TNT) numbers as represenatives of taxa instead of the taxa names. For the copied table I created a column for the number and the second one is the taxon which is represented by the number. Column 3,4 and 5 are filled with either measurements or NA (for not avaiable). The names of the columns are code (column 1), specimen (column 2), HFM (column 3), WFM (column 4) and Wpp (column 5)
My questions are now:
Thank you already for reading and I am looking forward for an answer
Sincerely
Edit: After the quick comment I also attached a link to the files I can provide. I hope this helps to reproduce my progress so far -
https://drive.google.com/drive/folders/1CJBwCrSIkFqO6qvh0UH0yEiWtDwNpK1B?usp=sharing
Your line ReadTntTree("Pathname", tipLabels = 1:36)
reads the tree, using the numbers 1..36 to label the tips. But you want the leaves to be labelled with the taxon names.
Specify the names of the tips in ReadTntTree
. For example, if you know that the order of tips in the TNT tree matches the order of rows in your table, use
taxonNames <- tablename[, 2]
print(taxonNames) # Check that the names are what you expect
supertree <- ReadTntTree("Pathname", tipLabels = taxonNames)
More laboriously, specify the taxon names by hand: replace the first line with
taxonNames <- c("first_taxon", "second_taxon", <...>)
(Only an option if you have control over the TNT process that is generating your tree file.)
Ask TNT to save the taxon labels in the tree output, using the taxname=; tsav*;
taxname=; tsav*;
TNT command – see https://ms609.github.io/TreeTools/articles/load-trees.html#trees-from-tnt
Read the trees into R with supertree <- ReadTntTree("Pathname")
This approach assumes that the TNT matrix and output file are in the same place on your computer as they were when the TNT analysis is run. As such, it is the least reproducible approach -- handy for initial analysis, but less well suited to inclusion in publications.
tsav*;
, with taxname-;
to omit taxon names) link to the matrix used to generate the trees, and can load taxon names from there.ReadTntTree()
manual page for further details: for example, of how to use relative paths to the original matrix.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.