# FMT Tutorial Pairwise Difference Comparisons

**URL:** https://forum.qiime2.org/t/fmt-tutorial-pairwise-difference-comparisons/11508
**Category:** User Support
**Tags:** longitudinal
**Created:** [September 13, 2019, 3:56pm UTC](https://forum.qiime2.org/t/fmt-tutorial-pairwise-difference-comparisons/11508 "2019-09-13T15:56:00Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![YinXun](https://forum.qiime2.org/user_avatar/forum.qiime2.org/yinxun/32/6231_2.png) [@YinXun](https://forum.qiime2.org/u/YinXun)
#### Post date: [September 13, 2019, 3:56pm UTC](https://forum.qiime2.org/t/fmt-tutorial-pairwise-difference-comparisons/11508/1 "2019-09-13T15:56:00Z")

</div>

I am doing the longitudinal pairwise-differences to answer question 1d.

Here are my commands which I have done similarly to the longitudinal tutorial:

qiime longitudinal pairwise-differences   
--m-metadata-file sample-metadata.tsv   
--m-metadata-file core-metrics-results/shannon\_vector.qza   
--p-metric shannon   
--p-group-column subject-id   
--p-state-column week   
--p-state-1 0   
--p-state-2 18   
--p-individual-id-column subject-id   
--p-replicate-handling random   
--o-visualization pairwise-differences.qzv

But I received this:  
Plugin error from longitudinal:

individual\_id\_column, group\_column, state\_column, and metric must all be set to unique values.

I do not understand this. What have I done wrongly?

---

<div class="post-metadata">

### Author: ![Nicholas\_Bokulich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/nicholas_bokulich/32/19937_2.png) [@Nicholas\_Bokulich](https://forum.qiime2.org/u/Nicholas_Bokulich)
#### Post date: [September 13, 2019, 4:24pm UTC](https://forum.qiime2.org/t/fmt-tutorial-pairwise-difference-comparisons/11508/2 "2019-09-13T16:24:18Z")

</div>

> [@YinXun](#):
>
> individual\_id\_column, group\_column, state\_column, and metric must all be set to unique values.

You used `subject-id` as both the `individual-id-column` (which is correct) and the `group-column` (which should specify which treatment-group the subjects are in: FMT or control)

I hope that helps!

---

<div class="post-metadata">

### Author: ![YinXun](https://forum.qiime2.org/user_avatar/forum.qiime2.org/yinxun/32/6231_2.png) [@YinXun](https://forum.qiime2.org/u/YinXun)
#### Post date: [September 13, 2019, 10:04pm UTC](https://forum.qiime2.org/t/fmt-tutorial-pairwise-difference-comparisons/11508/3 "2019-09-13T22:04:07Z")

</div>

Thank you for your help. When I changed the _group\_column_ from _subject-id_ to _treatment_ (which makes more sense), I received the message:  
_Plugin error from longitudinal:_

- State 0.0 is not represented by any members of donor group in metadata. Consider using a different group\_column or state value.\*

That is true as there is only -1 for week in donor. How do I solve this problem? Do I exclude the donor group? Thanks again!

---

<div class="post-metadata">

### Author: ![Nicholas\_Bokulich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/nicholas_bokulich/32/19937_2.png) [@Nicholas\_Bokulich](https://forum.qiime2.org/u/Nicholas_Bokulich)
#### Post date: [September 13, 2019, 10:04pm UTC](https://forum.qiime2.org/t/fmt-tutorial-pairwise-difference-comparisons/11508/4 "2019-09-13T22:04:47Z")

</div>

> [@YinXun](#):
>
> Do I exclude the donor group?

Yes

hope that helps!

---

<div class="post-metadata">

### Author: ![YinXun](https://forum.qiime2.org/user_avatar/forum.qiime2.org/yinxun/32/6231_2.png) [@YinXun](https://forum.qiime2.org/u/YinXun)
#### Post date: [September 13, 2019, 10:30pm UTC](https://forum.qiime2.org/t/fmt-tutorial-pairwise-difference-comparisons/11508/5 "2019-09-13T22:30:31Z")

</div>

Apologies for the many questions. But how do exclude the donor group, or subset the group column?

---

<div class="post-metadata">

### Author: ![Nicholas\_Bokulich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/nicholas_bokulich/32/19937_2.png) [@Nicholas\_Bokulich](https://forum.qiime2.org/u/Nicholas_Bokulich)
#### Post date: [September 13, 2019, 10:31pm UTC](https://forum.qiime2.org/t/fmt-tutorial-pairwise-difference-comparisons/11508/6 "2019-09-13T22:31:49Z")

</div>

No worries 😄

> [@YinXun](#):
>
> how do exclude the donor group, or subset the group column?

have you seen the filtering tutorial? See this section for examples:  
[https://docs.qiime2.org/2019.7/tutorials/filtering/#metadata-based-filtering](https://docs.qiime2.org/2019.7/tutorials/filtering/#metadata-based-filtering)

---

<div class="post-metadata">

### Author: ![Bethanie](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/b/9dc877/32.png) [@Bethanie](https://forum.qiime2.org/u/Bethanie)
#### Post date: [September 22, 2019, 9:16pm UTC](https://forum.qiime2.org/t/fmt-tutorial-pairwise-difference-comparisons/11508/7 "2019-09-22T21:16:04Z")

</div>

Hello, I am also really confused on this question. I have run this code to filter the table to exclude the donor group

qiime feature-table filter-samples   
--i-table table.qza   
--m-metadata-file sample-metadata.tsv   
--p-where "[treatment-group] IN ('control', 'treatment')"   
--o-filtered-table treatment-filtered-table.qza

and then run this code to do the pairways analysis

qiime longitudinal pairwise-differences   
--m-metadata-file treatment-filtered-table.qza   
--m-metadata-file shannon\_vector.qza   
--p-metric shannon   
--p-group-column treatment-group   
--p-state-column week   
--p-state-1 0   
--p-state-2 18   
--p-individual-id-column subject-id   
--p-replicate-handling random   
--o-visualization pairwise-differences.qzv

and I get a plugin error which says 'subject-id is not a column in your metadata'. I think there is a problem with my filtering but I don't know what I've done wrong.

Thank you for your help!

---

<div class="post-metadata">

### Author: ![Nicholas\_Bokulich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/nicholas_bokulich/32/19937_2.png) [@Nicholas\_Bokulich](https://forum.qiime2.org/u/Nicholas_Bokulich)
#### Post date: [September 23, 2019, 3:31pm UTC](https://forum.qiime2.org/t/fmt-tutorial-pairwise-difference-comparisons/11508/8 "2019-09-23T15:31:34Z")

</div>

Welcome to the forum, @Bethanie!

See the slight differences in your command vs. @YinXun's above:

> [@YinXun](#):
>
> –m-metadata-file sample-metadata.tsv

> [@Bethanie](#):
>
> –m-metadata-file treatment-filtered-table.qza

You are inputting the filtered feature table, rather than the sample metadata file, so indeed as the error message indicates:

> [@Bethanie](#):
>
> subject-id is not a column in your metadata

Swap in the sample metadata instead of the feature table and you should be good to go!

(but you have inadvertently discovered one of the neat secrets of QIIME 2: feature tables can be input as metadata, which is useful for some commands)

---

<div class="post-metadata">

### Author: ![Bethanie](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/b/9dc877/32.png) [@Bethanie](https://forum.qiime2.org/u/Bethanie)
#### Post date: [September 24, 2019, 4:05pm UTC](https://forum.qiime2.org/t/fmt-tutorial-pairwise-difference-comparisons/11508/9 "2019-09-24T16:05:40Z")

</div>

Thank you so much @Nicholas_Bokulich!! I am trying to teach myself so it is a bit of a learning curve!!

So when I input the sample metadata file instead of my filtered feature table, I get the error message which says that it hasn't been filtered and that there's no 0.0 in the donor group.

How do I filter the metadata in a way that it can still be inputted into the pairways analysis?

Thank you!!

---

<div class="post-metadata">

### Author: ![Nicholas\_Bokulich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/nicholas_bokulich/32/19937_2.png) [@Nicholas\_Bokulich](https://forum.qiime2.org/u/Nicholas_Bokulich)
#### Post date: [September 24, 2019, 4:10pm UTC](https://forum.qiime2.org/t/fmt-tutorial-pairwise-difference-comparisons/11508/10 "2019-09-24T16:10:35Z")

</div>

> [@Bethanie](#):
>
> How do I filter the metadata in a way that it can still be inputted into the pairways analysis?

The best way to filter a sample metadata file is just to delete the rows that you don't want. You can do this quickly with grep:

```auto
grep -v 'donor' sample-metadata.tsv > filtered-sample-metadata.tsv

```

(that will remove rows that say "donor" anywhere in the row, and output a new metadata file that you can use... whether or not that works for the pairwise-differences command in the context of the data you are inputting I do not know so you may need to adjust this... also note it is case-sensitive so may need to be adjusted 😄)

---

<div class="post-metadata">

### Author: ![Bethanie](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/b/9dc877/32.png) [@Bethanie](https://forum.qiime2.org/u/Bethanie)
#### Post date: [September 24, 2019, 4:37pm UTC](https://forum.qiime2.org/t/fmt-tutorial-pairwise-difference-comparisons/11508/11 "2019-09-24T16:37:43Z")

</div>

Thank you so much!!! It has worked!! I have been stuck on this command for 4 days now so I am very happy 😃 😃

---

<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: [October 25, 2019, 10:45pm UTC](https://forum.qiime2.org/t/fmt-tutorial-pairwise-difference-comparisons/11508/12 "2019-10-25T22:45:49Z")

</div>

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