# Beta diversity - metadata error

**URL:** https://forum.qiime2.org/t/beta-diversity-metadata-error/3473
**Category:** User Support
**Tags:** metadata
**Created:** [March 19, 2018, 2:29pm UTC](https://forum.qiime2.org/t/beta-diversity-metadata-error/3473 "2018-03-19T14:29:54Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![morganpuff](https://forum.qiime2.org/user_avatar/forum.qiime2.org/morganpuff/32/5446_2.png) [@morganpuff](https://forum.qiime2.org/u/morganpuff)
#### Post date: [March 19, 2018, 2:29pm UTC](https://forum.qiime2.org/t/beta-diversity-metadata-error/3473/1 "2018-03-19T14:29:54Z")

</div>

When running beta diversity on my ITS data

qiime diversity beta-group-significance   
--i-distance-matrix weighted\_unifrac\_distance\_matrix.qza   
--m-metadata-file meta\_ITS.txt   
--m-metadata-column Description   
--o-visualization weighted-unifrac-description.qzv   
--p-pairwise

I get:

> Plugin error from diversity:
> 
> > All values in the grouping vector are unique. This method cannot operate on a grouping vector with only unique values (e.g., there are no 'within' distances because each group of objects contains only a single object).  
> > Debug info has been saved to /tmp/qiime2-q2cli-err-wgawlcud.log

However, I have run this before on my 16s data and has run fine (the same principle of the metadata).

There are two samples in my data which are the only ones with individual "description" names (if you check these for duplicates), while all the others appear at least twice. I am wondering if this is the cause of my error.

I would like to, in theory, run the command ignoring this problem and not having to remove the samples entirely and re-run stats as I have already started analyzing the other statistics. I can always adjust my downstream to ignore the pairwise with low sample sizes.

Let me know if this makes sense or if you need more information. I am attaching my metadata file as well.

[meta\_ITS.txt](https://cdck-file-uploads-global.s3.dualstack.us-west-2.amazonaws.com/flex002/uploads/qiime21/original/2X/7/7556e0c767d809515a3b5fb28b355c8631da3675.txt) (6.3 KB)

---

<div class="post-metadata">

### Author: ![ebolyen](https://forum.qiime2.org/user_avatar/forum.qiime2.org/ebolyen/32/11_2.png) [@ebolyen](https://forum.qiime2.org/u/ebolyen)
#### Post date: [March 19, 2018, 3:00pm UTC](https://forum.qiime2.org/t/beta-diversity-metadata-error/3473/2 "2018-03-19T15:00:49Z")

</div>



---

<div class="post-metadata">

### Author: ![gregcaporaso](https://forum.qiime2.org/user_avatar/forum.qiime2.org/gregcaporaso/32/17769_2.png) [@gregcaporaso](https://forum.qiime2.org/u/gregcaporaso)
#### Post date: [March 19, 2018, 4:40pm UTC](https://forum.qiime2.org/t/beta-diversity-metadata-error/3473/3 "2018-03-19T16:40:53Z")

</div>

Hi @morganpuff,  
At the moment, this analysis won't work if you're providing the `--p-pairwise` parameter and some of your groups only contain a single sample. We have an [open issue to address this](https://github.com/qiime2/q2-diversity/issues/155), as we realize that this is very inconvenient.

In the meantime, the workarounds are to (1) not compute the pairwise statistics (leave out the `--p-pairwise` option) - probably not what you want to do, or (2) filter those samples from the distance matrix using `qiime diversity filter-distance-matrix`. You can find some information on how to use metadata based filtering to filter your distance matrix [here](https://docs.qiime2.org/2018.2/tutorials/filtering/#metadata-based-filtering) and [here](https://docs.qiime2.org/2018.2/tutorials/filtering/#filtering-distance-matrices). If your sample metadata file were called `sample-metadata.tsv`, and your `Description` groups containing only a single sample were `description-1` and `description-2`, you could filter your distance matrix as follows to drop the two corresponding samples:

```bash
qiime diversity filter-distance-matrix \
  --i-distance-matrix distance-matrix.qza \
  --o-filtered-distance-matrix filtered-distance-matrix.qza \
  --m-metadata-file sample-metadata.tsv \
  --p-where "Description NOT IN ('description-1', 'description-2')"

```

I hope this helps - sorry for the inconvenience!

---

<div class="post-metadata">

### Author: ![gregcaporaso](https://forum.qiime2.org/user_avatar/forum.qiime2.org/gregcaporaso/32/17769_2.png) [@gregcaporaso](https://forum.qiime2.org/u/gregcaporaso)
#### Post date: [March 20, 2018, 10:04am UTC](https://forum.qiime2.org/t/beta-diversity-metadata-error/3473/4 "2018-03-20T10:04:19Z")

</div>



---

<div class="post-metadata">

### Author: ![morganpuff](https://forum.qiime2.org/user_avatar/forum.qiime2.org/morganpuff/32/5446_2.png) [@morganpuff](https://forum.qiime2.org/u/morganpuff)
#### Post date: [March 22, 2018, 12:47pm UTC](https://forum.qiime2.org/t/beta-diversity-metadata-error/3473/5 "2018-03-22T12:47:01Z")

</div>

Greg,

Thank you. Yes this worked.

Morgan

---

<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: [April 22, 2018, 6:47pm UTC](https://forum.qiime2.org/t/beta-diversity-metadata-error/3473/6 "2018-04-22T18:47:02Z")

</div>

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