This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Normalization to fit bars on GraPhlAn generated cladogram

Hello,

I recently generated a cladogram on GraPhlAn from my Metaphlan2 output and wanted to add a ring displaying the relative abundances of each clade. I created a text file with this information according to the example (https://bitbucket.org/nsegata/graphlan/src/default/examples/guide/annot_3.txt). The issue is that my dataset (the 20 most abundant clades) is mainly dominated by one clade (83%, and the next most abundant is at 11% then 3% all the way down to 0.00173%) and therefore the image looks ridiculous (one giant bar from one place and the rest are basically invisible). My question is; what's the best way I can normalize these numbers so I get a reasonable range that would display the true abundances of the clades on the figure? any ideas?

THANKS!

metaphlan2 graphlan normalization cladogram

1 answer

Hi, one way is to use the log1p from numpy (https://docs.scipy.org/doc/numpy/reference/generated/numpy.log1p.html) of the relative abundances, in your case:

>>> np.log1p(83)
4.430816798843313
>>> np.log1p(11)
2.4849066497880004
>>> np.log1p(3)
1.3862943611198906
>>> np.log1p(0.00173)
0.001728505273669399

Log in to answer this question.