Q2-feature-table filter-samples examples?

Are there any examples of how to specify the WHERE clause under the --p-where parameter to filter out samples based on metadata using q2-feature-table? For instance, how can I use this to specify to filter out samples by index, or filter out samples within a specific pH range?

1 Like

Hi @mortonjt, we have a tutorial up on the docs site all about filtering, with a short section dedicated to the SQL WHERE syntax:

https://docs.qiime2.org/2017.2/tutorials/filtering/#metadata-based-filtering

We are planning on beefing up some of the SQL WHERE examples in the near future. So if you wanted to filter based on something like pH range (and your Metadata Category was named `pH``):

--p-where "CAST(pH AS INTEGER) BETWEEN 2 AND 4" 

Also, just to clarify, we use SQLite as the SQL engine for processing these queries, so if you want to find some additional resources in the near future (before we improve the filtering tutorial), that should help guide your search.

3 Likes