.. Kleborate documentation master file, created by
   sphinx-quickstart on Thu Apr 25 06:02:56 2024.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

.. toctree::
   :maxdepth: 1
   :hidden:

   Installation
   Usage
   modules
   Creating-New-Modules


########################
Introducing Kleborate v3
########################

Kleborate was initially developed to type genome assemblies of *Klebsiella pneumoniae* and the *Klebsiella pneumoniae* species complex (KpSC), see `Lam et al, 2021 <https://doi.org/10.1038/s41467-021-24448-3>`_. 

`Kleborate v3 <https://github.com/klebgenomics/Kleborate>`_ introduces enhanced and expanded functionality for KpSC, plus new modules for typing the *Klebsiella oxytoca* species complex (KoSC) and *Escherichia coli/Shigella*.

**Typing modules for the** *Klebsiella pneumoniae* **species complex cover:**


* Species calling (e.g. *K. pneumoniae*\ , *K. quasipneumoniae*\ , *K. variicola*\ , etc.)
* MLST, cgMLST, and LIN codes
* *ICEKp1* and virulence plasmid-associated hypervirulence loci
* Antimicrobial resistance determinants
* K (capsule) and O antigen (LPS) serotype prediction

For *K. pneumoniae* species complex, Kleborate v3 can reproduce the outputs of Kleborate v2 by running the preset modules for KpSC via:
 

.. code-block:: Python

   kleborate -a *.fasta -o kleborate_results -p kpsc --trim_headers

(Note the command changed from Kleborate v2, the above is equivalent to running ``kleborate --all -o results.txt -a *.fasta``  with Kleborate v2 and includes all resistance and Kaptive-based typing)


**Typing modules for the** *Klebsiella oxytoca* **species complex cover:**


* Species calling (e.g. *K. oxytoca*\ , *K. michiganensis*\ , *K. grimontii*\ , etc.)
* MLST
* K (capsule) and O antigen (LPS) serotype prediction


**Typing modules for** *E. coli/Shigella* **cover:**


* Pathotyping, Shigella speciation, and phylogroup assignment
* MLST (Achtman and Pasteur schemes), cgMLST, and LIN codes
* K (capsule) and O:H serotype prediction
* LEE and stx typing
* AMR profiling (via AMRFinderPlus)


Tutorial
--------

A step-by-step tutorial for Kleborate v3.0 is available `here <https://docs.google.com/document/d/1R61bQbBngpiDB2Gl_eXigePBVakYZEjy/edit>`_, covering:

* Kleborate's features and their scientific rationale
* How to run Kleborate 
* Examples, illustrating how to run and interpret results

Note this was developed for v3.0 and will be updated soon to cover v3.3.


License
-------

`GNU General Public License, version 3 <https://www.gnu.org/licenses/gpl-3.0.html>`_


Citing Kleborate
----------

**The primary citation for Kleborate is**: Lam, MMC. et al. A genomic surveillance framework and genotyping tool for *Klebsiella pneumoniae* and its related species complex, *Nature Communications* (2021). `<https://doi.org/10.1038/s41467-021-24448-3>`_


Acknowledgments
----------

If you use data generated by 3rd party tools/databases using Kleborate, please cite both Kleborate and the paper describing the specific resource, as listed below.

**For KpSC typing**:

* **K or O serotypes:** Stanton, TD. et al. Fast and accurate in silico antigen typing with Kaptive 3, *Microbial Genomics* (2025). `<https://doi.org/10.1099/mgen.0.001428>`_

* **MLST (7-locus) scheme:** Diancourt, L. et al. Multilocus sequence typing of *Klebsiella pneumoniae* nosocomial isolates, *Journal of Clinical Microbiology* (2005). `<https://doi.org/10.1128/JCM.43.8.4178-4182.2005>`_

* **cgMLST scheme:** Brisse, S. et al. Virulent clones of *Klebsiella pneumoniae*: Identification and evolutionary scenario based on genomic and phenotypic characterization, *PLoS ONE* (2009). `<https://doi.org/10.1371/journal.pone.0004982>`_

* **LIN code scheme:** Hennart, M. et al. A Dual Barcoding Approach to Bacterial Strain Nomenclature: Genomic Taxonomy of *Klebsiella pneumoniae* Strains, *Molecular Biology and Evolution* (2022). `<https://doi.org/10.1093/molbev/msac135>`_

* **cgMLST or LIN codes (software)**: Bogaerts, B. et al. MiST: rapid, accurate and flexible (core-genome) multi-locus sequence typing (MLST) allele calling from draft genomes, *BMC Genomics* (2025). `<https://doi.org/10.1186/s12864-025-12324-z>`_

* **Yersiniabactin or colibactin (ICEKp):** Lam, MMC. et al. Genetic diversity, mobilisation and spread of the yersiniabactin-encoding mobile element *ICEKp* in *Klebsiella pneumoniae* populations. *Microbial Genomics* (2018). `<http://mgen.microbiologyresearch.org/content/journal/mgen/10.1099/mgen.0.000196>`_

