Chapter 7: Ultra-Fast Taxonomic Profiling: Kraken2 & Bracken
Chapter 7: Ultra-Fast Taxonomic Profiling: Kraken2 & Bracken
Aligning millions of short shotgun reads against comprehensive microbial databases using BLAST or Bowtie2 takes days. Kraken2 achieves classification speeds of millions of reads per minute by matching exact 35-mers against a compact hash table organized around the NCBI Taxonomy tree.
If a 35-mer matches both Escherichia coli and Salmonella enterica, Kraken2 assigns the k-mer to their Lowest Common Ancestor: the family Enterobacteriaceae. While conservative and accurate, this leaves many reads classified at higher taxonomic ranks rather than the species level.
1. Running Kraken2
# Classify paired-end microbial reads against the Standard Kraken2 Database
kraken2 \\
--db /ref/kraken2_standard_db \\
--threads 16 \\
--paired microbial_R1.fastq.gz microbial_R2.fastq.gz \\
--report sample.kreport \\
--output sample.kraken2. Species-Level Abundance Re-estimation with Bracken
Bracken (Bayesian Re-estimation of Abundance with KrakEN) uses a Bayesian probabilistic model to redistribute reads assigned to intermediate nodes down to the species level based on the relative abundance of uniquely matching reads.
# Run Bracken at the Species level (-l S) for 150 bp reads (-r 150)
bracken \\
-d /ref/kraken2_standard_db \\
-i sample.kreport \\
-o sample.bracken \\
-r 150 \\
-l S \\
-t 10
# Convert results into interactive Krona pie chart
ktImportTaxonomy -q 2 -t 3 sample.kreport -o sample_krona.html