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/
579 stars 188 forks source link

Missing labels in plot_tree #749

Open ycl6 opened 7 years ago

ycl6 commented 7 years ago

The figure produced by plot_tree is missing many family-level labels although most of the taxa contain family-level assignment. Also the placement of the labels were off for several taxa.

tree

The code I used to produce the plot:

plot_tree(tipg, size = "Abundance", color = "Condition", justify = "yes please", ladderize = "left", title = "By Family", label.tips = "Family") + scale_size_continuous(range = c(1, 5))

And my tax table looks like this:

Taxonomy Table:     [47 taxa by 1 taxonomic ranks]:
       Family
SV0001 "Prevotellaceae"
SV0002 "Bacteroidaceae"
SV0004 "Helicobacteraceae"
SV0005 "Lachnospiraceae"
SV0006 "Bacteroidales_S24-7_group"
SV0010 "Gastranaerophilales_fa"
SV0018 "Alcaligenaceae"
SV0023 "Ruminococcaceae"
SV0024 "Peptostreptococcaceae"
SV0031 "Lactobacillaceae"
SV0042 "Erysipelotrichaceae"
SV0044 "Clostridiales_vadinBB60_group"
SV0079 "Desulfovibrionaceae"
SV0090 "Rikenellaceae"
SV0120 NA
SV0124 "Clostridiaceae_1"
SV0141 "NB1-n_fa"
SV0145 "Peptococcaceae"
SV0190 "Rhodospirillaceae"
SV0235 "Deferribacteraceae"
SV0246 "Defluviitaleaceae"
SV0277 "Christensenellaceae"
SV0282 NA
SV0295 "Family_XIII"
SV0330 "Enterobacteriaceae"
SV0346 "Porphyromonadaceae"
SV0379 "Streptococcaceae"
SV0385 "Thermoanaerobacteraceae"
SV0389 NA
SV0391 "Bacillaceae"
SV0408 "Coriobacteriaceae"
SV0427 "Moraxellaceae"
SV0490 "Unknown_Family"
SV0507 "Corynebacteriaceae"
SV0540 "Aerococcaceae"
SV0563 "Pasteurellaceae"
SV0720 "Mollicutes_RF9_fa"
SV0838 "Enterococcaceae"
SV1124 "Anaeroplasmataceae"
SV1144 "Bifidobacteriaceae"
SV1167 "Micrococcaceae"
SV1177 "Staphylococcaceae"
SV1216 NA
SV1353 NA
SV1430 "Leuconostocaceae"
SV1498 "Veillonellaceae"
SV1509 "Eubacteriaceae"
ycl6 commented 7 years ago

I think I figured out why some aren't labelled. When the very fist sample have 0 abundance, the label is not added even though the abundance isn't 0 for other samples.

plot_tree

jeffkimbrel commented 7 years ago

Yeah, this has been an issue for a while. See #475

joey711 commented 7 years ago

@ycl6 you bug-diagnosis is very helpful. I think I have an idea of what this is and how it is happening.

@jeffkimbrel sorry for the long delay. I was aware of this issue, but it was difficult to diagnose and appeared to be arbitrary and hard to reproduce... now I see why... if the first-sample-zero turns out to be the root cause.

ycl6 commented 7 years ago

@jeffkimbrel thanks for pointing it out. I wasn't aware it has been reported.

LiamMacNeil commented 3 years ago

@joey711 Has this bug been resolved? I'm having the same issue but the graphics are excellent and I'm hoping to use it!

Screen Shot 2021-02-24 at 15 04 08
ycl6 commented 3 years ago

@LiamMacNeil I did not realise this has not been resolved. I just make a PR #1445 to fix problems with plot_tree, and hopefully it will help anyone who wish to use the function

LiamMacNeil commented 3 years ago

@ycl6 Success! All the taxa are now printed, the only occurs when I set justify = TRUE. Thank you!

ycl6 commented 3 years ago

Thanks for testing it and your feedback @LiamMacNeil