Filter samples by "sample-id" doesn't remove selected samples

Hi everyone,

I'm trying to remove two specific samples from my feature-table using the filter-samples according to this post: Filtering by Sample ID not working
new_decontaminated-table-2.qza (307.8 KB)
new_decontaminated-table-2.qzv (666.5 KB)
Metadata_Jess.txt (7.0 KB)

qiime feature-table filter-samples \
  --i-table new_decontaminated-table-2.qza \
  --m-metadata-file Metadata_Jess.txt  \
  --p-where "\"#sample-id\" IN ('URCA272019', 'VV112021')" \
  --p-exclude-ids \
  --o-filtered-table Jess_table.qza
  
  qiime feature-table summarize \
  --i-table Jess_table.qza \
  --o-visualization Jess_table.qzv \
  --m-sample-metadata-file Metadata_Jess.txt

Seems to have gone well, because I have the outputs, but when I've generated the .qzv file, it has no differences compared to the original .qzv feature-table.

Jess_table.qza (314.6 KB)
Jess_table.qzv (673.3 KB)

I'm don't finding where is the error, how can I adjust my code?

Hi @joaomiranda ,

This is not working because "#sample-id" is not a metadata column. This action works by filtering samples based on metadata information (then the --p-where option is used), but if you pass a non-existent metadata column it will not find anything.

See here for information on how to filter by IDs instead of by metadata:
https://docs.qiime2.org/2024.2/tutorials/filtering/#identifier-based-filtering

2 Likes

Hi @Nicholas_Bokulich ,

Thanks for the prompt answer!

It was quite simple, I have just removed the two samples in my metadata, and ran qiime feature-table filter-samples.

It worked perfectly!

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