* **Aerobactin or salmochelin (virulence plasmid):** Lam, MMC. et al. Tracking key virulence loci encoding aerobactin and salmochelin siderophore synthesis in *Klebsiella pneumoniae*. *Genome Medicine* (2018). `<https://genomemedicine.biomedcentral.com/articles/10.1186/s13073-018-0587-5>`_

* **rmp types (lineages):** Lam, MMC. et al. Genomic and functional analysis of rmp locus variants in *Klebsiella pneumoniae*. *Genome Medicine* (2018). `<https://doi.org/10.1186/s13073-025-01461-5>`_

* **rmp status (phase variation):** Stawarska, O. et al. Simple Sequence Repeats Mediate Phase Variation of the Mucoid Phenotype in Hypervirulent *Klebsiella pneumoniae*, *BioRxiv* (2025). `<https://doi.org/10.1101/2025.09.12.675794>`_

* **rmp status (promoter phase variation):** Stawarska, O. et al. Simple Sequence Repeats Mediate Phase Variation of the Mucoid Phenotype in Hypervirulent *Klebsiella pneumoniae*, *BioRxiv* (2025). `<https://doi.org/10.1101/2025.09.12.675794>`_

* **rmp status (promoter ARG box):** Ryan, B. E., et al. Arginine regulates the mucoid phenotype of hypervirulent *Klebsiella pneumoniae*. *Nature Communications* (2025). `<https://doi.org/10.1038/s41467-025-61047-y>`_

* **SHV beta-lactamase activity:** Tsang, KK. et al. Diversity, functional classification and genotyping of SHV β-lactamases in Klebsiella pneumoniae *Microbial Genomics* (2024). `<https://doi.org/10.1099/mgen.0.001294>`_

* **Ciprofloxacin resistance prediction:** Tsang, KK. et al. Ciprofloxacin resistance in *Klebsiella pneumoniae*: phenotype prediction from genotype and global distribution of resistance determinants *BioRxiv* (2025). `<https://doi.org/10.1101/2025.09.24.678318>`_

**For KoSC typing**:

* **K or O serotyping (software):** Stanton, TD. et al. Fast and accurate in silico antigen typing with Kaptive 3, *Microbial Genomics* (2025). `<https://doi.org/10.1099/mgen.0.001428>`_

* **K serotype database:** Ashcroft, MM. et al. A capsule polysaccharide synthesis locus database for the *Klebsiella oxytoca* Species Complex, *bioRxiv* (2026). `<https://doi.org/10.64898/2026.07.16.739023>`_

* **MLST scheme:** Jolley et al. Open-access bacterial population genomics: BIGSdb software, the PubMLST.org website and their applications *Wellcome Open Res* (2018). `<https://doi.org/10.12688/wellcomeopenres.14826.1>`_

**For Escherichia typing**:

* **MLST (Acthman 7-locus scheme):** Wirth, T. et al. Sex and virulence in *Escherichia coli*: an evolutionary perspective, *Molecular Microbiology* (2006). `<https://doi.org/10.1111/j.1365-2958.2006.05172.x>`_

* **MLST (Pasteur 7-locus scheme):** Jaureguy, F. et al. Phylogenetic and genomic diversity of human bacteremic *Escherichia coli* strains. *BMC Genomics* (2008) `<https://doi.org/10.1186/1471-2164-9-560>`_

* **cgMLST scheme:** Zhou, Z. et al. The EnteroBase user’s guide, with case studies on *Salmonella* transmissions, *Yersinia pestis* phylogeny and *Escherichia* core genomic diversity”, *Genome Research* (2020). `<https://doi.org/10.1101/gr.251678.119>`_

* **AMR:** Feldgarden, M. et al. AMRFinderPlus and the Reference Gene Catalog facilitate examination of the genomic links among antimicrobial resistance, stress response, and virulence, *Scientific Reports* (2021). `<https://doi.org/10.1038/s41598-021-91456-0>`_

* **Shigella serotypes:**  Yassine, I. et al. ShigaPass: an in silico tool predicting *Shigella* serotypes from whole-genome sequencing assemblies, *Microbial Genomics* (2023). `<https://doi.org/10.1099/mgen.0.000961>`_

* **O:H serotypes:**  Bessonov, K. et al. ECTyper: in silico *Escherichia coli* serotype and species prediction from raw and assembled whole-genome sequence data, *Microbial Genomics* (2021). `<https://doi.org/10.1099/mgen.0.000728>`_

* **K serotype database:**  Gladstone, RA. et al. Identification of transporter-dependent capsular loci associated with the invasive potential of *Escherichia coli*, *Nature Microbiology* (2026). `<https://doi.org/10.1038/s41564-026-02283-w>`_

* **K serotyping (software):** Stanton, TD. et al. Fast and accurate in silico antigen typing with Kaptive 3, *Microbial Genomics* (2025). `<https://doi.org/10.1099/mgen.0.001428>`_

