Before I get into CLR transformation, is there any step to change my OTU table ?

Hello ! Folks.

I'm trying integrate OTU table data from different batches.

Hence, I'm considering to do normalization before any further analysis.

I have looked through normalization methods and found that Centered Log ratio was one of the most mentioned method.
(I know it is built in many plug in of qiime. But I have to do other analysis in addition to the functions in qiime2)

However, I found that a sentence saying "Make Pseudocount before CLR"). Is there any pre-step before do CLR transformation ? Or the pseudocount would be made in the normal process integrated in CLR transformation ? I will use R, ALDEx2 package / or Python sckit-bio package to do my table transformation to CLR form.

Please suggest me and explain me about the question.

Many thanks for your help.

To get CLR data like in aldex2, I used this code:

import pandas as pd
from skbio.stats.composition import clr

# Function from absolute abundances to clr
def to_clr(data):
    data += 1                                  # add pseudocount
    data = data.div(data.sum(axis=0), axis=1)  # relative abund
    return pd.DataFrame(clr(data.T), columns=data.index, index=data.columns).T #clr

As well as I remember I got identical results as in aldex2.
So, I added pseudocounts, converted to relative abundances and applied CLR from skbio. It was also neccessary to transpose the data before clr and then transpose it back.


Thank you tomanix !! This would be a definitely big help for me ^^ I'll try this and match the result from R.

1 Like