Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom DB and custom taxonomy (GTDB or similar) #884

Open
osvatic opened this issue Oct 18, 2024 · 5 comments
Open

Custom DB and custom taxonomy (GTDB or similar) #884

osvatic opened this issue Oct 18, 2024 · 5 comments

Comments

@osvatic
Copy link

osvatic commented Oct 18, 2024

Is there a way to create a completely new database and non-NCBI taxonomy for that database? I am primarily interested in using something like GTDB, which has a genome download and taxonomy tsv file available.

I understand that I can add the contigs/genomes to a custom database using "kraken2-build --add-to-library" but the creation of a new taxonomy doesn't seem straight forward.

@ch4rr0
Copy link
Collaborator

ch4rr0 commented Oct 31, 2024

Hello,

We are in the process of adding GTDB support to the k2 wrapper (python rewrite of the kraken2 scripts), stay tuned.

@lingrongjin
Copy link

I'm also interested in building a custom database with GTDB taxonomy! When can we expect to have this function available?

@ch4rr0
Copy link
Collaborator

ch4rr0 commented Nov 5, 2024

I pushed a change to the k2 wrapper today.

Here's how you can build a GTDB database with the changes:

k2 build --special gtdb --gtdb-files gtdb_genomes_reps.tar.gz --threads 6 --db gtdb_reps

The --gtdb-files parameter takes a list of filenames or a pattern that matches the files needed
to build the GTDB database.

You can find the list of file names here https://data.gtdb.ecogenomic.org/releases/latest/genomic_files_reps/
or https://data.gtdb.ecogenomic.org/releases/latest/genomic_files_all/

The command line will also offer a list of files if you specify the wrong file name:

k2 build --special --gtdb-files foo.tar.gz --db gtdb_reps
[ERROR - 2024-11-05 17:57:48,567]: Could not find any files matching foo.tar.gz
[ERROR - 2024-11-05 17:57:48,567]: Here are a list of candidates:
bac120_msa_marker_genes_all.tar.gz
ar53_msa_marker_genes_all.tar.gz
ssu_all.fna.gz
bac120_marker_genes_all.tar.gz
ar53_marker_genes_all.tar.gz
bac120_ssu_reps.fna.gz
ar53_msa_marker_genes_reps.tar.gz
gtdb_proteins_aa_reps.tar.gz
bac120_msa_marker_genes_reps.tar.gz
bac120_msa_reps.faa.gz
bac120_marker_genes_reps.tar.gz
ar53_msa_reps.faa.gz
ar53_marker_genes_reps.tar.gz
gtdb_proteins_nt_reps.tar.gz
gtdb_genomes_reps.tar.gz
ar53_ssu_reps.fna.gz

We welcome your testing in making sure that this feature works as expected.

@YiAngBeao
Copy link

YiAngBeao commented Nov 13, 2024

Traceback (most recent call last):
File "10software/mambaforge/envs/kraken2/bin/k2.py", line 3582, in
k2_main()
~~~~~~~^^
File "10software/mambaforge/envs/kraken2/bin/k2.py", line 3562, in k2_main
build_gtdb_database(args)
~~~~~~~~~~~~~~~~~~~^^^^^^
File "/10software/mambaforge/envs/kraken2/bin/k2.py", line 1768, in build_gtdb_database
for accession, filepath in result[0]:
^^^^^^^^^^^^^^^^^^^
ValueError: too many values to unpack (expected 2)

I pushed a change to the k2 wrapper today.

Here's how you can build a GTDB database with the changes:

k2 build --special gtdb --gtdb-files gtdb_genomes_reps.tar.gz --threads 6 --db gtdb_reps

The parameter takes a list of filenames or a pattern that matches the files needed to build the GTDB database.--gtdb-files

You can find the list of file names here https://data.gtdb.ecogenomic.org/releases/latest/genomic_files_reps/ or https://data.gtdb.ecogenomic.org/releases/latest/genomic_files_all/

The command line will also offer a list of files if you specify the wrong file name:

k2 build --special --gtdb-files foo.tar.gz --db gtdb_reps
[ERROR - 2024-11-05 17:57:48,567]: Could not find any files matching foo.tar.gz
[ERROR - 2024-11-05 17:57:48,567]: Here are a list of candidates:
bac120_msa_marker_genes_all.tar.gz
ar53_msa_marker_genes_all.tar.gz
ssu_all.fna.gz
bac120_marker_genes_all.tar.gz
ar53_marker_genes_all.tar.gz
bac120_ssu_reps.fna.gz
ar53_msa_marker_genes_reps.tar.gz
gtdb_proteins_aa_reps.tar.gz
bac120_msa_marker_genes_reps.tar.gz
bac120_msa_reps.faa.gz
bac120_marker_genes_reps.tar.gz
ar53_msa_reps.faa.gz
ar53_marker_genes_reps.tar.gz
gtdb_proteins_nt_reps.tar.gz
gtdb_genomes_reps.tar.gz
ar53_ssu_reps.fna.gz

We welcome your testing in making sure that this feature works as expected.

Hello, I tried to build a GTDB database with the k2 you provided, but it resulted in this error.

@ch4rr0
Copy link
Collaborator

ch4rr0 commented Nov 15, 2024

I pushed a fix for this issue a few days ago and have also pushed a fix for potential crashes while masking the genomes. Can you try pulling these changes and trying again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants