How to filter control samples from my feature-table

On the same topic,

I ran all the analysis containing the negative DNA controls, PCR controls and the Mock community. Now I want to remove these variables from my feature table and I have used the following code, but I keep getting the following error, saying

ValueError: Selection of IDs failed with query:
*** SELECT “#SampleID” FROM metadata WHERE #SampleID (‘BN1HolyNE01’, ‘B057HolyNE02’, ‘B074HolyNE03’, ‘BMC1Holy’, ‘BNP1Holy’, ‘B098HolyNE04T4’) GROUP BY “#SampleID” ORDER BY “#SampleID”;***

Code used:
*qiime feature-table filter-samples *
–i-table Filtered-table/Bacteria-Table-Filtered.qza
–m-metadata-file Metadata-Bacteria.tsv
–p-exclude-ids
–p-where “#SampleID (‘BN1HolyNE01’, ‘B057HolyNE02’, ‘B074HolyNE03’, ‘BMC1Holy’, ‘BNP1Holy’, ‘B098HolyNE04T4’)”
–o-filtered-table Bacteria-Filtered-NoNegs.qza

I have looked online, but cannot seem to find anything to guide me, in terms of what I am doing wrong.

Hi @fabipc,

I think your issue is in the command construction around the where command. My (simplistic) solution would be to either include a column in your metadata where you specify that they’re controls (this is usually my approach, so, like for my disease status I have case | control | not applicable or something similar. The other (easy!) option is to just make a text file with the list of sample IDs and then pass it as metadata.

Hope that helps!

Best,
Justine

4 Likes

Try this:
--p-where "[#SampleID] IN ('BN1HolyNE01', 'B057HolyNE02', 'B074HolyNE03', 'BMC1Holy', 'BNP1Holy', 'B098HolyNE04T4')"

Though I am not sure whether you can search by #SampleID. If that does not work, then definitely try @jwdebelius's advice, it will take a bit more time if you need to add a metadata column but what you lose in time you will gain in tranquility!

3 Likes

Hello everyone,

Thanks for the help. I figured I’d try Nicholas suggestion first since it was easier and it worked :smiley:

Thanks

2 Likes

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