Beta diversity - metadata error

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 (6.3 KB)

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, 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 and here. 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:

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!

2 Likes

Greg,

Thank you. Yes this worked.

Morgan

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