Skip to content

Installation

Tom Stanton edited this page Apr 29, 2024 · 12 revisions

Software requirements

Before you install Kleborate, make sure you have these installed:

  • Python v3.6 or later
  • Biopython v1.75 or later
    • If when you run Kleborate you see an error that says ImportError: cannot import name 'substitution_matrices', that means your version of Biopython is too old and needs to be updated.
  • BLAST+ command line tools
    • v2.7.1 or later is needed, as earlier versions have a bug with the culling_limit parameter and/or tblastx results.
    • We test Kleborate on BLAST+ v2.7.1. Later versions will probably also work but stick to v2.7.1 if you want to play it safe.
  • Mash v2.0 or later

There are different ways to install these, but we recommend following the instructions on their websites or using a package manager such as Homebrew or APT.

To verify that you're ready to go, try running these commands from a terminal:

python3 --version
python3 -c "import Bio; print(Bio.__version__)"
blastn -version
mash --version

Each of these should print a version number message. If not, troubleshoot that tool's installation before continuing!

Install Kleborate

Kleborate can be installed to your system for easy usage:

git clone --recursive https://github.com/klebgenomics/Kleborate.git
cd Kleborate
python3 setup.py install
kleborate -h

Alternatively, you can clone and run Kleborate without installation directly from its source directory:

git clone --recursive https://github.com/klebgenomics/Kleborate.git
cd Kleborate
./kleborate-runner.py -h

See examples to test out your installation on some public genome data. And if you'd like to thoroughly check that everything works as intended, you can also run this repo's automated tests after installation (see /test directory).

Note that Kleborate depends on a git submodule (Kaptive) which is why --recursive is required when cloning. When you clone or update your local copy of Kleborate using git pull, you should also navigate to the kaptive directory and use git pull https://github.com/katholt/Kaptive master to ensure that your copy of Kaptive (and the Kaptive databases) is also up-to-date.

Updating the MLST database

Each Kleborate release includes a copy of the K. pneumoniae species complex MLST database to screen against. The version included is current at the time of the release, however the K. pneumoniae species complex BIGSdb is being updated all the time with new STs, so Kleborate users may wish to update their copy of Kleborate regularly with the latest MLST database.

The MLST database is made up of two files which are located in the Kleborate/kleborate/data directory:

  • Klebsiella_pneumoniae.fasta (allele sequences)
  • kpneumoniae.txt (sequence type definitions)

A Python script to download the latest versions of these files is provided in the Kleborate/scripts directory. The downloaded files can then just be copied into the Kleborate/kleborate/data directory:

cd Kleborate/scripts
python3 getmlst.py --species "Klebsiella pneumoniae"
mv Klebsiella_pneumoniae.fasta ../kleborate/data
mv profiles_csv ../kleborate/data/kpneumoniae.txt
rm -f ../kleborate/data/Klebsiella_pneumoniae.fasta.n*

That last command deletes any existing BLAST database for the Klebsiella_pneumoniae.fasta file. When run, Kleborate will then rebuild the BLAST database for the new version of the file. Alternatively, you can run Kleborate with its --force_index option to make it rebuild all BLAST databases.