Qiime taxa filter-table; leading or trailing whitespace characters

Hi all,

I am currently trying to filter select taxa (e.g., archaea) from my table, and I am running into the following error:

"Plugin error from taxa:

CategoricalMetadataColumn does not support values with leading or trailing whitespace characters. Column ‘Taxon’ has the following value: 'D_0__Bacteria;D_1__Armatimonadetes;D_2__uncultured;D_3__uncultured bacterium '"

From reading the previous forums, its advised to either delete whitespaces manually [this did not work] or using a transformer https://github.com/qiime2/q2-types/issues/179 should work. How would one go about using the transformer?


Hey there @Tyler_Carrier!

This is really the only way forward at the moment — if it “didn’t work,” that indicates that you didn’t actually delete the trailing whitespace. Can you provide us with some concrete commands or actions you performed?

I think there might be a misunderstanding here, you are already using those transformers when you are filtering your table (the transformer is invoked automatically). The issue linked above was proposing amending those transformers to strip the whitespace, but, that hasn’t happened yet.

Hi Matt,

To delete the whitespaces, I exported “silva-132-99-taxonomy.qza” and opened the file in Sublime. Using the search function, I proceeded to delete all whitespaces. [If these are different than ‘normal’ spaces, then I did it wrong.]

My commands in q2, however, were:
qiime taxa filter-table
–i-table [Table post-pairing, -QC, -deblur]
–i-taxonomy silva-132-99-taxonomy.qza
–p-include 0__Bacteria
–p-mode contains
–output-dir [Table post-pairing, -QC, -deblur, -NoArchaea]

OH! well, that is great, then… because I was utterly confused. Until that amendment is integrated, is there a custom command or script that has been developed to combat this issue?


You can follow the workflow outline here:

Hi Matt,

Ah, brilliant. For clarification, I would:

qiime tools export silva-132-99-taxonomy.qza
–output-dir silva-132-99-taxonomy_spaces

qiime metadata tabulate
–m-input-file silva-132-99-taxonomy_spaces/taxonomy.tsv
–o-visualization taxonomy-as-metadata.qzv

qiime tools export taxonomy-as-metadata.qzv
–output-dir taxonomy-as-metadata

qiime tools import
–type ‘FeatureData[Taxonomy]’
–input-path taxonomy-as-metadata/metadata.tsv
–output-path taxonomy-without-spaces.qza

Following this, I would use this modified file for “qiime feature-classifier classify-sklearn” and then “qiime taxa filter-table”?


1 Like

2 off-topic replies have been split into a new topic: Feature IDs don’t match

Please keep replies on-topic in the future.

Hi Matt,

I found another way to delete all white spaces and have the output work downstream:

qiime tools export
–input-path $PWD/silva-132-99-taxonomy.qza
–output-path $PWD/silva-132-99-taxonomy

tr -d ’ ’ < $PWD/silva-132-99-taxonomy/taxonomy.tsv > $PWD/silva-132-99-taxonomy/taxonomy_nospaces.tsv

qiime tools import
–type ‘FeatureData[Taxonomy]’
–input-path $PWD/silva-132-99-taxonomy/taxonomy.tsv
–output-path $PWD/silva-132-99-taxonomy.qza

Then after “qiime feature-classifier fit-classifier-naive-bayes,” you’ll need to run “qiime feature-classifier classify-sklearn” with:
–p-confidence -1
–p-read-orientation same

Hope this helps others in the community


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