Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to get labels info from the dendrogram object? #101

Open
Jigyasa3 opened this issue Jun 5, 2020 · 1 comment
Open

Is it possible to get labels info from the dendrogram object? #101

Jigyasa3 opened this issue Jun 5, 2020 · 1 comment

Comments

@Jigyasa3
Copy link

Jigyasa3 commented Jun 5, 2020

Hey!

Thank you for the interesting package! I am interested coloring the branches of a dendrogram. I am able to do so with the set() functions, but the colors are not according to the original tip.labels of the tree for which I have the color variable assigned.

What I have-
`
phy.dist<-cophenetic(taxa_tree)
dend<-phy.dist%>%as.dist()%>%hclust()%>%as.dendrogram()

cols<-as.character(lineage3$lineage_color)) #138 colors ordered according to the "taxa_tree". Taken from df "lineage2" that contains the metadata for the tree.
head(cols)
301_19-AUS89-Kalotermitidae-Kalotermitidae_sp_A
"#b8860b"
229_05-MD_RNA_1-Mastotermitidae-Mastotermesdarwiniensis
"#b8860b"
229_08-Cryp-Cryptocercidae-Cryptocercus_punctulatus
"#b8860b"

cols2<-(as.factor(lineage3$lineage_color)) #9 colors for 9 clades

dend%>%set("labels_cex",0.5)%>%set("labels_color",cols)%>%set("branches_col",cols2)%>%plot()`

image

Problem-
The label colors do not match the labels in the dendrogram as the tree topology has changed when converting from phylo object to distance matrix.
The branch colors are completely different too.

What I want-
A dendrogram with branches colored by clades that corresponds to the original "taxa_tree"

@talgalili
Copy link
Owner

talgalili commented Jun 6, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants