Qiime taxa filter-table error

Hi ~,
when i try to use the taxa filter-table, i got plug error:
"Plugin error from taxa:

CategoricalMetadataColumn does not support strings with leading or trailing whitespace characters: 'D_0__Bacteria;D_1__Chloroflexi;D_2__Gitt-GS-136;D_3__uncultured bacterium ’

Debug info has been saved to /tmp/qiime2-q2cli-err-xm1a_ve7.log"
my commands are:
qiime taxa filter-table
–i-table unfiltered-table.qza
–i-taxonomy taxonomy.qza
–p-include 0__Bacteria
–o-filtered-table table.qza

I want to keep all sequences which contain Bacteria. According to Qiime taxa filter-table filtering multiple taxa, i need to use 0__Bacteria.

When i go to the debug log:
part of it looks like this(It is long, i only copied part of it here):File “/mnt/research/germs/softwares/miniconda2/envs/qiime2-2018.2/lib/python3.5/site-packages/qiime2/metadata/metadata.py”, line 218, in normalize
dataframe
metadata_column = self._metadata_column_factory(series)
File “/mnt/research/germs/softwares/miniconda2/envs/qiime2-2018.2/lib/python3.5/site-packages/qiime2/metadata/metadata.py”, line 230, in _metadata_c
olumn_factory
column = CategoricalMetadataColumn(series)
File “/mnt/research/germs/softwares/miniconda2/envs/qiime2-2018.2/lib/python3.5/site-packages/qiime2/metadata/metadata.py”, line 632, in init
self._series = self.normalize(series)
File “/mnt/research/germs/softwares/miniconda2/envs/qiime2-2018.2/lib/python3.5/site-packages/qiime2/metadata/metadata.py”, line 758, in normalize
return series.apply(normalize, convert_dtype=False)
File “/mnt/research/germs/softwares/miniconda2/envs/qiime2-2018.2/lib/python3.5/site-packages/pandas/core/series.py”, line 2551, in apply
mapped = lib.map_infer(values, f, convert=convert_dtype)
File “pandas/_libs/src/inference.pyx”, line 1521, in pandas._libs.lib.map_infer
File “/mnt/research/germs/softwares/miniconda2/envs/qiime2-2018.2/lib/python3.5/site-packages/qiime2/metadata/metadata.py”, line 748, in normalize
“whitespace characters: %r” % (cls.name, value))
ValueError: CategoricalMetadataColumn does not support strings with leading or trailing whitespace characters: 'D_0__Bacteria;D_1__Chloroflexi;D_2__Gi
tt-GS-136;D_3__uncultured bacterium ’

The taxonomy.qza which contains these 'D_0__Bacteria;D_1__Chloroflexi;D_2__Gitt-GS-136;D_3__uncultured bacterium ’ was generated by qiime2 after the following commands:
qiime feature-classifier classify-consensus-blast
–i-query rep-seqs.qza
–i-reference-taxonomy majority_taxonomy_7_levels.qza
–i-reference-reads 97_otus_16S.qza
–o-classification taxonomy
–p-perc-identity 0.90
–p-maxaccepts 1

Anybody has any idea to solve this error?

Thanks

Hi @mly! Looks like you found a bug! :bug:

I opened a bug report up here: https://github.com/qiime2/q2-types/issues/179

Okay, so in the meantime, here is a solution for you to move forward:

qiime tools export taxonomy.qza \
  --output-dir taxonomy-with-spaces
qiime metadata tabulate \
  --m-input-file taxonomy-with-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

Okay, so that is a lot of steps (sorry!) but it should get you moving forward. Also, exporting will ruin the provenance tracking, so unfortunately you will lose out on that for the taxonomy artifact you are working with. Anyway, give that a shot and let us know how it goes! I just tested it locally and it worked as expected, by the way.

Thanks! :t_rex:

2 Likes

An off-topic reply has been split into a new topic: Filtering taxa help

Please keep replies on-topic in the future.

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