Kraken2 error: AttributeError: dict object has no attribute 'type'

Hello Qiime2 community

I am working on a virtual machine with Rocky Linux. I have downloaded and uploaded the kraken2 pfp database successfully to Qiime, however when i tried to classify my sequences an AttributeError: 'dict' object has no attribute 'type' appeared.
Here is an outlook of the code that showed the aforementioned error

qiime moshpit classify-kraken2 --i-seqs /root/qiime2/SUELO_HOUSE/reads --i-kraken2-db /root/qiime2/moshpit_tutorial/cache/kraken2 --p-threads 100 --p-confidence 0.6 --p-minimum-base-quality 20 --o-hits /root/qiime2/moshpit_tutorial/cache/kraken_db_hits --o-reports /root/qiime2/moshpit_tutorial/cache/kraken_db_hits/kraken_db_reports --p-report-minimizer-data --use-cache /root/qiime2/moshpit_tutorial/cache --verbose --p-memory-mapping False

It took some 30 min or so, for the following message (screenshot enclosed) and the AttributeError: 'dict' object has no attribute 'type' to appear; after executing the above mentioned code.

Can you shed some light on this? How can we solve the error?

Best

Joel T

Hello @Joel_Daniel_Tigrero apologies for the delayed response, it isn't entirely clear what the issue is, but I have a hunch. You have set --use-cache /root/qiime2/moshpit_tutorial/cache but when you attempt to access your inputs from the cache and store your outputs to the cache, you are not using the correct syntax.

Did you create a cache at /root/qiime2/moshpit_tutorial/cache using the command qiime tools cache-create?

1 Like

Thank you Oddant1. Could you please indicate where do I have to check for a syntax error? I checked the structure of my cache folder and I have all the necessary files for the Kraken2 analysis. I also tried to create the cache folder with the qiime tools cache-create command you mentioned and also resulted in the Attribute error: dict object has no attribute ´type´.

Do you have any further thoughts about this issue?

Best

Joel T

I'm not sure how or why qiime tools cache-create would produce that error. That is pretty strange.

Can you try removing the --use-cache argument entirely and rerunning your command? If the command still fails please post the output here. Additionally, if the command fails can you run ls -al /root/qiime2/moshpit_tutorial/cache and post the result of that here?

Thanks for the advice Oddant1

I removed the use cache argument entirely and reran the command however the Attribute error still appeared.

I also ran ls -al /root/qiime2/moshpit_tutorial/cache and it produced the following output

Best

Joel T.

Very strange. I will look into how this error is coming about, but there are a few things wrong here.

  1. You appear to be passing directories into --i-seqs and --i-kraken2-db when these should be receiving individual artifacts. I BELIEVE this is the root source of this error, but I'm not sure how this specific error came from you doing this. We definitely need to make a more useful error message for this if I am correct.
  2. Your /root/qiime2/moshpit_tutorial/cache directory appears to contain the necessary pieces to be a cache, but it also contains bracken, kraken2, kraken_db_hits, and kraken_db_reports which shouldn't be there. They look like they're meant to be cache entries, but cache entries should be in the form of data referenced by keys not additional folders in the cache. Did you intend to make this directory a QIIME 2 cache?
1 Like

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