Repository navigation
Build a reference database
Instead of using the preconstructed database, you can construct a fresh database yourself. The download module can be used to download and process raw data, in preparation for building a new CAT pack database.
This will ensure that all input dependencies are met and correctly formatted for CAT_pack prepare.
Currently, two databases are supported, NCBI's nr and the Genome Taxonomy Database (GTDB) proteins.
$ CAT_pack download --db nr --out_dir path/to/nr_data_dir
Will download the fasta file with the protein sequences, their mapping to a taxid, and the taxonomy information from NCBI over HTTPS.
Genome Taxonomy Database (GTDB) proteins
$ CAT_pack download --db gtdb --out_dir path/to/gtdb_data_dir
The files required to build a CAT pack database are provided by the GTDB downloads page.
CAT_pack download fetches the necessary files and does some additional processing to get them ready for CAT_pack prepare:
- The taxonomy information from GTDB is transformed into NCBI style
nodes.dmpandnames.dmpfiles. - Protein sequences are extracted from
gtdb_proteins_aa_reps.tar.gzand are subjected to a round of deduplication. The deduplication reduces the redundancy in the DIAMOND database, thus simplifying the alignment process. Exact duplicate sequences are identified based on a combination of the MD5sum of the protein sequences and their length. Only one representative sequence is kept, with all duplicates encoded in the fasta header. This information is later used byCAT_pack prepareto assign the LCA of the protein sequence appropriately in the.fastaid2LCAtaxidfile. - The mapping of all protein sequences to their respective taxonomy is created.
- In addition, the newick formatted trees of Bacteria and Archaea are downloaded and - artificially - concatenated under a single
rootnode, to produce a<YYYY-MM-DD>.gtdb.treefile. This file is not used by the CAT pack but may come in handy for downstream analyses.
When the download and processing of the files is finished successfully you can build a CAT pack database with CAT_pack prepare.
For all command line options available see
$ CAT_pack download -h
and
$ CAT_pack prepare -h
For a custom CAT pack database, you must have the following input ready before you launch a CAT_pack prepare run.
-
A fasta file containing all protein sequences you want to include in your database.
-
A
names.dmpfile that contains mappings of taxids to their ranks and scientific names. The format must be the same as the NCBI standardnames.dmp(uses\t|\tas field separator).
An example looks like this:
1 | root | scientific name |
2 | Bacteria | scientific name |
562 | Escherichia coli | scientific name |
- A
nodes.dmpfile that describes the child-parent relationship of the nodes in the taxonomy tree and their (official) rank. The format must be the same as the NCBI standardnodes.dmp(uses\t|\tas the field separator).
An example looks like this:
1 | 1 | no rank |
2 | 1 | superkingdom |
1224 | 2 | phylum |
1236 | 1224 | class |
91437 | 1236 | order |
543 | 91347 | family |
561 | 543 | genus |
562 | 561 | species |
For more information on the nodes.dmp and names.dmp files, see the NCBI taxdump_readme.txt.
- A 2-column, tab-separated file containing the mapping of each sequence in the fasta file to a taxid in the taxonomy.
This file must contain the header
accession.version taxid.
An example looks like this
accession.version taxid
protein_1 562
protein_2 123456
Once all of the above requirements are met you can run CAT_pack prepare.
All the input needs to be explicitly specified for CAT_pack prepare to work, for example:
$ CAT_pack prepare \
--db_fasta path/to/fasta \
--names path/to/names.dmp \
--nodes path/to/nodes.dmp \
--acc2tax path/to/acc2taxid.txt.gz \
--db_dir path/to/output_dir
will create an output_dir that will look like this
output_dir
├── 2023-11-05_CAT_pack.log
├── 2023-11-05_CAT_pack.dmnd
├── 2023-11-05_CAT_pack.fastaid2LCAtaxid
├── 2023-11-05_CAT_pack.taxids_with_multiple_offspring
├── names.dmp
└── nodes.dmp
Notes:
- All database and taxonomy files are stored together in
output_dir. Use this directory with-dfor CAT, BAT, RAT. - The
nodes.dmpandnames.dmpfiles in theoutput_dirdirectory are copied from their original location. - The default prefix is
<YYYY-MM-DD>_CAT_pack. You can customize it with the--common_prefixoption.
For all command line options available see
$ CAT_pack prepare -h