Syntax for where parameter to feature-table filter-samples and filter-features

Hi Greg,
I just want to follow up on the sample filtering from a dataset. I believe I should use
–p-where flag but I am not sure what the syntax should if I would like to filter our samples based on the category in a metadata file, similar to the positive and negative filtering in Qiime1
Daniel

Hi @latild,
I’m currently working on some documentation for this functionality. This uses SQL where clause syntax, which supports more complex filtering than was possible in QIIME 1. Here are a few of examples based on the data in the Moving Pictures tutorial.

Filter to only subject-1 samples:

qiime feature-table filter-samples --i-table table.qza --m-sample-metadata-file sample-metadata.tsv --p-where "Subject='subject-1'" --o-filtered-table filtered-table

Filter to only subject-1 gut samples:

qiime feature-table filter-samples --i-table table.qza --m-sample-metadata-file sample-metadata.tsv --p-where "Subject='subject-1' AND BodySite='gut'" --o-filtered-table filtered-table

Filter to only subject-1 non-gut samples:

qiime feature-table filter-samples --i-table table.qza --m-sample-metadata-file sample-metadata.tsv --p-where "Subject='subject-1' AND NOT BodySite='gut'" --o-filtered-table filtered-table

Do these examples get you moving with this functionality?

2 Likes

That’s exactly what I need. Thank you.
Daniel

@latild, we now have the feature table filtering tutorial @gregcaporaso wrote on the live site:

https://docs.qiime2.org/2.0.6/tutorials/table-filtering/