--p-where for two seperate names in a metadata column

Hi everyone :slight_smile:

I am trying to filter my feauture table to only include my Reservoir names Blank and Dolwen. For some reason it works fine when only searching for Dolwen but when I combine the two I get an error. Here is my code:

qiime feature-table filter-samples
–i-table "{data_path}/table_no_chloroplast.qza" \ --m-metadata-file {metadata}
–p-where “Reservoir=‘Dolwen’,‘Blank’”
–o-filtered-table “${data_path}/Dolwen_16s_no_chloroplast_table.qza”

Any help would be greatly appreciated.

Thank you.

According to this tutorial, you should use the following:
--p-where "[Reservoir] IN ('Dolwen', 'Blank')"
Hope this help

1 Like

This did work thank you so much :slight_smile:

But now I am having problems with filtering my rep seqs in the same manner. I have tried the followinf code:

qiime feature-table filter-seqs
–i-data "{data_path}/merged_16s_rep-seqs.qza" \ --m-metadata-file {metadata}
–p-where “[Reservoir] IN (‘Dolwen’,‘Negative’)”
–o-filtered-data “${data_path}/Dolwen_16s_rep-seqs.qza”

But get this error message:

Plugin error from feature-table:

All features were filtered out of the data.

Do you know how to overcome this please?

Maybe you should try to filter your sequences by providing already filtered table:

qiime feature-table filter-seqs \
  --i-data rep-seqs.qza \
  --i-table filtered_table.qza \
  --o-filtered-data filtered_rep-seqs.qza

That did work :slight_smile: thank you!

This has just worked :slight_smile: dont know why it didn’t like the same code for filtering rep-seqs but filtering using the filtered table did work so thank you so much!

I think it is because metadata file and table.qza are partially sharing the same data, as well as table.qza and rep-seqs.qza. But metadata and rep-seqs.qza do not :thinking:

1 Like

That would make sense :slight_smile: thank you all for your help!

1 Like

Because the filter you applied to the table was for the sample IDs, but those IDs will never be present in your rep seqs, because that is comprised of Feature IDs, which is why everything was filtered out. The approach you ultimately took is the right one, good work!

1 Like