error importing Bracken database

Has anyone had any luck importing a braken database?

Managed to get kraken2 to work by downloading a one of the tar.gz files, extracting and only keeping the 'k2d' files and running:

qiime tools import \
    --type 'Kraken2DB' \
    --input-path k2_pluspfp_16gb_20231009_q2 \
    --output-path k2_pluspf.qza

But trying something similar with --type 'Braken2DB' doesn't give any helpful errors

Traceback (most recent call last):
  File "/home/jono/miniconda3/envs/qiime2-shotgun-2023.9/lib/python3.8/site-packages/q2cli/builtin/tools.py", line 267, in import_data
    artifact = qiime2.sdk.Artifact.import_data(type, input_path,
  File "/home/jono/miniconda3/envs/qiime2-shotgun-2023.9/lib/python3.8/site-packages/qiime2/sdk/result.py", line 302, in import_data
    output_dir_fmt = pm.get_directory_format(type_)
  File "/home/jono/miniconda3/envs/qiime2-shotgun-2023.9/lib/python3.8/site-packages/qiime2/sdk/plugin_manager.py", line 388, in get_directory_format
    raise TypeError(
TypeError: Semantic type Braken2DB is invalid, either because it doesn't have a compatible directory format, or because it's not registered.

An unexpected error has occurred:

  Semantic type Braken2DB is invalid, either because it doesn't have a compatible directory format, or because it's not registered.

See above for debug info.

Hi @Micro_Biologist ,

Thanks for trying out q2-moshpit!

This should be BrackenDB, not Braken2DB. Please give that a try and let us know if you still encounter issues!

4 Likes

Thank you! Bracken also has a c in it which I failed to notice despite reading their documentation yesterday when trying to figure out which files I needed :smiley:

Here is the full code for any future moshers!

#Download DB from:
#https://benlangmead.github.io/aws-indexes/k2
#e.g.
wget -c https://genome-idx.s3.amazonaws.com/kraken/k2_pluspfp_16gb_20231009.tar.gz

tar -xf k2_pluspfp_16gb_20231009.tar.gz
mkdir -p k2_pluspfp_16gb_20231009_q2
cp k2_pluspfp_16gb_20231009/*.k2d k2_pluspfp_16gb_20231009_q2/

conda activate qiime2-shotgun-2023.9

qiime tools import \
    --type 'Kraken2DB' \
    --input-path k2_pluspfp_16gb_20231009_q2 \
    --output-path k2_pluspf.qza
    
cp k2_pluspfp_16gb_20231009/*.kmer_distrib k2_pluspfp_16gb_20231009_q2/
rm k2_pluspfp_16gb_20231009_q2/*.k2d
    
qiime tools import \
    --type 'BrackenDB' \
    --input-path k2_pluspfp_16gb_20231009_q2 \
    --output-path b_pluspf.qza

#tidy up
#rm -R k2_pluspfp_16gb_20231009_q2
4 Likes

Hi @Micro_Biologist would you be interested in writing this up as a mini tutorial? That might make this post more visible to others (I see you just linked it in another topic — thanks!)

Yes no problem! I'm currently assembling about 200 metagenomes so have a bit of free time :rofl:

2 Likes