Kraken2 and Bracken: A Shotgun Metagenomics Walkthrough
Nasir Mahmood Abbasi, PhD
Bioinformatics Educator
Kraken2 assigns taxonomic labels by matching read k-mers against a database. Bracken uses database-specific read-length distributions to estimate abundance at a chosen rank. This walkthrough follows one paired-end sample from classification through interpretation; the paths and thread count are placeholders for your environment.
Format: Advanced template. For learners familiar with shell commands and paired FASTQ files, this post-QC walkthrough produces Kraken2 and Bracken outputs from user-prepared reads and matching databases. A synthetic report exercise below supports practice without installing either tool.
What you need and what you will produce
Prepare quality-controlled paired FASTQ files, a built Kraken2 database, and a compatible Bracken database distribution generated for the read length you intend to analyze. Record software versions, database build/source and date, trimming settings, and the actual post-trimming read-length distribution. Bracken estimation depends on its database files being available for the selected rank and read length; running Kraken2 alone does not create them.
This is a post-QC classification walkthrough, not an end-to-end setup lab. Database construction and read preprocessing are out of scope: use your institution's documented environment or the official Kraken2 and Bracken setup guidance below. Database storage and build time vary with its contents and available resources; check requirements before downloading or building. Before analysis, confirm kraken2 --version and bracken --version, verify both read files and the database path exist, and confirm matching Bracken distribution files are available for the selected read length.
The workflow produces a per-read Kraken output, a six-column Kraken report, and a Bracken table at species rank. These are estimates conditional on the reads, database, and settings. They do not establish organism viability, absolute cell abundance, or clinical significance.
1. Classify paired reads with Kraken2
Replace the example paths and thread count. Kraken2 accepts compressed FASTQ input. With --paired, give the read-1 file followed by the corresponding read-2 file. Keep mates synchronized after preprocessing.
kraken2 --db /path/to/kraken2_database \
--threads 16 \
--paired sample_R1.fastq.gz sample_R2.fastq.gz \
--report sample.kreport \
--output sample.kraken
sample.kraken records each classified fragment, while sample.kreport aggregates counts by taxon. The report includes the percentage and fragment count for each taxon's subtree, direct-assignment count, rank code, taxid, and indented scientific name. A genus-level or higher assignment is an unresolved classification at that rank, not evidence that a specific species was detected. Check the command's exit status and logs before interpreting either file.
2. Estimate abundance with Bracken
Use the same Kraken database and its matching Bracken distribution files. Set -r to the read length represented by the distribution files and appropriate for your processed reads, not automatically the sequencer's nominal length. If trimming leaves variable or shorter reads, consult Bracken guidance and choose a defensible representative length; record that choice. Choose the target rank deliberately.
bracken -d /path/to/kraken2_database \
-i sample.kreport \
-o sample.bracken.S.tsv \
-r 150 \
-l S
Here -l S requests species-level estimates and -r 150 is only an example. Bracken redistributes some reads assigned higher in the taxonomy using a model derived from the database's expected read-length k-mer classifications. Its output distinguishes Kraken-assigned reads, added reads after re-estimation, total reads after re-estimation, and fraction of total. Those adjusted counts are model-based estimates, not newly observed species-specific reads.
3. Read the reports before making a biological claim
Start with the Kraken report's unclassified fraction and high-level assignments. Compare the Kraken direct and clade counts with the Bracken estimates at the chosen rank. Large unresolved fractions can reflect database coverage, sequence quality, or other pipeline factors; they do not identify a single cause. Unexpected taxa warrant checks of negative controls, database contents, host-read handling, and read quality before interpretation.
Database composition defines which sequences can be recognized and can also affect ambiguous assignments. Do not assume a standard database is adequate for every environment or that adding more references always improves a particular analysis. Document the database build and assess likely contaminants, especially when custom references are used.
Relative abundance describes the sequenced library after extraction, library preparation, sequencing, and classification. Biases in those steps can make it differ from the underlying community, and compositional proportions do not provide absolute abundance. Cross-sample comparisons require consistent processing and a clear rationale for normalization; cross-study comparisons add further differences in protocols and databases.
4. Visualize only after choosing a compatible input
KronaTools has importers for supported input formats. Do not pass a Kraken report to the generic ktImportText command as though it were a two-column taxon/weight file: the Kraken report is a six-column hierarchical format. Select the importer and input format documented for your installed KronaTools version, or convert data explicitly to its documented text format. Bracken output is also not automatically interchangeable with every importer.
Visualization is out of scope here: no plot is produced because importer compatibility depends on KronaTools version and input representation. Consult the linked import guide, then validate any conversion on a small input and compare its totals with the source table before interpreting a plot.
Run record and interpretation checklist
- Save Kraken2 and Bracken versions, database identity/build date, and relevant database files.
- Record read preprocessing, paired-file identity, Bracken read length, and target rank.
- Verify successful completion, report structure, unclassified fraction, and whether estimates are direct or Bracken-reestimated.
- Review controls and possible host contamination; describe database and technical limitations alongside any abundance table.
Practice with a synthetic report
These invented values support arithmetic practice only; they are not biological observations. Each row gives clade percentage, clade fragments, direct fragments, rank, taxid, and name.
100.00 1000 0 R 1 root
10.00 100 0 - 0 unclassified
90.00 900 0 D 2 Bacteria
62.00 620 20 G 123 Examplegenus
25.00 250 80 S 456 Example species
35.00 350 50 S 789 Another species
The synthetic Examplegenus row now reconciles: 20 directly assigned fragments + 250 + 350 child-clade fragments = 620 genus clade fragments, or 62.00% of the 1,000-fragment root total. For the synthetic Example species row (taxid 456), Kraken reports 250 clade fragments, including 80 direct fragments. A hypothetical matching Bracken entry reports 80 Kraken-assigned reads plus 20 added by re-estimation: 80 + 20 = 100 estimated reads, fraction 0.100. This 100 is a model-based species-rank estimate, not the Kraken clade count or 100 newly observed species-specific reads; the added 20 are model-redistributed. For Another species, 50 + 10 = 60 estimated reads, fraction 0.060. The unclassified fraction is 10%. Database representation or extraction/library bias can affect interpretation. The simplified root total is not an expected result from a real sample.
Practice: For a real report from your own prepared run, record unclassified percentage, one taxon's direct Kraken count, and its Bracken estimate if present. Explain why that estimate is model-based and name one database or laboratory factor that could affect interpretation. Without real inputs, use the synthetic exercise above; do not infer a biological finding from synthetic values.
Official documentation
No software versions were recorded for this walkthrough. Capture kraken2 --version and bracken --version alongside database identity and build date when you run it; re-check commands against official documentation if software changes. Report errors or reproducibility issues through the Contact page.
Author: Nasir Mahmood Abbasi, PhD - Category: Metagenomics