Labelling and counting internal nodes of trees using R
0
1
Entering edit mode
7.5 years ago
Speed.Lee ▴ 30

Hi, I am a student with no biological background but currently, I am working with cladogram (evolutionary theory?) using R.So my apologise in advance if the following questions are too dumb.

What I am using is R with Phangorn and APE. I managed to get the maximum parsimony tree I want, but the labels are only appeared at Leafs. I searched the document of Phangorn but find noting to create labels for the internal nodes automatically.What I want is the nodes presents the characters that made the bifurcation.

My current code for this is:

plot(treePars, show.node.label = TRUE)

Is there any way to get this done? Using other packages are fine.

The second question is when I import data to R as phaDat, it seems automatically transposed. That is, my data is stored in csv file in rows, but when I read it into phaDat, the row names becomes the column heads. My code for this is:

origin <- read.csv(file.choose(),header = TRUE, row.names = 1) events <- as.phyDat(origin, type="USER", levels=c(0,1))

I have tried to transpose data before transform to phyDat, the code for this is:

origin <- read.csv(file.choose(),header = TRUE, row.names = 1) transposed <- t(origin) events <- as.phyDat(transposed, type="USER", levels=c(0,1))

but it is not working. If I transpose data in the csv file directly, it will work. Is there any explanation?

The third question is, is there any method to generate a summary list of the characters at the nodes? e.g. the most ancestral ones marked as level 1s, and the ones directly linked to them as level 2s etc, and get a list of this? If it is possible, also a frequency list for all the characters appeared in the tree? (Sorry, but I have no idea of how to do this so I have no code to present because I am totally stuck with this one.)

Thank you in advance for all comments.

R • 2.1k views
ADD COMMENT

Login before adding your answer.

Traffic: 1992 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6