Filter from one group

Is it possible to do filter only on one group?
For instance, If Im comparing two groups and I want to filter taxa that do not found in 50% of the samples of each of the groups.
Is it possible to do it?

Hi @2508,

filter-features is the command you are looking for, but it sounds like you may need to do a bit of work to achieve your goal (if I understand correctly).

If you want taxa found in at least 50% of all samples, you can use filter-features in a single command. However, if you want to filter out features not found in 50% of samples in group A, and also features not found in 50% of samples in group B, you will need to do this in a few steps:

  1. Use filter-samples twice to generate separate feature tables for groups A and B.
  2. On each of these feature tables, run filter-features to remove features found in < 50% of samples (use the --p-min-samples parameter).
  3. Then merge these feature tables. Note that features filtered from group A might still be found in group B, and vice versa. If you don’t want those features present, either, don’t merge. Instead, follow the first few steps in this forum post to get lists of features present in each feature table (i.e. features that pass filter). After getting those lists, combine these lists and only retain features found in both tables using the following commands in your terminal:
echo 'Feature ID\tFrequency'  > feature-frequency-detail.csv
cat feature-frequency-detail-A.csv feature-frequency-detail-B.csv | sort | uniq -d >> feature-frequency-detail.csv

Then use filter-features to filter your ORIGINAL feature table to only contain the features found in your list with a command like this:

$ qiime feature-table filter-features \
  --i-table table.qza \
  --m-metadata-file feature-frequency-detail.csv \
  --p-no-exclude-ids \
  --o-filtered-table filtered-table.qza

I hope that helps!

1 Like

Thank you very much
I tried it and it work perfect!!!

1 Like

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