Skip to content

Overview

What is a locus?

A locus in the Kaptive sense refers to a biosynthetic gene cluster that is responsible for the synthesis of a bacterial surface polysaccharide, e.g. the Klebsiella pneumoniae K locus is responsible for the synthesis of the capsular polysaccharide, also known as the K antigen. Each locus in the Kaptive databases has been defined based on a unique set of genes, with the assumption that this encodes a unique polysaccharide structure. In many cases, these unique structures will result in unique immunological serotypes.

The gene translations (protein sequences) from each locus are compared by pairwise alignment, and must fall under a defined percent identity threshold to be considered 'unique'. Some genes (such as the core assembly machinery) will be highly similar, however the genes responsible for the polysaccharide structural diversity are expected to be more variable. The specific identity thresholds vary across species.

Available Databases

Below is a list of Kaptive databases you can install using their keyword:

Species Locus Keyword
Klebsiella pneumoniae Species Complex K kpsc_k
Klebsiella pneumoniae Species Complex O kpsc_o
Klebsiella oxytoca Species Complex K kosc_k
Klebsiella oxytoca Species Complex O kosc_o
Acinetobacter baumannii K ab_k
Acinetobacter baumannii OC ab_o
Escherichia coli Group 2 + 3 CPS ecoli_kps

Managing Databases via the CLI

Kaptive provides a dedicated command group, kaptive db, for managing your local databases.

Install a Known Database

To install an officially supported database, use its known keyword:

kaptive db install kpsc_k

You can also install all officially supported databases concurrently:

kaptive db install all

Add a Custom Database

To add a new custom database hosted on GitHub, you need the repository owner, repository name, and the base name of the database files.

For example, if your database files are My_Custom_Loci.gbk and My_Custom_Loci.toml in my-org/my-kaptive-db:

kaptive db add My_Custom_Loci my-org my-kaptive-db

Update Databases

To check for and install updates for all installed databases:

kaptive db update kpsc_k
kaptive db update
List Installed Databases

To see which databases are currently installed in your ~/.kaptive cache:

kaptive db ls

Reset Cache

If you want to free up space or start fresh, you can uninstall all local databases and clear the cache:

kaptive db reset


Managing Databases via the Python API

If you are using Kaptive programmatically as a Python library, you can interact with the database system using the Database or DatabaseManager classes from the kaptive.db module.

Installing and Loading
from kaptive.db import Database, DatabaseManager

db = Database.install("kpsc_k")  # (1)!
dbs = Database.install("all")  # (2)!
db = Database.load("kpsc_k")  # (3)!
  1. Install a known database (compiles and caches it)
  2. Install all known databases concurrently
  3. Load an already installed database from the local cache
Adding a Custom Database

You can fetch and compile a custom database directly from a GitHub repository:

db = Database.add(
    owner="klebgenomics",
    repo_name="KpSC_surface_antigen_loci",
    db_name="Klebsiella_pneumoniae_Species_Complex_K",
    branch="main",
)

Updating
updated_dbs = DatabaseManager.update("all")  # (1)!
updated_db = DatabaseManager.update("kpsc_k")  # (2)!
  1. Check and update all installed databases
  2. Update a specific database

Comments