YuLab-SMU / ggtree

:christmas_tree:Visualization and annotation of phylogenetic trees
https://yulab-smu.top/treedata-book/
832 stars 172 forks source link

Visualizing phyloseq tree object by collapsing clades at family level #280

Open iadamo1 opened 4 years ago

iadamo1 commented 4 years ago

Hi, I have a phyloseq object containing a phylogenetic tree at OTU level and I would like to do somenthing like this: data(GlobalPatterns) GP <- prune_taxa(taxa_sums(GlobalPatterns) > 0, GlobalPatterns) GP.chl <- subset_taxa(GP, Phylum=="Chlamydiae")

ggtree(GP.chl) + geom_text2(aes(subset=!isTip, label=label), hjust=-.2, size=4) + geom_tiplab(aes(label=Genus), hjust=-.3) + geom_point(aes(x=x+hjust, color=SampleType, shape=Family, size=Abundance),na.rm=TRUE) + scale_size_continuous(trans=log_trans(5)) + theme(legend.position="right") but insted of visualizing the tree with each OTU I would like to have it by family and show the total abundance of each family. is it possible? I saw that you can collapse clades by node but my tree is big and it is quite long to collapse clade by clade.

Thanks a lot!

huizhen-yan commented 2 years ago

Have you collapsed the clade successfully? I encountered the same problem.