简体   繁体   中英

Trait tracking using R, with pasted Excel sheet and phylogenetic tree

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:

  1. How can I replace the numbers in my plotted tree with their representative taxon name?
  2. I personally find the commands in the pdf a bit confusing regarding using the table data for mapping traits. How can I create the connection between the pasted table/the dataset with the tree and how do I follow up then?

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.

Approach 1: Specify tip labels within R

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", <...>)

Approach 2: Specify tip labels within TNT

(Only an option if you have control over the TNT process that is generating your tree file.)

Approach 3: Load tip labels from original matrix

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.

  • Omit the "tipLabels" parameter entirely. Trees saved in TNT's default parenthetical notation (TNT command tsav*; , with taxname-; to omit taxon names) link to the matrix used to generate the trees, and can load taxon names from there.
  • If you open the tree file with a text editor you should see the path to the original matrix in the first line.
  • See the 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM