How To Install kraken2 on Ubuntu 22.04

Hostnbit
In this tutorial we learn how to install kraken2 on Ubuntu 22.04. kraken2 is taxonomic classification system using exact k-mer matches

Introduction

In this tutorial we learn how to install kraken2 on Ubuntu 22.04.

What is kraken2

kraken2 is:

Kraken 2 is the newest version of Kraken, a taxonomic classification
system using exact k-mer matches to achieve high accuracy and fast
classification speeds. This classifier matches each k-mer within a query
sequence to the lowest common ancestor (LCA) of all genomes containing
the given k-mer. The k-mer assignments inform the classification
algorithm. [see: Kraken 1’s Webpage for more details].

Kraken 2 provides significant improvements to Kraken 1, with faster
database build times, smaller database sizes, and faster classification
speeds. These improvements were achieved by the following updates to the
Kraken classification program:

  1. Storage of Minimizers: Instead of storing/querying entire k-mers,
    Kraken 2 stores minimizers (l-mers) of each k-mer. The length of
    each l-mer must be ≤ the k-mer length. Each k-mer is treated by
    Kraken 2 as if its LCA is the same as its minimizer’s LCA.
  2. Introduction of Spaced Seeds: Kraken 2 also uses spaced seeds to
    store and query minimizers to improve classification accuracy.
  3. Database Structure: While Kraken 1 saved an indexed and sorted list
    of k-mer/LCA pairs, Kraken 2 uses a compact hash table. This hash
    table is a probabilistic data structure that allows for faster
    queries and lower memory requirements. However, this data structure
    does have a <1% chance of returning the incorrect LCA or returning
    an LCA for a non-inserted minimizer. Users can compensate for this
    possibility by using Kraken’s confidence scoring thresholds.
  4. Protein Databases: Kraken 2 allows for databases built from amino
    acid sequences. When queried, Kraken 2 performs a six-frame
    translated search of the query sequences against the database.
  5. 16S Databases: Kraken 2 also provides support for databases not
    based on NCBI’s taxonomy. Currently, these include the 16S
    databases: Greengenes, SILVA, and RDP.

There are three methods to install kraken2 on Ubuntu 22.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install kraken2 Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install kraken2 using apt-get by running the following command:

sudo apt-get -y install kraken2

Install kraken2 Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install kraken2 using apt by running the following command:

sudo apt -y install kraken2

Install kraken2 Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install kraken2 using aptitude by running the following command:

sudo aptitude -y install kraken2

How To Uninstall kraken2 on Ubuntu 22.04

To uninstall only the kraken2 package we can use the following command:

sudo apt-get remove kraken2

Uninstall kraken2 And Its Dependencies

To uninstall kraken2 and its dependencies that are no longer needed by Ubuntu 22.04, we can use the command below:

sudo apt-get -y autoremove kraken2

Remove kraken2 Configurations and Data

To remove kraken2 configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge kraken2

Remove kraken2 configuration, data, and all of its dependencies

We can use the following command to remove kraken2 configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge kraken2

References

Summary

In this tutorial we learn how to install kraken2 package on Ubuntu 22.04 using different package management tools: apt, apt-get and aptitude.

Hostnbit

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Menu Title
Scroll to Top