简体   繁体   English

使用 R 进行特征跟踪,粘贴 Excel 表和系统发育树

[英]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.我按照 Winternitz 2016 的教程进行操作,但现在遇到了一些问题。

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.现在我的问题是我的树有(由 TNT 创建)数字作为分类群的代表,而不是分类群的名称。 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).第 3,4 和 5 列填充有测量值或 NA(表示不可用)。 The names of the columns are code (column 1), specimen (column 2), HFM (column 3), WFM (column 4) and Wpp (column 5)列的名称是代码(第 1 列)、标本(第 2 列)、HFM(第 3 列)、WFM(第 4 列)和 Wpp(第 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.我个人发现 pdf 中的命令在使用表数据映射特征方面有点令人困惑。 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 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.您的行ReadTntTree("Pathname", tipLabels = 1:36)读取树,使用数字 1..36 标记提示。 But you want the leaves to be labelled with the taxon names.但是您希望叶子标有分类单元名称。

Approach 1: Specify tip labels within R方法 1:在 R 中指定提示标签

Specify the names of the tips in ReadTntTree .ReadTntTree中指定提示的名称。 For example, if you know that the order of tips in the TNT tree matches the order of rows in your table, use例如,如果您知道 TNT 树中的提示顺序与表中的行顺序相匹配,请使用

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方法 2:在 TNT 中指定提示标签

(Only an option if you have control over the TNT process that is generating your tree file.) (仅当您可以控制生成树文件的 TNT 进程时才可以选择。)

Approach 3: Load tip labels from original matrix方法 3:从原始矩阵加载提示标签

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.这种方法假设 TNT 矩阵和输出文件在您计算机上的位置与运行 TNT 分析时的位置相同。 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.完全省略“tipLabels”参数。 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.以 TNT 的默认括号表示法保存的树(TNT 命令tsav*; ,带有taxname-;以省略分类名称)链接到用于生成树的矩阵,并且可以从那里加载分类名称。
  • 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.有关详细信息,请参阅ReadTntTree()手册页:例如,如何使用原始矩阵的相对路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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