joey711 / phyloseq

phyloseq is a set of classes, wrappers, and tools (in R) to make it easier to import, store, and analyze phylogenetic sequencing data; and to reproducibly share that data and analysis with others. See the phyloseq front page:
http://joey711.github.io/phyloseq/
581 stars 187 forks source link

plot_tree and taxonomy #1758

Open antoine4ucsd opened 3 months ago

antoine4ucsd commented 3 months ago

Hello First thank you for this impressive set of tools I have a set of samples from different tissues and different individuals to analyze my phyloseq object looks like that

phyloseq-class experiment-level object
otu_table()   OTU Table:         [ 811 taxa and 111 samples ]
sample_data() Sample Data:       [ 111 samples by 145 sample variables ]
tax_table()   Taxonomy Table:    [ 811 taxa by 7 taxonomic ranks ]
phy_tree()    Phylogenetic Tree: [ 811 tips and 810 internal nodes ]

I would like to plot a phylogenetic tree so I tried the following


genus <- tax_glom(data, taxrank="Genus")
TopNOTUs <- names(sort(taxa_sums(genus), TRUE)[1:100])
tree <- prune_taxa(TopNOTUs, genus)
tree

plot_tree(tree,ladderize="left", nodelabf=nodeplotblank, color="Phylum", 
                label.tips="Genus", text.size=2, base.spacing=0.05, size="abundance") +             
        scale_size_continuous(range = c(0.1, 5)) +
        theme(legend.title = element_text(size = 8), legend.text = element_text(size = 8))

but I was expecting the taxa from the same phylum to be more closely related than taxa from other phylum. this is probably obvious but I don't get what's wrong. any chance you can help with that?

image

thank you!