๐งช Ultra-Fast Taxonomic Profiling of Whole Metagenomes
Kraken 2 matches exact 35-mer minimizers against an indexed database of all NCBI microbial genomes in seconds. Bracken (Bayesian Re-estimation of Abundance with KrakEN) redistributes reads assigned to higher taxonomic nodes down to the species level, yielding accurate relative abundance profiles.
๐ณ k-mer Exact Match & Lowest Common Ancestor (LCA) Simulator
Interactive ConceptWhen a sequencing read contains multiple 35-mers that match different reference species, Kraken 2 finds the single Lowest Common Ancestor (LCA) node that contains all matches. Select a simulated read profile:
โ๏ธ Bracken Bayesian Re-estimation Configurator
Command GeneratorSequencing & Target Rank
Generated Bracken CLI Command
bracken -d ${DB} -i sample.k2report -o sample_bracken_S.tsv -r 150 -l S -t 10
0. Compact Hash Tables & Minimizer Concept
Kraken 2 searches canonical 35-mers by selecting the lexicographically smallest 31-mer (the minimizer) in each window. This shrinks database storage from terabytes to ~60 GB while retaining exact taxonomic resolution.
1. Database Selection & Download
Download pre-built Ben Langmead databases hosted by the Center for Computational Biology at Johns Hopkins.
# Download Standard 16GB pre-built database (Bacteria, Archaea, Viral, Human) wget -c https://genome-idx.s3.amazonaws.com/kraken/k2_standard_16gb_20240112.tar.gz tar -xvzf k2_standard_16gb_20240112.tar.gz -C kraken_db/
2. Memory Optimization (--memory-mapping)
For systems with limited RAM, the --memory-mapping flag streams the hash table from high-speed NVMe SSDs without consuming 60+ GB of physical memory.
3. Pre-filtering & Host Decontamination
Quality-trim raw reads and strip human host background before taxonomic profiling.
4. Executing Kraken 2 Paired-End Classification
Generate both the full sequence-by-sequence output and the summary hierarchical report.
kraken2 --db kraken_db/ \ --paired clean_R1.fq.gz clean_R2.fq.gz \ --threads 8 \ --confidence 0.1 \ --report sample.k2report \ --output sample.kraken2
5. Decoding the Kraken Report Format
The standard 6-column report records: 1) Percentage of fragments; 2) Cumulative clade fragments; 3) Unassigned direct fragments; 4) Taxonomic rank code (U, R, D, P, C, O, F, G, S); 5) NCBI TaxID; 6) Indented scientific name.
42.15 1264500 1264500 U 0 unclassified 57.85 1735500 2500 R 1 root 56.40 1692000 4500 D 2 Bacteria 34.20 1026000 12000 P 1239 Firmicutes 18.50 555000 8000 G 1578 Lactobacillus 12.10 363000 363000 S 1579 Lactobacillus acidophilus
6. Bracken Bayesian Abundance Re-estimation
Redistribute reads mapped to higher clades (Genus, Family) down to Species based on pre-computed genomic probabilities.
bracken -d kraken_db/ \ -i sample.k2report \ -o sample_bracken_species.tsv \ -r 150 -l S -t 10
7. Merging Multiple Bracken Outputs into a Unified Matrix
Combine individual sample abundance tables into a single matrix for cross-cohort statistics.
combine_bracken_outputs.py \ --files sample_01_bracken.tsv sample_02_bracken.tsv sample_03_bracken.tsv \ --output combined_species_abundance.tsv
8. Interactive Krona & Pavian Visualizations
Generate interactive multi-layered zoomable pie charts with KronaTools.
# Convert kraken report to Krona HTML ktImportTaxonomy -m 3 -t 5 sample.k2report -o krona_visualization.html
9. BIOM Export for QIIME 2 & Phyloseq
Convert Kraken reports to Biological Observation Matrix (BIOM) format for downstream alpha/beta diversity analysis.
kraken-biom sample_*.k2report \ --max S --min S \ -o table_species.biom
10. Diversity Statistics in R (Phyloseq & Vegan)
Compute Shannon index, Bray-Curtis dissimilarity, and NMDS ordinations across experimental groups.
๐ Decision Architecture: Metagenomics Profiler Selection
Decision TreeClassifies 1-2 million reads per minute using all NCBI genomes. Always pair Kraken 2 with Bracken to eliminate taxonomic bias from reads mapped to higher clades.