* **LEE typing scheme:** Ingle, D. et al. Evolution of atypical enteropathogenic *E. coli* by repeated acquisition of LEE pathogenicity island variants, *Nature Microbiology* (2016). `<https://doi.org/10.1038/nmicrobiol.2015.10>`_

* **stx typing:** Prasad, AB. et al. Algorithm and Software to Type Stx Operons Accurately from Assembled Genomic Sequence, *Microorganisms* (2026). `<https://doi.org/10.3390/microorganisms14081607>`_

* **Phylogroups:** Waters, NR. et al. Easy phylotyping of *Escherichia coli* via the EzClermont web app and command-line tool, *Access Microbiology* (2020). `<https://doi.org/10.1099/acmi.0.000143>`_


Changes from v2
----------------

When Kleborate v3 is run using the ``-p kpsc`` option to run preset modules for *K. pneumoniae* the same logic is implemented as Kleborate v2, plus the following changes/updates:

* Updated MLST & virulence databases 
* Column ``Chr_ST``  has been removed in v3, as it is redundant with ``ST`` 
* Updated AMR database to Kleborate_AMRdb_v3.3
* Mutations are reported using  `HGVS nomenclature <https://hgvs-nomenclature.org/stable/recommendations/protein/substitution/>`_
* Added ``p.(Met1?)`` to indicate when pmrB or mgrB have a mutation in the start codon that may disrupt translation (in ``Col_mutations`` column)
* Added check for synonymous mutation in ompK36 (25 C > T) associated with increased resistance to carbapenems (in ``Omp_mutations`` column)
* Added checks for ``D`` ompK36 loop 3 (L3) insertions
* Added new AMR genotyping report compatible with the `hAMRonization <https://github.com/pha4ge/hAMRonization/>`_ standard developed by the Public Health Alliance for Genomic Epidemiology (PHA4GE).
* Added a module for Ciprofloxacin resistance prediction
* Updated *rmp* typing to infer expression status of the *rmp* locus
* Added new module for cgMLST and LIN codes
* Added new module for detecting the *peg-344* gene
* Added new module for typing *mrk* operon
* Updated to use Kaptive v3, which has some changes to the names of output variables:
   ``K_locus_missing_genes``  has been renamed ``K_Missing_expected_genes`` 
   ``O_locus_missing_genes``  has been renamed ``O_Missing_expected_genes`` 
* Updated assembly statistics module to use qualibact-v1.0 curated thresholds
* Added new genome specification report compatible with the `PHA4GE Microbial Genotyping Data Specification <https://github.com/pha4ge/genotyping-specification>`_

Kleborate v3 can also be run using ``-p kosc`` (to run preset modules for *K. oxytoca* complex) or ``-p escherichia`` (to run preset modules for *E. coli/Shigella*).


Kleborate results for public data
----------------

The `Kleborate paper <https://www.nature.com/articles/s41467-021-24448-3>`_ reports results of genotyping ~10,000 public genomes that have been filtered to remove redundant sequences (e.g. outbreak clusters, identified as small genome-wide mash distance with same year, location and genotypes), with Kleborate v2. The results can be explored in `Microreact <https://bit.ly/klebMR>`_ (which shows the mash tree, Kleborate output & curated metadata) or `Kleborate-Viz <https://kleborate.erc.monash.edu/>`_ (R shiny app). Kleborate-Viz also has the EuSCAPE dataset preloaded, or you can view your own Kleborate results.

Kleborate is included in `Klebsiella Pathogenwatch <https://pathogen.watch/>`_ which shows interactive trees, maps and line lists for publicly available *Klebsiella pneumoniae* genomes. It also allows you to analyse your own data in context of the public collections. See `this paper <https://doi.org/10.1093/cid/ciab784>`_ for an example of how to use it. You can also use the `Pathogenwatch API <https://pathogen.watch/docs/api>`_ to download bulk data.

Kleborate is included in the `BIGSdb-Pasteur Klebsiella database <https://bigsdb.pasteur.fr/klebsiella/>`_ where you can query Kleborate results for public genomes, or upload your own genomes for analysis.

`KlebRef <https://github.com/klebgenomics/KlebRef>`_ has Kleborate results for isolates available in culture collections, including the UK's National Collection of Type Cultures (NCTC), The American Type Culture Collection (ATCC), the Biological and Emerging Infections (BEI) Resources MRSN Diversity Panel, and KlebPhaCol.

Contact us
----------

Kleborate is under active development with other *Klebsiella* & *E. coli* genomic analysis tools and projects in progress (see `github.com/klebgenomics <https://github.com/klebgenomics>`_ and `klebnet.org <https://klebnet.org>`_). 

Please get in touch via the GitHub `issues tracker <https://github.com/klebgenomics/Kleborate/issues>`_ if you have any issues, questions or ideas.

For more on our lab, including other software, see `http://holtlab.net <http://holtlab.net>`_
