TypeError in importing Silva Taxonomy

Continuing the discussion from Taxonomy import for SILVA majority_taxonomy_all_levels.txt:

Hi there
I am having some trouble importing a taxonomy file from the Qiime2 compatible Silva download. I followed the instructions from the linked conversation, but I then get a TypeError (below). Any ideas on how to fix this? I have converted the .txt file to a .tsv already and double checked that there was a tab between the accession no. and the taxonomy info.

Thanks,
Laura

/home/LauraMason326/miniconda3/envs/qiime2-2017.12/lib/python3.5/site-packages/h5py/__init__.py:34: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Traceback (most recent call last):
  File "/home/LauraMason326/miniconda3/envs/qiime2-2017.12/lib/python3.5/site-packages/q2cli/tools.py", line 116, in import_data
    view_type=source_format)
  File "/home/LauraMason326/miniconda3/envs/qiime2-2017.12/lib/python3.5/site-packages/qiime2/sdk/result.py", line 214, in import_data
    return cls._from_view(type_, view, view_type, provenance_capture)
  File "/home/LauraMason326/miniconda3/envs/qiime2-2017.12/lib/python3.5/site-packages/qiime2/sdk/result.py", line 239, in _from_view
    result = transformation(view)
  File "/home/LauraMason326/miniconda3/envs/qiime2-2017.12/lib/python3.5/site-packages/qiime2/core/transform.py", line 59, in transformation
    new_view = transformer(view)
  File "/home/LauraMason326/miniconda3/envs/qiime2-2017.12/lib/python3.5/site-packages/qiime2/core/transform.py", line 207, in wrapped
    file_view = transformer(view)
  File "/home/LauraMason326/miniconda3/envs/qiime2-2017.12/lib/python3.5/site-packages/q2_types/feature_data/_transformer.py", line 177, in _20
    _taxonomy_formats_to_dataframe(str(ff), has_header=False))
  File "/home/LauraMason326/miniconda3/envs/qiime2-2017.12/lib/python3.5/site-packages/q2_types/feature_data/_transformer.py", line 83, in _taxonomy_formats_to_dataframe
    "are duplicated: %s" % ', '.join(df.index.get_duplicates()))
TypeError: sequence item 0: expected str instance, float found

An unexpected error has occurred:

  sequence item 0: expected str instance, float found

See above for debug info.

Hi @LauraMason,

Could you send us the full command you ran?

Thanks!

Here it is:

 qiime tools import --type FeatureData[Taxonomy] --input-path SILVA_132_QIIME_release/taxonomy/16S_only/97/taxonomy_7_levels.tsv 
    --output-path SILVA_132_QIIME_release/taxonomy/16S_only/97/taxonomy_7_levels.qza 
    --source-format HeaderlessTSVTaxonomyFormat

Hi @LauraMason,

In the original thread there is an example of the first lines of majority_taxonomy_all_levels.txt, could you make sure that SILVA_132_QIIME_release/taxonomy/16S_only/97/taxonomy_7_levels.tsv looks the same?

Thanks!

The files look like they are set up similarly: [Accession][tab][taxonomic_info].
The main difference is that the majority_taxonomy_all includes up to 14 taxonomic levels, and my file includes only 7.

Before I forget, have you had a chance to check out @gregcaporaso’s SILVA 132 post?


Hi @LauraMason - did you happen to edit or modify the SILVA_132_QIIME_release/taxonomy/16S_only/97/taxonomy_7_levels.tsv file at all? I ask because I just downloaded a fresh copy of SILVA 132 and ran the exact same command (without modifying any of the SILVA files) and it imported in about 1 second. The only thing that comes to mind besides that is I ran that import command in a 2018.2 environment (you appear to be running 2017.12), but I can’t recall any changes to these formats that would account for that.

Looking forward to your response - we will get to the bottom of this! Thanks! :t_rex:

Hi @thermokarst

I re-downloaded the file & was able to convert it successfully. The first time I tired to upload this file however, I (when running the same command) got an error saying that the file was not in TaxonomyTSVFormat. I opened up the file to look closer, and found that one of the lines did not have a tab between the accession number and the taxonomy, so I added one. The file could then be recognized as a TaxonomyTSV file but generated the TypeError. So, in short, I modified the file, but I’m not really certain what happened beyond that or why it worked the second time.
Thanks for your patience

1 Like

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