qiime taxa-collapse problem - sequence item 0: expected str instance, float found

Hi everyone, happy new year! :grinning: :champagne:

I had some problems when I've running qiime taxa collapse to obtain an ANCOM .qzv file, to visualize differential abundance taxa in mosquitoes microbiome composition.

It was sent to me a FeatureTable[Frequency], containing taxonomic information, that I've converted to a .qza file. Also, to run qiime taxa collapse, I built a taxonomy.qza file, converting an .txt file to .qza containing "Feature ID" and "Taxon" headers.

Here is my code:

qiime tools import \
  --input-path Bacteria_Taxonomy.txt\
  --output-path Bacteria_taxonomy.qza \
  --type FeatureData[Taxonomy]
  
  qiime taxa collapse \
   --i-table ANCOM/filtered-bacteria-table-min10.qza \
   --i-taxonomy Bacteria_taxonomy.qza \
   --p-level 5 \
   --o-collapsed-table ANCOM/filtered_table_bacteria_level-5.qza

And here is the error after runned qiime taxa collapse:

sequence item 0: expected str instance, float found

Here are my files:
Bacteria_taxonomy.qza (7.2 KB)
Bacteria_Taxonomy.txt (30.3 KB)
Metadata.txt (865 Bytes)
filtered-bacteria-table-min10.qza (20.1 KB)

How can I solve this error? It's something wrong with my taxonomy file?
Thanks in advance!

Hello,

as in error, probably QIIME2 infers the datatype wrong, please replace numbers in Feature_ID for some string (like ID1, ID2, etc.) and rerun the command.
You will need to correct entries in your FeatureTable as well.

Cheers
V

1 Like

Hello!
In addition to @crusher083 excellent reply, I noticed that you attempted to collapse your table to the level 5, meanwhile in your taxonomy file you do not have different taxonomy levels. I am not sure if it will work, but if you want to collapse sequences with the same annotations as it is now in your taxonomy file, you can try to collapse it to level 0. Another option is to add full taxonomy information, including all available taxonomy ranks (domain, phylum, etc) and then collapse to desired level (5 or another).

Best,

2 Likes

Hi @crusher083 @timanix , thank you for the support!

Firstly, I followed @crusher083 recommendations and altered the Feature ID in my Taxonomy file and FeatureTable to strings (ID1,ID2,ID3...ID214). Secondly, I converted these files to .qza.

Thus, I runned qiime taxa collapse with --p-level 0, again the same error appeared:

 sequence item 0: expected str instance, float found

I tried to replace the taxonomy information for taxonomy ranks, until family, editing my taxonomy and feature table files.

I runned again qiime taxa collapse, now with --p-level 5. And the same error repeated.

Bacteria_taxonomy.txt (44.9 KB)
Bacteria-family.txt (51.0 KB)

Hi again, could you please replace "|" symbols with ";" in taxonomy file.
Also, make sure that you do not have any "nan" values, or empty cells (in Taxon column) in the taxa file.
BTW, in the feature table, feature ids (not taxonomies) should be provided (as in "Feature ID" column in the taxonomy file).

1 Like

Hi @timanix, I've replaced "|" symbols with ";" in my taxonomy file. I've checked for empty cells in these file, and it returns to me as a table with filled cells, so it's okay to me.
Bacteria_taxonomy.txt (45.3 KB)

My feature table contains feature ids, also there is a "Taxon" collum but it works to use te FeatureTable with a taxonomy collum for other analysis in qiime2, so I think the point is specific with the taxonomy table.
Bacteria-family.txt (51.4 KB)

imagem que vou usar

I've runned the code again, and got the same error :pensive:

I've checked these discussions here and here. And it seems that maybe it's a formatting error in my taxonomy table.

I've runned qiime metada tabulate to obtain a .qzv file for my taxonomy table, and here is the result:

qiime metadata tabulate \
  --m-input-file Bacteria_taxonomy.qza \
  --o-visualization Bacteria_taxonomy.qzv

There was an issue with viewing the artifact Bacteria_taxonomy.qza as QIIME 2 Metadata:

  sequence item 0: expected str instance, float found

I don't know, but it looks like something is missing from the rows of my taxonomy table.

Looks like you have a lot of nans in your taxonomy file (I guess that reason is numerous tabs everywhere)

So I fixed it for you (if the file is not complete, just remove all extra "tab" signs from your complete file.

Bacteria_taxonomy_nonans.txt (18.9 KB)

Hope that now it will work as supposed to.

3 Likes

It works!

Thank you so much, the issue it was the "nans" as you mentioned.

1 Like

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