Filter-table error due to whitespaces in the TSV

Hello!

So when I try to filter for mitochondria and chloroplasts using the following command:

qiime taxa filter-table
–i-table idfilttable.qza
–i-taxonomy taxonomy.qza
–p-exclude mitochondria,chloroplast
–o-filtered-table 1907table.qza

I get this error message:

CategoricalMetadataColumn does not support values with leading or trailing whitespace characters. Column ‘Taxon’ has the following value: 'D_0__Bacteria;D_1__Bacteroidetes;D_2__Ignavibacteria;D_3__OPB56;D_4__uncultured bacterium ’

This bug has already been reported and there is a thread open in GitHub about it: https://github.com/qiime2/q2-types/issues/179

It was several times re opened in the forums: (Qiime taxa filter-table; leading or trailing whitespace characters , Error: Silva132 99% classifer, white space in taxa name) and the solution proposed in those cases is posted here: Qiime taxa filter-table error

So I followed the advice and ran:

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

I dont fully understand this export function, do you need to create a folder to which the content in the taxonomy.qza is exported to? Anyways, when I try to run it I get this error message:

Error: no such option: --output-dir

I thought if I created a folder called taxonomy-with-spaces it would be solved but I guess I simply dont understand this export function. I tried qiime tools export --help and saw the option presented there is --output-path instead of --output-dir but I just get the same error. Could you help me out please?

Best regards!

Hi @Melissa,
I’m guessing the export/re-import solution here just uses qiime’s internal transformation to get rid of those white spaces.
As for why you are getting that error is that the more updated qiime2 version replaced --output-dir with --output-path so if you use the latter instead I believe it should work.

1 Like

Hi, Melissa!
The commands you are running a little bit outdated - there were changes in commands.

qiime tools export \
    --input-path taxonomy.qza \
    --output-path taxonomy-with-spaces
qiime metadata tabulate \
    --m-input-file taxonomy-with-spaces/taxonomy.tsv  \
    --o-visualization taxonomy-as-metadata.qzv
qiime tools export \
    --input-path taxonomy-as-metadata.qzv \
    --output-path taxonomy-as-metadata
qiime tools import \
    --type 'FeatureData[Taxonomy]' \
    --input-path taxonomy-as-metadata/metadata.tsv \
    --output-path taxonomy-without-spaces.qza

This ones should be fine

2 Likes