Removing/deleting a single feature from a feature table?

Hello, Is there a way to remove/delete a single feature from a feature table and retain everything else? I have gone through the tutorial and have successfully pulled out a single feature into its own table using the following command, but what I really need to do is keep everything except the feature that I am passing to this command.

Thanks so much!

echo Index > samples-to-keep2.tsv
echo cc54b94ef0be011a9fbed58cd5fd69e2 >> samples-to-keep2.tsv

sbatch qiime feature-table filter-features \
 --i-table filtered-table2.qza \
 --m-feature-metadata-file samples-to-keep2.tsv \
 --o-filtered-table index-filtered-table3.qza

Hey @Nathan_Stone1,

There’s not a great way to invert this relationship (as far as I know).

One thing you could try, is going to your feature-table summary and on the first tab, there’s the Frequency Per Feature section. At the bottom is a download link for a csv file. You should be able to convert that to a tsv (with Excel or similar programs). Then then you could just remove the line that starts with cc54b94ef0be011a9fbed58cd5fd69e2 from your tsv file (alternatively you could use the --p-where clause to do this dynamically, but you’d still need all feature IDs present in your tsv to start with).

Sorry I don’t have any better suggestions.

1 Like

Thanks! That worked great. I downloaded the Frequency Per Feature.csv, removed the feature I wanted excluded and re-saved as a .tsv in google docs (Excel doesn’t have a .tsv option).

2 Likes

I created an issue to have this type of filtering support added to filter-samples/filter-features.

1 Like

Quick note that this type of filtering will be supported in the upcoming 2017.6 release (scheduled for this week). Specifically:

Added an --exclude-ids option to filter-samples and filter-features to exclude (instead of retain) samples/features selected by metadata or where parameters.

1 Like