# Shannon and Inv Simpson for several samples combined?

**URL:** https://forum.mothur.org/t/shannon-and-inv-simpson-for-several-samples-combined/20731
**Category:** Commands in mothur
**Created:** [October 20, 2020, 10:47pm UTC](https://forum.mothur.org/t/shannon-and-inv-simpson-for-several-samples-combined/20731 "2020-10-20T22:47:47Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![merisc](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@merisc](https://forum.mothur.org/u/merisc)
#### Post date: [October 20, 2020, 10:47pm UTC](https://forum.mothur.org/t/shannon-and-inv-simpson-for-several-samples-combined/20731/1 "2020-10-20T22:47:47Z")

</div>

I am a complete novice when it comes to metagenomics but I have been playing with Mothur for a few months to complete some analysis for my thesis. I am about done but my advisor is asking for a different approach that I don’t know how to do.

Is there a way to calculate the Shannon Index and Inv Simpson for several samples combined?

I can only explain what I mean by explaining my project:

I have separate microbial communities from three wipes that were grown in two salt treatments. I extracted DNA from the cultures over six months and we are observing the succession of the communities through who is present and how the diversity changes over time. I have already calculated the diversity for each time point of each wipe of both salt treatments.

My advisor would like me to instead, calculate the Shannon Index and Inv Simpson for combined wipe samples at each time point in both salts. So no longer breaking it down by wipe sample, only time points (so like week 1, week 2, week 3 … ) for each salt treatment.

This is what my table currently looks like (separated by wipe samples)

 ![Screen Shot 2020-10-20 at 5.42.09 PM](https://canada1.discourse-cdn.com/flex036/uploads/mothur/original/1X/60ae443d6abf544345ce63dcf2ffdf5cc1edd013.png)

Instead, I’d like to have just one “combined wipe sample” that would be separated by all five timepoints. (Planned to embed and image here but it won’t let me add more than one).

I hope this makes sense.  
THANK YOU!

Signed - a desperate (and sleepy) grad student. 😴

---

<div class="post-metadata">

### Author: ![merisc](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@merisc](https://forum.mothur.org/u/merisc)
#### Post date: [October 20, 2020, 10:48pm UTC](https://forum.mothur.org/t/shannon-and-inv-simpson-for-several-samples-combined/20731/2 "2020-10-20T22:48:57Z")

</div>

Realized I could add the second image here:

So like above, I would like the end product to have all wipes combined but broken down by time points.

 ![Screen Shot 2020-10-20 at 5.43.08 PM](https://canada1.discourse-cdn.com/flex036/uploads/mothur/original/1X/3b68e6cf939d6cac006056c32bcdc1f37df18da5.png)

My brain just doesn’t seem to understand how to combine the samples.

Thanks!

---

<div class="post-metadata">

### Author: ![merisc](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@merisc](https://forum.mothur.org/u/merisc)
#### Post date: [October 20, 2020, 11:27pm UTC](https://forum.mothur.org/t/shannon-and-inv-simpson-for-several-samples-combined/20731/3 "2020-10-20T23:27:56Z")

</div>

After doing some searching, it seems I am looking for the “merge.groups” command. Am I able to run alpha diversity calculations on this file following the merge?

---

<div class="post-metadata">

### Author: ![pschloss](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.mothur.org/pschloss/32/4_2.png) [@pschloss](https://forum.mothur.org/u/pschloss)
#### Post date: [October 22, 2020, 12:53pm UTC](https://forum.mothur.org/t/shannon-and-inv-simpson-for-several-samples-combined/20731/4 "2020-10-22T12:53:44Z")

</div>

Hi there, yup - `merge.groups` is the command you need to do what your advisor is asking. That being said… unless there’s a reason, I wouldn’t suggest this type of analysis. It would be better to treat the three wipes separately so you can account for the variation in the data. Also, if the three wipes have different numbers of sequences, then the one with more sequences will swamp out the others. With the way you had done it, you can rarefy all of the samples to a common number of sequences and then calculate mean/median and sd/IQR.

Pat

---

<div class="post-metadata">

### Author: ![merisc](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@merisc](https://forum.mothur.org/u/merisc)
#### Post date: [October 22, 2020, 7:25pm UTC](https://forum.mothur.org/t/shannon-and-inv-simpson-for-several-samples-combined/20731/5 "2020-10-22T19:25:53Z")

</div>

Thanks for your reply! I agree that this may not be the best approach but I should appease the advisor for him to make that call.

Thanks again!!

---

<div class="post-metadata">

### Author: ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.mothur.org/system/32/2_2.png) [@system](https://forum.mothur.org/u/system)
#### Post date: [November 1, 2020, 7:25pm UTC](https://forum.mothur.org/t/shannon-and-inv-simpson-for-several-samples-combined/20731/6 "2020-11-01T19:25:56Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
