Is there a way to group features that have a low relative abundance within a sample?

Hey there,

I’ve filtered my table and created a taxa plot, but there are many samples that make up a small percentage of the sample. Is there a way to group all samples that occur less than 10% (arbitrary) into an assignment called “Other” (arbitrary name) ?

Thanks!

Esra

Hi @emescioglu,

I believe you are talking about grouping features that appear less than 10% of the time into an arbitrary feature right?

I think this process (which is a bit involved) should work:

  1. Create two tables via feature-table filter-features containing what we want to keep, and what we want to group using max and min frequency:

    qiime feature-table filter-features \
       --i-table original-table.qza \
       --p-max-frequency <find the count that represents your 10% threshold> \
       --o-filtered-table to-group.qza`
    
    qiime feature-table filter-features \
       --i-table original-table.qza \
       --p-min-frequency <same as above, but add 1 to the number> \
       --o-filtered-table to-keep-as-is.qza
    
  2. Create a feature metadata file with all of the feature IDs in your to-group.qza mapping to a single value like "Other". You should be able to use feature-table summarize's .csv download to get that file started in Excel. Just make sure you save as a TSV.

  3. Group the features you want to combine:

    qiime feature-table group \
       --i-table to-group.qza \
       --p-axis feature \
       --m-metadata-file <whatever you made> \
       --m-metadata-column <the name of that column you made> \
       --p-mode <up to you, there's sum, median-ceiling, and mean-ceiling> \
       --o-grouped-table to-be-merged.qza
    
  4. Combine your two tables again:

    qiime feature-table merge \
      --i-tables to-keep-as-is.qza
      --i-tables to-be-merged.qza
      --p-overlap-method error_on_overlapping_feature
      --o-merged-table your-completed-table.qza
    

Let me know if that works for you!

1 Like

Hi Evan,

Thank you! I will try it and let you know if it works

1 Like

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