GAMBIT Database Creation¶
GAMBIT (Genomic Approximation Method for Bacterial Identification and Tracking) incorporates k-mer based strategy for the identification of taxonomic information with a highly curated searchable database.
A GAMBIT databases consist of two files:
- A signatures file containing the GAMBIT signatures (compressed representations) of all genomes represented in the database;
- A metadata file relating the represented genomes to their genome accessions, taxonomic identifications, and species thresholds.
The goal in creating a database for GAMBIT is two-fold:
- Genomes representing each species in the database must contain enough distinction from other species so that similarity thresholds can be extracted;
- The highest level of confidence is obtained that a genome in the database is actually from the species that matched its labelled identification.
-
GAMBIT allows for rapid taxonomic identification of microbial pathogens.
The GAMBIT database is designed to facilitate the exploration and analysis of genomic data from a wide variety of prokaryotic or fungal isolates. It integrates and annotates genomic information based on information from curated sources. Several sources of complete and draft genomic sequences exist, with the most common being RefSeq, GenBank and GTDB. Alternative sources, such as BakRep, can also be used as long as taxonomic information is available.
-
Several pre-computed GAMBIT databases are available for prokaryotic and fungal genomes.
The full list of databases available can be consulted here, with information on what curation steps were followed and what genomes are included.
Database Creation Process¶
Creating a GAMBIT database from a pre-curated list of genomes - GTDB and GAMBITdb¶
The creation and curation of a GAMBIT database is a laborious process which involves sourcing genomic information, setting minimum quality thresholds, and finally building a signature and a database file.
Identifying Data Source¶
As of v2.0.0 of the GAMBIT Prokaryotic database, GTDB is the selected source of taxonomic information for genomes sourced from RefSeq and GenBank. Automation is available through the GAMBITdb which takes as input a GTDB release metadata spreadsheet including information on taxonomy and assembly quality metrics. GTDB’s release spreadsheets are available at https://data.gtdb.ecogenomic.org/releases.
Curation of Genomic Data¶
By default, genomes with less than 0.1 diameter between them are not included if compression is enabled, allowing the database to remain at a fairly low size (less than 3GB), instead being represented by a single centroid genome. This is because many genomes are identical or nearly identical to others in the public archives and there is no benefit to having multiple examples, for example, in an outbreak dozens of identical genomes could be sequenced and after the first, there is no new information for classification.
The inclusion criteria for genome assemblies for addition to the GAMBIT database are as follows:
- Completeness computed by CheckM being equal or over 97%;
- Contamination computed by CheckM being less than 3%;
- Having less than 300 contigs.
Species missing from previous iterations of the database were attempted to be added with looser quality criteria:
- Completeness computed by CheckM being equal or over 90%;
- Contamination computed by CheckM being less than 5%;
- Having less than 600 contigs.
Curation is included in the post-processing steps of GAMBITdb. This is primarily because taxonomy has evolved over more than a century in a pre-genomics world and has many edge cases. Examples include:
- The GTDB candidates for an existing genus were collapsed (e.g. genus_A, genus_B becomes genus). GTDB proposes new genus/species based on ANI however, these are not currently formally accepted by the community.
- The following species were updated:
- Shigella sp.
- This genus is not present in GTDB as it is collapsed under Escherichia coli; This is a controversial decision within the community, particularly as Shigella has specific clinical presentations.
- All Shigella genomes in RefSeq were added to the database with no clustering using default quality criteria.
- Mycolicibacterium/Mycolicibacter/Mycolicibacillus/Mycobacteroides/Mycobacterium sp.
- All genomes available were used.
- Tropheryma whipplei
- This species has a low completeness score of 75%;
- The CheckM completeness score was lowered to 70% for genomes belonging to this species. CheckM was subsequently updated to a new version (not used in this instance) and completeness for this species is rectified, so this fix will be deprecated in the next release.
- Shigella sp.
Using GAMBITdb¶
The GAMBIT-suite organization provides multiple repositories for tools for GAMBIT. It includes the GAMBITdb repository which features several tools to generate a GAMBIT database from a GTDB’s release spreadsheet.
To run GAMBITdb, the following dependencies are required:
A Bash wrapper is available for creating a database from a GTDB spreadsheet (one for bacteria, one for archaea). This script will download the data, create a GAMBIT database and signatures files, and then check the recall against the downloaded files for QC purposes. It is the easiest way to create a database.
run_gambitdb_bacteria.sh </path/to/working_directory> </path/to/gtdb_metadata_spreadsheet.tsv> <num_cores>
A collection of scripts is called by the Bash wrapper to:
- Parse a GTDB spreadsheet and output a list of accessions to download, a species taxon file and a genome metadata file;
- Download the genomes from NCBI (GenBank and RefSeq)
- Generate a GAMBIT database from a directory containing assemblies in FASTA format and a CSV file containing the assembly file and path, and the species taxon ID;
Automatic Database Curation
These steps allow you to obtain a working GAMBIT database without much manual intervention, given that all dependencies are installed correctly in your system. As of v2.0.0, the curation steps have been automated but require functionality deep access within the GAMBITdb software and are mostly for advanced usage. More detailed information is available within the GAMBITdb repository.
Sometimes repairs are required as even with curation of the GTDB spreadsheet errors can make their way to the final database. A utility is available to perform maintenance and repair operations on a GAMBIT database:
Manual curation efforts have been automated and are also available:
Manually creating and curating a GAMBIT database¶
The manual creation and curation of a GAMBIT database is a complex and sometimes difficult process and is not advised without guidance. Please feel free to reach out to support@theiagen.com with any questions you might have.
Sourcing Genomic Information¶
A GAMBIT database can be created from genomes retrieved from a wide variety of sources, not just GTDB. To do so, all the automated steps in the GAMBITdb need to be followed individually. Some officially supported databases, such as the GAMBIT Fungal Database v0.2.0, were created following these steps.
Step 1: Download genomes to be included in the database¶
Genomes may be downloaded from public repositories like NCBI and GTDB. Genomes must be in FASTA file format. It is also necessary to create a file listing each genome with its species identity. The RefSeq FTP site is a useful resource for both tasks.
Example: https://ftp.ncbi.nlm.nih.gov/genomes/refseq/fungi/assembly_summary.txt
Step 2: Perform quality control on the sourced genomes (optional)¶
It is advised to perform some quality assessment and control on the downloaded genomes to reduce the possibility of including low-quality and/or erroneous sequences in the database. QUAST is a popular software for obtaining useful reference-free metrics such as the number of contigs, number of basepairs, length of largest contig and N50. Tools like BUSCO and CheckM provide valuable information regarding the completeness and contamination of a genome
Step 3: Compress genomes into the GAMBIT signatures file and calculate pairwise distances between all genomes¶
Compressing genomes into a GAMBIT signatures file can be accomplished using GAMBIT’s gambit signatures
command:
K-mer Length
The length of the k-mer, controlled by the -k
parameter, and the k-mer prefix, controlled by the -p
parameter, need to match between the GAMBIT database and the way GAMBIT query is run. We strongly advise that these parameters not to be changed!
After the GAMBIT signatures file is created, a pairwise distance matrix for every genome in the signatures file can be created using the gambit dist
command:
Step 4: Calculate diameters for taxa and resolve overlaps¶
The defining feature of GAMBIT is the ability to determine if a query genome is genetically similar enough to the closest genome in the GAMBIT database to assign it to that species. For GAMBIT to work as intended, the database must be curated to ensure that no genomes are mislabeled and that species classifications are well-defined.
Most GAMBIT databases are curated by examining the pairwise GAMBIT distance matrix generated in step 3 and resolving any of the following issues:
- Distantly related subspecies
- Manifestation: In the pairwise-distance matrix, there are two or more groups of genomes within the species that are closely related, but are highly distant from each other.
- Solution: Create a subspecies taxon.
- Outlier genomes that may be labelled with the incorrect species
- Manifestation: The genome will be distant from other genomes within its species, but highly similar to genomes of another species.
- Solution: Remove this genome. Assigning a new taxa is also possible.
- Outlier genomes that are the result of poor assemblies
- Manifestation: The genome will be distant from all other genomes in the distance matrix.
- Solution: Remove this genome.
Any remaining species overlaps following removal of outlier genomes and separation of subspecies is likely the result of species groupings reflecting historical practices that do not align well with genetic distinctions between species (i.e. E. coli and Shigella).
Step 5: Download taxa¶
Entrez, available through Biopython, is a useful resource for downloading data directly from NCBI including Taxonomy, a database of organism names and classifications.
For each entry in the database, the most up-to-date taxonomy needs to be retrieved. In the GAMBIT database, the taxon IDs of the genomes need to be mapped to their species-level ancestors.
We provide a Python script to accomplish this. Please add the missing information marked with <>
to make the utility function and make sure you have all the required dependencies installed in your system, including Pandas and Biopython.
Step 6: Create the database¶
The next step is to create the SQLite database file for the GAMBIT database. Figure 1 depicts the database structure expected by GAMBIT.
We provide a Python script to accomplish this. Please add the missing information marked with <>
to make the utility function and make sure you have all the required dependencies installed in your system, including GAMBIT and SQLalchemy.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
|
Step 7: Finalise the signatures file¶
The Last step is to finalise the signatures file. This last Python utility adds metadata to the database signatures file. Please add the missing information marked with <>
to make the utility function and make sure you have all the required dependencies installed in your system, including GAMBIT and SQLalchemy.
Help Available¶
Please feel free to reach out to support@theiagen.com with any questions you might have.