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

**URL:** <https://forum.qiime2.org/t/before-i-get-into-clr-transformation-is-there-any-step-to-change-my-otu-table/25777>\
**Category:** General Discussion\
**Tags:** normalization, feature-table\
**Created:** [March 13, 2023, 11:44pm UTC](https://forum.qiime2.org/t/before-i-get-into-clr-transformation-is-there-any-step-to-change-my-otu-table/25777 "2023-03-13T23:44:51Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![SingeunOh](https://forum.qiime2.org/user_avatar/forum.qiime2.org/singeunoh/32/15223_2.png) [@SingeunOh](https://forum.qiime2.org/u/SingeunOh)\
**Post date:** [March 13, 2023, 11:44pm UTC](https://forum.qiime2.org/t/before-i-get-into-clr-transformation-is-there-any-step-to-change-my-otu-table/25777/1 "2023-03-13T23:44:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![timanix](https://forum.qiime2.org/user_avatar/forum.qiime2.org/timanix/32/17879_2.png) [@timanix](https://forum.qiime2.org/u/timanix)\
**Post date:** [March 14, 2023, 8:01am UTC](https://forum.qiime2.org/t/before-i-get-into-clr-transformation-is-there-any-step-to-change-my-otu-table/25777/2 "2023-03-14T08:01:35Z")

</div>

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![SingeunOh](https://forum.qiime2.org/user_avatar/forum.qiime2.org/singeunoh/32/15223_2.png) [@SingeunOh](https://forum.qiime2.org/u/SingeunOh)\
**Post date:** [March 14, 2023, 8:52am UTC](https://forum.qiime2.org/t/before-i-get-into-clr-transformation-is-there-any-step-to-change-my-otu-table/25777/3 "2023-03-14T08:52:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SingeunOh](https://forum.qiime2.org/user_avatar/forum.qiime2.org/singeunoh/32/15223_2.png) [@SingeunOh](https://forum.qiime2.org/u/SingeunOh)\
**Post date:** [April 5, 2023, 2:15am UTC](https://forum.qiime2.org/t/before-i-get-into-clr-transformation-is-there-any-step-to-change-my-otu-table/25777/4 "2023-04-05T02:15:38Z")

</div>

Dear timanix, I have one more question to it. When I try the from skbio.stats.composition import clr commend, 'No module named 'skbio' appears even after I installed 'scikit-bio' package using 'conda install scikit-bio' commend.

How did you prepare the using of librarie ?

Thank you for your kindness.

---

<div class="post-metadata">

**Author:** ![timanix](https://forum.qiime2.org/user_avatar/forum.qiime2.org/timanix/32/17879_2.png) [@timanix](https://forum.qiime2.org/u/timanix)\
**Post date:** [April 5, 2023, 7:01am UTC](https://forum.qiime2.org/t/before-i-get-into-clr-transformation-is-there-any-step-to-change-my-otu-table/25777/5 "2023-04-05T07:01:47Z")

</div>

Hi!  
I just run the code inside of qiime2 env since I am a little bit lazy and most of the required libraries already installed there.

---

<div class="post-metadata">

**Author:** ![SingeunOh](https://forum.qiime2.org/user_avatar/forum.qiime2.org/singeunoh/32/15223_2.png) [@SingeunOh](https://forum.qiime2.org/u/SingeunOh)\
**Post date:** [April 10, 2023, 4:55am UTC](https://forum.qiime2.org/t/before-i-get-into-clr-transformation-is-there-any-step-to-change-my-otu-table/25777/6 "2023-04-10T04:55:41Z")

</div>

Thank you. I've try to install the 'scikit-bio' package in the Windows environment, and that was the problem.

Now I successfully did the analysis using the package in the linux environment. (scikit-bio package could be installed only under linux)

Thank you !!

---

<div class="post-metadata">

**Author:** ![kam](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/k/ee7513/32.png) [@kam](https://forum.qiime2.org/u/kam)\
**Post date:** [May 18, 2023, 3:47pm UTC](https://forum.qiime2.org/t/before-i-get-into-clr-transformation-is-there-any-step-to-change-my-otu-table/25777/7 "2023-05-18T15:47:05Z")

</div>

does your function assumes taxa as columns ans samples as index or vice versa?

---

<div class="post-metadata">

**Author:** ![timanix](https://forum.qiime2.org/user_avatar/forum.qiime2.org/timanix/32/17879_2.png) [@timanix](https://forum.qiime2.org/u/timanix)\
**Post date:** [May 18, 2023, 4:07pm UTC](https://forum.qiime2.org/t/before-i-get-into-clr-transformation-is-there-any-step-to-change-my-otu-table/25777/8 "2023-05-18T16:07:34Z")

</div>

It takes a table as in feature table, so features as index and samples as columns.

---

<div class="post-metadata">

**Author:** ![kam](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/k/ee7513/32.png) [@kam](https://forum.qiime2.org/u/kam)\
**Post date:** [May 18, 2023, 4:21pm UTC](https://forum.qiime2.org/t/before-i-get-into-clr-transformation-is-there-any-step-to-change-my-otu-table/25777/9 "2023-05-18T16:21:31Z")

</div>

Thanks, wan't so sure because of the pandas transposed representation ([Feature table importing](https://forum.qiime2.org/t/feature-table-importing/25194)) while saving a df based on feature table (df.feature\_table.view(pd.DataFrame))
