# Is there a way/plugin to calculate the percentage of features present between samples?

**URL:** https://forum.qiime2.org/t/is-there-a-way-plugin-to-calculate-the-percentage-of-features-present-between-samples/19446
**Category:** User Support
**Created:** [May 3, 2021, 6:27pm UTC](https://forum.qiime2.org/t/is-there-a-way-plugin-to-calculate-the-percentage-of-features-present-between-samples/19446 "2021-05-03T18:27:31Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Focussash](https://forum.qiime2.org/user_avatar/forum.qiime2.org/focussash/32/10955_2.png) [@Focussash](https://forum.qiime2.org/u/Focussash)
#### Post date: [May 3, 2021, 6:27pm UTC](https://forum.qiime2.org/t/is-there-a-way-plugin-to-calculate-the-percentage-of-features-present-between-samples/19446/1 "2021-05-03T18:27:31Z")

</div>

Hey everyone, new to Qiime and microbiome studies here!

This seems to be a dumb question but I couldn't find any answer anywhere so figured it might be worth posting to ask: if there a plugin/command that could calculate how many percentage of features in sample A are present in sample B? Basically I'm looking at a simple diversity metric that only takes presence/absence into account, for example how many % of an inoculum sticked in a gnotobiotic mouse.

I've looked into the moving-window tutorial as well as some community posts, for example this one: [Alpha and Beta Diversity Explanations and Commands](https://forum.qiime2.org/t/alpha-and-beta-diversity-explanations-and-commands/2282), but all the metrics seem to deal with more than what I need...

Thanks in advance for your help! (Or please point me to the right post if my searching skills have been terrible :X)

---

<div class="post-metadata">

### Author: ![jwdebelius](https://forum.qiime2.org/user_avatar/forum.qiime2.org/jwdebelius/32/9655_2.png) [@jwdebelius](https://forum.qiime2.org/u/jwdebelius)
#### Post date: [May 3, 2021, 6:38pm UTC](https://forum.qiime2.org/t/is-there-a-way-plugin-to-calculate-the-percentage-of-features-present-between-samples/19446/2 "2021-05-03T18:38:25Z")

</div>

Hi @Focussash,

Welcome to the :qiime2: forum!

It sounds like you're looking for binary jaccard distance! It's 1 - shared/total organisms. So, it would give you the percentage _not_ present. (You could do 1 - jaccard) for the similarity.

There are a few caveats to jaccard distance. It tends to be sensitive to both depth, since it places even weight on singletons and more common organisms. You may want to look into multiple rarefaction or depth correction in modeling if this is a concern. (I often add depth or alpha diversity as a term in my adonis modeling.) You may also find that the metric saturates easily, so a lot of values may hit 1 quickly.

Best,  
Justine

---

<div class="post-metadata">

### Author: ![Focussash](https://forum.qiime2.org/user_avatar/forum.qiime2.org/focussash/32/10955_2.png) [@Focussash](https://forum.qiime2.org/u/Focussash)
#### Post date: [May 3, 2021, 10:58pm UTC](https://forum.qiime2.org/t/is-there-a-way-plugin-to-calculate-the-percentage-of-features-present-between-samples/19446/3 "2021-05-03T22:58:51Z")

</div>

Hi Justine! Thanks for the help! Of course the solution to my problem is something I already generated but failed to understand the meaning 😂 😂

That said, on second thought I realized the Jaccard distance is slightly different from what I want to check: the way I understand it, Jaccard is a “two-way” distance in that it take bacteria presence/absence in both samples into account. As an example, let’s say I have sample A and B. While Jaccard would tell me how many of features in A and B total are present in both, What I want to check is how many percentage of features that were in A are found in B (but not caring whether features found in B are present in A or not). Is this also possible? 😂

Many thanks for your help!!

---

<div class="post-metadata">

### Author: ![jwdebelius](https://forum.qiime2.org/user_avatar/forum.qiime2.org/jwdebelius/32/9655_2.png) [@jwdebelius](https://forum.qiime2.org/u/jwdebelius)
#### Post date: [May 3, 2021, 11:06pm UTC](https://forum.qiime2.org/t/is-there-a-way-plugin-to-calculate-the-percentage-of-features-present-between-samples/19446/4 "2021-05-03T23:06:38Z")

</div>

Hi @Focussash,

As far as I know, there's not a unidirectional metric. Its something you could potentially build if you're good at R, python or some other programing language. In your case, though, I might still go with jaccard. Non-overlap from you mice could be due to contamination in the cage, but might also be explained by reagent contamination and well-to-well contamination. You could also try filtering ultra low abundance organisms, like singletons or doubletons, or things present with fewer than X counts, but filtering may complicate your data.

Best,  
Justine

---

<div class="post-metadata">

### Author: ![Focussash](https://forum.qiime2.org/user_avatar/forum.qiime2.org/focussash/32/10955_2.png) [@Focussash](https://forum.qiime2.org/u/Focussash)
#### Post date: [May 3, 2021, 11:24pm UTC](https://forum.qiime2.org/t/is-there-a-way-plugin-to-calculate-the-percentage-of-features-present-between-samples/19446/5 "2021-05-03T23:24:32Z")

</div>

Hi @jwdebelius

Thanks for your reply! I think I'd export the data and use python to analyze it haha. I'm only using mouse as an example and my PI suggested me to compare my data against gnotobiotic mouse, so I guess I will show both Jaccard and unidirectional comparison.

---

<div class="post-metadata">

### Author: ![Imindias](https://forum.qiime2.org/user_avatar/forum.qiime2.org/imindias/32/5262_2.png) [@Imindias](https://forum.qiime2.org/u/Imindias)
#### Post date: [May 12, 2021, 4:59pm UTC](https://forum.qiime2.org/t/is-there-a-way-plugin-to-calculate-the-percentage-of-features-present-between-samples/19446/6 "2021-05-12T16:59:17Z")

</div>

HI @Focussash  
how about a simple Venn diagram?  
Best.  
Isabel

---

<div class="post-metadata">

### Author: ![Focussash](https://forum.qiime2.org/user_avatar/forum.qiime2.org/focussash/32/10955_2.png) [@Focussash](https://forum.qiime2.org/u/Focussash)
#### Post date: [May 12, 2021, 5:10pm UTC](https://forum.qiime2.org/t/is-there-a-way-plugin-to-calculate-the-percentage-of-features-present-between-samples/19446/7 "2021-05-12T17:10:48Z")

</div>

Hi Isabel, essentially that is what I want. Hence I was asking if Qiime has a plugin which can do that, or do I have to manually process the data outside of Qiime haha. Seems I would have to manually do it.

---

<div class="post-metadata">

### Author: ![system](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/3X/2/1/21af5fe23cb6f4579467c66a9ed94e55274ca7bd.svg) [@system](https://forum.qiime2.org/u/system)
#### Post date: [June 12, 2021, 11:11pm UTC](https://forum.qiime2.org/t/is-there-a-way-plugin-to-calculate-the-percentage-of-features-present-between-samples/19446/8 "2021-06-12T23:11:27Z")

</div>

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