Import of taxonomy .txt file is failing

Hello everyone!
I am new to qiime2 and at the moment I have problems importing the Taxonomy.txt file.
Maybe it helps to solve the problem if I explain that I transferred the taxonomy manually into a text document (TextEdit). I copied from Geneious Prime "Name" and "Taxonomy" (tab separated). Since it was a RTF document without .txt extension I converted it to a .txt with an online converter.
qiime tools import
--input-path taxonomy.txt
--output-path taxonomy.qza
--type 'FeatureData[Taxonomy]'
When I tried to import the document into qiime2 I got this error:

Traceback (most recent call last):
File "/Users/Franzi/miniconda3/envs/qiime2-2023.5/lib/python3.8/site-packages/q2cli/builtin/tools.py", line 266, in import_data
artifact = qiime2.sdk.Artifact.import_data(type, input_path,
File "/Users/Franzi/miniconda3/envs/qiime2-2023.5/lib/python3.8/site-packages/qiime2/sdk/result.py", line 327, in import_data
return cls.from_view(type, view, view_type, provenance_capture,
File "/Users/Franzi/miniconda3/envs/qiime2-2023.5/lib/python3.8/site-packages/qiime2/sdk/result.py", line 355, in _from_view
result = transformation(view, validate_level)
File "/Users/Franzi/miniconda3/envs/qiime2-2023.5/lib/python3.8/site-packages/qiime2/core/transform.py", line 68, in transformation
self.validate(view, level=validate_level)
File "/Users/Franzi/miniconda3/envs/qiime2-2023.5/lib/python3.8/site-packages/qiime2/core/transform.py", line 143, in validate
view.validate(level)
File "/Users/Franzi/miniconda3/envs/qiime2-2023.5/lib/python3.8/site-packages/qiime2/plugin/model/file_format.py", line 26, in validate
self.validate(level)
File "/Users/Franzi/miniconda3/envs/qiime2-2023.5/lib/python3.8/site-packages/q2_types/feature_data/_format.py", line 140, in validate
self._check_n_records(n={'min': 10, 'max': None}[level])
File "/Users/Franzi/miniconda3/envs/qiime2-2023.5/lib/python3.8/site-packages/q2_types/feature_data/_format.py", line 108, in check_n_records
for i, line in file
:
File "/Users/Franzi/miniconda3/envs/qiime2-2023.5/lib/python3.8/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
File "/Users/Franzi/miniconda3/envs/qiime2-2023.5/lib/python3.8/encodings/utf_8_sig.py", line 69, in _buffer_decode
return codecs.utf_8_decode(input, errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

An unexpected error has occurred:

'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

See above for debug info.

taxonomy.txt (158.0 KB)

Does anyone know what the problem is?
I would appreciate any help very much.
Have a great day!
Franzi

Hello @F_Mauthe,

It looks like your metadata file is utf-16 encoded but it needs to be utf-8 encoded. See this post for more info.

Thank you @colinvwood!
I changed it to utf-8. Then the next problem occurred: Taxonomy format requires at least two columns, found 1.
So I tried to create a .tsv with 2 columns manually instead of the .txt (tab-separated) and finally managed to import:
qiime tools import
--type 'FeatureData[Taxonomy]'
--input-format HeaderlessTSVTaxonomyFormat
--input-path taxonomy.tsv
--output-path taxonomy.qza

There is probably an easier way, but this is how it worked for me at the end and if someone has the same problem, maybe it will help them.

best wishes
Franzi

2 Likes

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