Filtering by OR

I am trying to filter my samples to include only 2 ages in my table. I run the command:

qiime feature-table filter-samples\
    --i-table filtered_week_and_no_blanks.qza \
    --p-min-frequency 1 \
    --p-min-features 1 \
    --m-metadata-file merge_no_blank2.tsv \
    --p-where  "'age'='1' OR 'age'='7'" \
    --output-dir day_1_and_7

But then when I try to analyze the table I get this error:

Plugin error from diversity:

  The provided table object is empty

Debug info has been saved to /var/folders/n8/0xt_lgk564l03t70txcj45xc0000gn/T/qiime2-q2cli-err-5356jqlw.log

It seems the command has filtered out all of my samples. Have I formatted the “–p-where” incorrectly? If so, what’s the correct formatting type? Thank you.

1 Like

Hi @Stephanieorch!

Yeah, it sure looks like it :frowning:

Yep, but no worries, these are subtly tricky things to write - I have done this same thing so many times in my own work, too! You have extra quotes around your query column in your where-clause, which causes the underlying database to think you are comparing two strings, instead of searching for a value in a column.

Give this a whirl:

 qiime feature-table filter-samples \
    --i-table filtered_week_and_no_blanks.qza \
    --p-min-frequency 1 \
    --p-min-features 1 \
    --m-metadata-file merge_no_blank2.tsv \
    --p-where  "age='1' OR age='7'" \
    --output-dir day_1_and_7

I hope that helps! :t_rex:

That worked! Thank you.

1 Like

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