[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EE9VGWR8PK004B5YVD1V8M":3,"skill-same:01M7EE9VGWR8PK004B5YVD1V8M":62},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":30,"commitSha":31,"skillDirectory":32,"forksCount":14,"repositoryHtmlUrl":33,"repositoryHomepageUrl":33,"ownerHtmlUrl":34,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":35,"install":36,"resources":49},"01M7EE9VGWR8PK004B5YVD1V8M","bio-metagenomics-kraken",null,"Classifies shotgun metagenomic reads to taxa with Kraken2's minimizer\u002FLCA matching against a chosen reference database, then hands off to Bracken for abundance re-estimation. Covers why the database (not the algorithm) decides what can be detected, the --confidence and --minimum-hit-groups precision levers, unique-minimizer false-positive control, host-read removal, and why raw Kraken2 read counts are not abundances. Use when profiling who-is-there from shotgun reads, choosing a Kraken2 database, setting a confidence threshold, controlling false positives, or feeding reports to Bracken. For marker-gene profiling see metaphlan-profiling; for abundance mechanics see abundance-estimation; for assembly\u002FMAG recovery see genome-assembly\u002Fmetagenome-assembly.","Mr-Nobody-Anonymous\u002FAll-skills","Mr-Nobody-Anonymous","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F184253119?v=4","01M7AEXFJHKTYQW5R0ZCQQTWFV","anonymous","01M7C00M3GQR4QKP9GZA42GFAK",0,"MIT","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-metagenomics-kraken\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: bio-metagenomics-kraken\ndescription: Classifies shotgun metagenomic reads to taxa with Kraken2's minimizer\u002FLCA matching against a chosen reference database, then hands off to Bracken for abundance re-estimation. Covers why the database (not the algorithm) decides what can be detected, the --confidence and --minimum-hit-groups precision levers, unique-minimizer false-positive control, host-read removal, and why raw Kraken2 read counts are not abundances. Use when profiling who-is-there from shotgun reads, choosing a Kraken2 database, setting a confidence threshold, controlling false positives, or feeding reports to Bracken. For marker-gene profiling see metaphlan-profiling; for abundance mechanics see abundance-estimation; for assembly\u002FMAG recovery see genome-assembly\u002Fmetagenome-assembly.\ntool_type: cli\nprimary_tool: Kraken2\nsource: \"https:\u002F\u002Fgithub.com\u002FGPTomics\u002FbioSkills\"\nsource_repository: \"GPTomics\u002FbioSkills\"\nsource_path: \"metagenomics\u002Fkraken-classification\u002FSKILL.md\"\nlicense: \"MIT\"\nimported_at: \"2026-09-20\"\n---\n\n## Version Compatibility\n\nReference examples tested with: Kraken2 2.1.3+, Bracken 2.9+, KrakenTools 1.2+, pandas 2.2+.\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- CLI: `kraken2 --version`, `bracken -h`, `kraken2 --help` to confirm flags and defaults\n- Python: `pip show \u003Cpackage>` then `help(module.function)` to check signatures\n\nIf code throws ImportError, AttributeError, or TypeError, introspect the installed\npackage and adapt the example to match the actual API rather than retrying.\n\nThe DATABASE is the version that matters most. A taxon absent from the database is invisible no matter how the binary is configured. Record the Kraken2 database build (Standard \u002F PlusPF \u002F PlusPFP \u002F nt \u002F GTDB, and whether capped to 8\u002F16 GB) and the Bracken `databaseRLENmers.kmer_distrib` read length, which must match both the Kraken2 database and the actual read length. `--minimum-hit-groups` enforcement varied across older 2.x point releases; confirm defaults with `kraken2 --help` on the installed build.\n\n# Kraken Classification\n\n**\"What's in my metagenome?\"** -> Match each read's k-mers to a reference database by lowest-common-ancestor, then re-estimate abundance with Bracken - because the database, not the algorithm, decides what can be found.\n- CLI: `kraken2 --db DB --paired R1.fq.gz R2.fq.gz --report out.kreport --confidence 0.1 --output out.kraken`\n\nScope: read-based, assembly-free taxonomic classification of shotgun reads, plus the Bracken handoff. Marker-gene profiling -> metaphlan-profiling. Bracken command mechanics -> abundance-estimation. Genome\u002FMAG recovery -> genome-assembly\u002Fmetagenome-assembly. Host removal and read QC -> read-qc\u002Fcontamination-screening, contamination-controls. Amplicon\u002F16S -> the microbiome category.\n\n## The Single Most Important Modern Insight -- A Kraken Report Is a Database-Conditioned Similarity Ledger, Not a Sample Inventory\n\nKraken reports what each read most resembles in THIS database - never what is truly present, and never how much. Every number is hostage to three choices made before the run: the database, the confidence threshold, and the assumption that read count means abundance. Three corollaries each common misuse violates:\n\n1. **Classification is not presence.** At `--confidence 0` with the LCA rule, one shared k-mer labels a read with its nearest database relative even when the true organism is absent. Absence-from-database becomes a confident wrong species.\n2. **Read count is not abundance.** Counts scale with genome length and copy number, so the report percentage is a fragment fraction, not a cell fraction. Bracken fixes the wrong-rank problem; it does not fix this.\n3. **A taxon at the bottom of the report is a hypothesis, not a finding.** Single-region hits, hash collisions, and contaminated references populate the long tail. Unique-minimizer coverage separates a real low-abundance organism from a phantom.\n\nOrganize the analysis around defending against these three, not around listing flags. Kraken2 at defaults over-classifies; Kraken2 tuned (right database + confidence + hit-groups + a unique-k-mer floor + host removal) is competitive with any classifier.\n\n## Why \"Exact K-mer\" Is Wrong for Kraken2\n\nKraken1 (Wood & Salzberg 2014 *Genome Biol* 15:R46) stored every exact k-mer. Kraken2 (Wood 2019 *Genome Biol* 20:257) replaced that with three ideas that make it fast and lean but PROBABILISTIC: (a) minimizers collapse each k-mer (default k=35) to the smallest hashed l=31-mer in its window; (b) a spaced seed (s=7 masked positions) tolerates errors at \"don't care\" positions; (c) a compact hash table stores only high bits of each key. The compact hash can return a wrong or spurious LCA on collision - which is exactly why the precision levers below exist. Calling Kraken2 \"exact k-mer\" hides where false positives come from.\n\n## Tool Taxonomy\n\n| Tool | Citation | Mechanism \u002F role | When |\n|------|----------|------------------|------|\n| Kraken2 | Wood 2019 *Genome Biol* 20:257 | minimizer + spaced-seed + compact-hash LCA | fast read classification; database-bound; the default choice |\n| Bracken | Lu 2017 *PeerJ Comput Sci* 3:e104 | Bayesian redistribution of reads stranded at higher ranks | always run after Kraken2 for species\u002Fgenus estimates |\n| KrakenUniq | Breitwieser 2018 *Genome Biol* 19:198 | HyperLogLog count of unique k-mers per taxon | false-positive control on hits of interest |\n| KMCP | Shen 2023 *Bioinformatics* 39:btac845 | genome-coverage pseudo-mapping | low-depth\u002Fclinical\u002Fviral where conserved-region FPs hurt |\n| sourmash gather | Pierce 2019 *F1000Res* 8:1006 | FracMinHash containment, min-set-cover | \"which genomes are present\" with calibrated containment |\n| MetaPhlAn 4 | Blanco-Miguez 2023 *Nat Biotechnol* 41:1633 | clade-specific marker genes | -> metaphlan-profiling; FP-conservative, abundance directly |\n\n## Decision Tree by Scenario\n\n| Scenario | Recommended | Why |\n|----------|-------------|-----|\n| Who-is-there, fast, custom database possible | Kraken2 + Bracken | k-mer LCA; Bracken fixes count->rank, not count->cells |\n| Need species relative abundance with no database build | -> metaphlan-profiling | marker-based; abundance-conservative; no FP tail |\n| Low-biomass \u002F clinical pathogen ID | Kraken2 (high confidence + hit-groups) + KrakenUniq unique-k-mer floor | the FP tail is the enemy; one unique-k-mer filter cuts phantoms |\n| Reads not host-depleted \u002F unQC'd | -> contamination-controls, read-qc\u002Fcontamination-screening first | host reads swamp the profile; references carry human fragments |\n| Want abundance comparable across studies | state the database + confidence; do not merge with MetaPhlAn percentages | read fraction != cell fraction; different tools = different quantities |\n| Recover genomes \u002F novel taxa \u002F MAGs | -> genome-assembly\u002Fmetagenome-assembly | classification is assembly-free and database-bound |\n| 16S amplicon reads | -> microbiome category | Kraken-on-16S works but amplicon analysis lives there |\n\n## Basic Classification\n\n```bash\n# Paired-end, with the precision levers that defaults omit\nkraken2 --db \"$KRAKEN_DB\" \\\n    --paired --gzip-compressed --threads 8 \\\n    --confidence 0.1 \\            # raise from default 0 to suppress single-k-mer false positives\n    --minimum-hit-groups 2 \\      # require >=2 distinct hit regions (default 2; raise to 3 for clinical)\n    --report out.kreport \\\n    --output out.kraken \\\n    R1.fq.gz R2.fq.gz\n```\n\n`--paired` joins mates with a k-mer-breaking `N` and classifies the pair as one fragment, raising specificity. The per-read `--output` (large) can be dropped to `\u002Fdev\u002Fnull` once the `.kreport` is what feeds Bracken. `--memory-mapping` runs without loading the database into RAM (slower; for low-memory hosts).\n\n## False-Positive Control: Unique Minimizers\n\n**Goal:** Separate a real low-abundance organism from a single-region phantom before believing any tail taxon.\n\n**Approach:** Enable `--report-minimizer-data` so the report carries distinct-minimizer counts; a taxon with many reads but few distinct minimizers is hitting one conserved region and is a red flag. KrakenUniq's HyperLogLog unique-k-mer count is the heavier-weight version of the same signal.\n\n```bash\nkraken2 --db \"$KRAKEN_DB\" --paired --confidence 0.1 \\\n    --report-minimizer-data \\    # inserts 2 columns: total + DISTINCT minimizers (shifts later columns)\n    --report out.kreport --output \u002Fdev\u002Fnull \\\n    R1.fq.gz R2.fq.gz\n# A species with high reads but low distinct-minimizers = false positive (one region lit up repeatedly).\n```\n\nCalibrate a unique-k-mer floor against negative controls rather than hard-coding one; the clinical \">=1024 unique k-mers\" cutoff is dataset\u002Fdatabase-specific folklore, not a constant.\n\n## Build a Custom Database\n\n**Goal:** Build a database whose contents define exactly the detectable universe (and include human for host capture).\n\n**Approach:** Download taxonomy, add the libraries the question needs (including `human`), build the minimizer index, then build the matching Bracken distributions at the actual read length.\n\n```bash\nkraken2-build --download-taxonomy --db custom_db\nfor lib in bacteria archaea viral human UniVec_Core; do\n    kraken2-build --download-library \"$lib\" --db custom_db\ndone\nkraken2-build --build --db custom_db --threads 16    # writes hash.k2d, opts.k2d, taxo.k2d\nkraken2-build --clean --db custom_db                 # drop library\u002F + taxonomy\u002F to shrink\nbracken-build -d custom_db -t 16 -k 35 -l 150        # -k MUST equal the Kraken2 k (35); -l = read length\n```\n\n`kraken2-build --special gtdb` builds a GTDB-taxonomy database (curated; the greengenes\u002Fsilva\u002Frdp special downloads have rotted). `--max-db-size` randomly downsamples k-mers to fit a cap - this is how the prebuilt 8gb\u002F16gb databases are made, and the reason confidence collapses classification on them.\n\n## Hand Off to Bracken\n\nKraken strands reads at the shared genus when species share k-mers; Bracken redistributes them down using genome-derived priors. It fixes the wrong-rank problem only - never genome-size bias, and never false positives (it can amplify or even invent a species by reassigning an absent organism's reads to its nearest congener). Run FP control first. Command mechanics live in abundance-estimation:\n\n```bash\nbracken -d \"$KRAKEN_DB\" -i out.kreport -o out.bracken -w out.bracken.kreport \\\n    -r 150 \\   # MUST match a built databaseRLENmers.kmer_distrib AND the actual read length\n    -l S -t 10 # species level; -t is a redistribution floor (drops taxa with fewer than 10 clade-level reads, strict \u003C), not a confidence\n```\n\n## Per-Method Failure Modes\n\n### Over-classification at default confidence\n**Trigger:** running `--confidence 0` and reporting the species list. **Mechanism:** one shared k-mer can classify a read; the LCA labels it with its nearest database relative. **Symptom:** hundreds of low-abundance species, many biologically implausible. **Fix:** `--confidence 0.1-0.4` (database-dependent) plus `--minimum-hit-groups >=2`; verify the tail with unique minimizers.\n\n### Counts read as abundance\n**Trigger:** using the `.kreport` percentage column as relative abundance. **Mechanism:** read count is proportional to abundance x genome length x copy number. **Symptom:** large-genome taxa overstated; downstream diversity\u002Fordination on a non-cell-fraction. **Fix:** run Bracken for the rank problem; treat even Bracken `fraction_total_reads` as a read fraction and hand off genome-size\u002Fcopy-number caveats to abundance-estimation.\n\n### Bracken read-length mismatch\n**Trigger:** `-r 100` on 150 bp reads, or a database built only for a different length. **Mechanism:** the redistribution model is fragment-length specific. **Symptom:** biased abundances with no error (silent) if the `.kmer_distrib` exists, hard crash if it does not. **Fix:** `-r` = actual read length AND a matching `databaseRLENmers.kmer_distrib` must exist (build it or pick a prebuilt database shipping that length).\n\n### Capped database plus high confidence\n**Trigger:** a Standard-8\u002F16 database with confidence cranked up. **Mechanism:** capped databases are random k-mer subsamples; few reads can clear a high threshold. **Symptom:** classification collapses toward zero; \"my sample is mostly novel.\" **Fix:** use a full\u002Flarge database for high confidence, or lower confidence on a capped database and accept lower precision.\n\n### Host reads and contaminated references\n**Trigger:** classifying without host depletion, then trusting human and low-level hits. **Mechanism:** host reads dominate low-biomass samples, and >2 million GenBank entries carry mislabeled human\u002Fvector sequence (Steinegger & Salzberg 2020 *Genome Biol* 21:115). **Symptom:** confident `Homo sapiens` plus a long artifactual tail. **Fix:** include `human` in the database and\u002For host-deplete upstream; scrutinize any taxon co-varying with host load; consider Recentrifuge negative-control subtraction.\n\n## Quantitative Thresholds\n\n| Threshold | Source | Rationale |\n|-----------|--------|-----------|\n| `--confidence` 0.0 default; use 0.2-0.4 on a comprehensive DB | Liu 2024 *aBIOTECH* 5:465; Lu 2022 *Nat Protoc* 17:2815 | species precision rose from ~0.16 to ~0.76 at CS 0.2; default over-classifies |\n| `--minimum-hit-groups` 2 (raise to 3 for clinical) | Kraken2 manual | a single lucky minimizer\u002Fcollision cannot make a call |\n| Bracken `-k` = 35 | Lu 2017 *PeerJ Comput Sci* 3:e104 | must equal the Kraken2 database k-mer length |\n| Bracken `-r` = actual read length | Bracken docs | redistribution priors are fragment-length specific |\n| Bracken `-t` 10 default | Bracken docs | redistribution floor; too high deletes real rare taxa, not a confidence |\n| Classification rate 30-70% (environmental) | community | low rate = novel taxa OR host contamination OR wrong database - diagnose which |\n| Build k\u002Fl\u002Fs = 35\u002F31\u002F7 (nuc); 15\u002F12\u002F0 (prot) | Kraken2 manual | build-time only; cannot change k at classify time |\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|-----------------|-------|----------|\n| Hundreds of implausible species | `--confidence 0`, no hit-group floor | raise confidence; `--minimum-hit-groups >=2`; unique-k-mer filter |\n| Bracken: \"kmer_distrib file not found\" | `-r` has no matching built distribution | run `bracken-build -l \u003Creadlen>` or use a prebuilt DB shipping that length |\n| Report parsing columns misaligned | `--report-minimizer-data` inserted 2 columns | parse 8-column layout when the flag is on |\n| Near-zero classification on a small DB | capped (downsampled) DB + high confidence | larger DB, or lower confidence on the capped DB |\n| Confident human + odd tail | host reads + contaminated references | host-deplete first; treat human\u002Ftail as suspect |\n| Bash example silently truncates flags | inline `# comment` after a `\\` line continuation | put comments on their own line |\n\n## References\n\n- Wood DE, Lu J, Langmead B. 2019. Improved metagenomic analysis with Kraken 2. *Genome Biol* 20:257.\n- Wood DE, Salzberg SL. 2014. Kraken: ultrafast metagenomic sequence classification using exact alignments. *Genome Biol* 15:R46.\n- Lu J, Breitwieser FP, Thielen P, Salzberg SL. 2017. Bracken: estimating species abundance in metagenomics data. *PeerJ Comput Sci* 3:e104.\n- Breitwieser FP, Baker DN, Salzberg SL. 2018. KrakenUniq: confident and fast metagenomics classification using unique k-mer counts. *Genome Biol* 19:198.\n- Lu J, Rincon N, Wood DE, Breitwieser FP, Pockrandt C, Langmead B, Salzberg SL, Steinegger M. 2022. Metagenome analysis using the Kraken software suite. *Nat Protoc* 17:2815-2839.\n- Liu Y, Ghaffari MH, Ma T, Tu Y. 2024. Impact of database choice and confidence score on the performance of taxonomic classification using Kraken2. *aBIOTECH* 5:465-475.\n- Steinegger M, Salzberg SL. 2020. Terminating contamination: large-scale search identifies more than 2,000,000 contaminated entries in GenBank. *Genome Biol* 21:115.\n- Shen W, Xiang H, Huang T, et al. 2023. KMCP: accurate metagenomic profiling of both prokaryotic and viral populations by pseudo-mapping. *Bioinformatics* 39:btac845.\n\n## Related Skills\n\n- abundance-estimation - Bracken command mechanics and read-count-to-abundance conversion\n- metaphlan-profiling - Marker-gene alternative; FP-conservative, abundance reported directly\n- metagenome-visualization - Plot and run community stats on the resulting profiles\n- contamination-controls - Host depletion, blanks, and decontam before classification\n- genome-assembly\u002Fmetagenome-assembly - Assembly\u002FMAG recovery; this category is read-based\n- read-qc\u002Fcontamination-screening - Host\u002Fvector read screening before classification\n- workflows\u002Fmetagenomics-pipeline - End-to-end shotgun profiling\n","## Version Compatibility\n\nReference examples tested with: Kraken2 2.1.3+, Bracken 2.9+, KrakenTools 1.2+, pandas 2.2+.\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- CLI: `kraken2 --version`, `bracken -h`, `kraken2 --help` to confirm flags and defaults\n- Python: `pip show \u003Cpackage>` then `help(module.function)` to check signatures\n\nIf code throws ImportError, AttributeError, or TypeError, introspect the installed\npackage and adapt the example to match the actual API rather than retrying.\n\nThe DATABASE is the version that matters most. A taxon absent from the database is invisible no matter how the binary is configured. Record the Kraken2 database build (Standard \u002F PlusPF \u002F PlusPFP \u002F nt \u002F GTDB, and whether capped to 8\u002F16 GB) and the Bracken `databaseRLENmers.kmer_distrib` read length, which must match both the Kraken2 database and the actual read length. `--minimum-hit-groups` enforcement varied across older 2.x point releases; confirm defaults with `kraken2 --help` on the installed build.\n\n# Kraken Classification\n\n**\"What's in my metagenome?\"** -> Match each read's k-mers to a reference database by lowest-common-ancestor, then re-estimate abundance with Bracken - because the database, not the algorithm, decides what can be found.\n- CLI: `kraken2 --db DB --paired R1.fq.gz R2.fq.gz --report out.kreport --confidence 0.1 --output out.kraken`\n\nScope: read-based, assembly-free taxonomic classification of shotgun reads, plus the Bracken handoff. Marker-gene profiling -> metaphlan-profiling. Bracken command mechanics -> abundance-estimation. Genome\u002FMAG recovery -> genome-assembly\u002Fmetagenome-assembly. Host removal and read QC -> read-qc\u002Fcontamination-screening, contamination-controls. Amplicon\u002F16S -> the microbiome category.\n\n## The Single Most Important Modern Insight -- A Kraken Report Is a Database-Conditioned Similarity Ledger, Not a Sample Inventory\n\nKraken reports what each read most resembles in THIS database - never what is truly present, and never how much. Every number is hostage to three choices made before the run: the database, the confidence threshold, and the assumption that read count means abundance. Three corollaries each common misuse violates:\n\n1. **Classification is not presence.** At `--confidence 0` with the LCA rule, one shared k-mer labels a read with its nearest database relative even when the true organism is absent. Absence-from-database becomes a confident wrong species.\n2. **Read count is not abundance.** Counts scale with genome length and copy number, so the report percentage is a fragment fraction, not a cell fraction. Bracken fixes the wrong-rank problem; it does not fix this.\n3. **A taxon at the bottom of the report is a hypothesis, not a finding.** Single-region hits, hash collisions, and contaminated references populate the long tail. Unique-minimizer coverage separates a real low-abundance organism from a phantom.\n\nOrganize the analysis around defending against these three, not around listing flags. Kraken2 at defaults over-classifies; Kraken2 tuned (right database + confidence + hit-groups + a unique-k-mer floor + host removal) is competitive with any classifier.\n\n## Why \"Exact K-mer\" Is Wrong for Kraken2\n\nKraken1 (Wood & Salzberg 2014 *Genome Biol* 15:R46) stored every exact k-mer. Kraken2 (Wood 2019 *Genome Biol* 20:257) replaced that with three ideas that make it fast and lean but PROBABILISTIC: (a) minimizers collapse each k-mer (default k=35) to the smallest hashed l=31-mer in its window; (b) a spaced seed (s=7 masked positions) tolerates errors at \"don't care\" positions; (c) a compact hash table stores only high bits of each key. The compact hash can return a wrong or spurious LCA on collision - which is exactly why the precision levers below exist. Calling Kraken2 \"exact k-mer\" hides where false positives come from.\n\n## Tool Taxonomy\n\n| Tool | Citation | Mechanism \u002F role | When |\n|------|----------|------------------|------|\n| Kraken2 | Wood 2019 *Genome Biol* 20:257 | minimizer + spaced-seed + compact-hash LCA | fast read classification; database-bound; the default choice |\n| Bracken | Lu 2017 *PeerJ Comput Sci* 3:e104 | Bayesian redistribution of reads stranded at higher ranks | always run after Kraken2 for species\u002Fgenus estimates |\n| KrakenUniq | Breitwieser 2018 *Genome Biol* 19:198 | HyperLogLog count of unique k-mers per taxon | false-positive control on hits of interest |\n| KMCP | Shen 2023 *Bioinformatics* 39:btac845 | genome-coverage pseudo-mapping | low-depth\u002Fclinical\u002Fviral where conserved-region FPs hurt |\n| sourmash gather | Pierce 2019 *F1000Res* 8:1006 | FracMinHash containment, min-set-cover | \"which genomes are present\" with calibrated containment |\n| MetaPhlAn 4 | Blanco-Miguez 2023 *Nat Biotechnol* 41:1633 | clade-specific marker genes | -> metaphlan-profiling; FP-conservative, abundance directly |\n\n## Decision Tree by Scenario\n\n| Scenario | Recommended | Why |\n|----------|-------------|-----|\n| Who-is-there, fast, custom database possible | Kraken2 + Bracken | k-mer LCA; Bracken fixes count->rank, not count->cells |\n| Need species relative abundance with no database build | -> metaphlan-profiling | marker-based; abundance-conservative; no FP tail |\n| Low-biomass \u002F clinical pathogen ID | Kraken2 (high confidence + hit-groups) + KrakenUniq unique-k-mer floor | the FP tail is the enemy; one unique-k-mer filter cuts phantoms |\n| Reads not host-depleted \u002F unQC'd | -> contamination-controls, read-qc\u002Fcontamination-screening first | host reads swamp the profile; references carry human fragments |\n| Want abundance comparable across studies | state the database + confidence; do not merge with MetaPhlAn percentages | read fraction != cell fraction; different tools = different quantities |\n| Recover genomes \u002F novel taxa \u002F MAGs | -> genome-assembly\u002Fmetagenome-assembly | classification is assembly-free and database-bound |\n| 16S amplicon reads | -> microbiome category | Kraken-on-16S works but amplicon analysis lives there |\n\n## Basic Classification\n\n```bash\n# Paired-end, with the precision levers that defaults omit\nkraken2 --db \"$KRAKEN_DB\" \\\n    --paired --gzip-compressed --threads 8 \\\n    --confidence 0.1 \\            # raise from default 0 to suppress single-k-mer false positives\n    --minimum-hit-groups 2 \\      # require >=2 distinct hit regions (default 2; raise to 3 for clinical)\n    --report out.kreport \\\n    --output out.kraken \\\n    R1.fq.gz R2.fq.gz\n```\n\n`--paired` joins mates with a k-mer-breaking `N` and classifies the pair as one fragment, raising specificity. The per-read `--output` (large) can be dropped to `\u002Fdev\u002Fnull` once the `.kreport` is what feeds Bracken. `--memory-mapping` runs without loading the database into RAM (slower; for low-memory hosts).\n\n## False-Positive Control: Unique Minimizers\n\n**Goal:** Separate a real low-abundance organism from a single-region phantom before believing any tail taxon.\n\n**Approach:** Enable `--report-minimizer-data` so the report carries distinct-minimizer counts; a taxon with many reads but few distinct minimizers is hitting one conserved region and is a red flag. KrakenUniq's HyperLogLog unique-k-mer count is the heavier-weight version of the same signal.\n\n```bash\nkraken2 --db \"$KRAKEN_DB\" --paired --confidence 0.1 \\\n    --report-minimizer-data \\    # inserts 2 columns: total + DISTINCT minimizers (shifts later columns)\n    --report out.kreport --output \u002Fdev\u002Fnull \\\n    R1.fq.gz R2.fq.gz\n# A species with high reads but low distinct-minimizers = false positive (one region lit up repeatedly).\n```\n\nCalibrate a unique-k-mer floor against negative controls rather than hard-coding one; the clinical \">=1024 unique k-mers\" cutoff is dataset\u002Fdatabase-specific folklore, not a constant.\n\n## Build a Custom Database\n\n**Goal:** Build a database whose contents define exactly the detectable universe (and include human for host capture).\n\n**Approach:** Download taxonomy, add the libraries the question needs (including `human`), build the minimizer index, then build the matching Bracken distributions at the actual read length.\n\n```bash\nkraken2-build --download-taxonomy --db custom_db\nfor lib in bacteria archaea viral human UniVec_Core; do\n    kraken2-build --download-library \"$lib\" --db custom_db\ndone\nkraken2-build --build --db custom_db --threads 16    # writes hash.k2d, opts.k2d, taxo.k2d\nkraken2-build --clean --db custom_db                 # drop library\u002F + taxonomy\u002F to shrink\nbracken-build -d custom_db -t 16 -k 35 -l 150        # -k MUST equal the Kraken2 k (35); -l = read length\n```\n\n`kraken2-build --special gtdb` builds a GTDB-taxonomy database (curated; the greengenes\u002Fsilva\u002Frdp special downloads have rotted). `--max-db-size` randomly downsamples k-mers to fit a cap - this is how the prebuilt 8gb\u002F16gb databases are made, and the reason confidence collapses classification on them.\n\n## Hand Off to Bracken\n\nKraken strands reads at the shared genus when species share k-mers; Bracken redistributes them down using genome-derived priors. It fixes the wrong-rank problem only - never genome-size bias, and never false positives (it can amplify or even invent a species by reassigning an absent organism's reads to its nearest congener). Run FP control first. Command mechanics live in abundance-estimation:\n\n```bash\nbracken -d \"$KRAKEN_DB\" -i out.kreport -o out.bracken -w out.bracken.kreport \\\n    -r 150 \\   # MUST match a built databaseRLENmers.kmer_distrib AND the actual read length\n    -l S -t 10 # species level; -t is a redistribution floor (drops taxa with fewer than 10 clade-level reads, strict \u003C), not a confidence\n```\n\n## Per-Method Failure Modes\n\n### Over-classification at default confidence\n**Trigger:** running `--confidence 0` and reporting the species list. **Mechanism:** one shared k-mer can classify a read; the LCA labels it with its nearest database relative. **Symptom:** hundreds of low-abundance species, many biologically implausible. **Fix:** `--confidence 0.1-0.4` (database-dependent) plus `--minimum-hit-groups >=2`; verify the tail with unique minimizers.\n\n### Counts read as abundance\n**Trigger:** using the `.kreport` percentage column as relative abundance. **Mechanism:** read count is proportional to abundance x genome length x copy number. **Symptom:** large-genome taxa overstated; downstream diversity\u002Fordination on a non-cell-fraction. **Fix:** run Bracken for the rank problem; treat even Bracken `fraction_total_reads` as a read fraction and hand off genome-size\u002Fcopy-number caveats to abundance-estimation.\n\n### Bracken read-length mismatch\n**Trigger:** `-r 100` on 150 bp reads, or a database built only for a different length. **Mechanism:** the redistribution model is fragment-length specific. **Symptom:** biased abundances with no error (silent) if the `.kmer_distrib` exists, hard crash if it does not. **Fix:** `-r` = actual read length AND a matching `databaseRLENmers.kmer_distrib` must exist (build it or pick a prebuilt database shipping that length).\n\n### Capped database plus high confidence\n**Trigger:** a Standard-8\u002F16 database with confidence cranked up. **Mechanism:** capped databases are random k-mer subsamples; few reads can clear a high threshold. **Symptom:** classification collapses toward zero; \"my sample is mostly novel.\" **Fix:** use a full\u002Flarge database for high confidence, or lower confidence on a capped database and accept lower precision.\n\n### Host reads and contaminated references\n**Trigger:** classifying without host depletion, then trusting human and low-level hits. **Mechanism:** host reads dominate low-biomass samples, and >2 million GenBank entries carry mislabeled human\u002Fvector sequence (Steinegger & Salzberg 2020 *Genome Biol* 21:115). **Symptom:** confident `Homo sapiens` plus a long artifactual tail. **Fix:** include `human` in the database and\u002For host-deplete upstream; scrutinize any taxon co-varying with host load; consider Recentrifuge negative-control subtraction.\n\n## Quantitative Thresholds\n\n| Threshold | Source | Rationale |\n|-----------|--------|-----------|\n| `--confidence` 0.0 default; use 0.2-0.4 on a comprehensive DB | Liu 2024 *aBIOTECH* 5:465; Lu 2022 *Nat Protoc* 17:2815 | species precision rose from ~0.16 to ~0.76 at CS 0.2; default over-classifies |\n| `--minimum-hit-groups` 2 (raise to 3 for clinical) | Kraken2 manual | a single lucky minimizer\u002Fcollision cannot make a call |\n| Bracken `-k` = 35 | Lu 2017 *PeerJ Comput Sci* 3:e104 | must equal the Kraken2 database k-mer length |\n| Bracken `-r` = actual read length | Bracken docs | redistribution priors are fragment-length specific |\n| Bracken `-t` 10 default | Bracken docs | redistribution floor; too high deletes real rare taxa, not a confidence |\n| Classification rate 30-70% (environmental) | community | low rate = novel taxa OR host contamination OR wrong database - diagnose which |\n| Build k\u002Fl\u002Fs = 35\u002F31\u002F7 (nuc); 15\u002F12\u002F0 (prot) | Kraken2 manual | build-time only; cannot change k at classify time |\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|-----------------|-------|----------|\n| Hundreds of implausible species | `--confidence 0`, no hit-group floor | raise confidence; `--minimum-hit-groups >=2`; unique-k-mer filter |\n| Bracken: \"kmer_distrib file not found\" | `-r` has no matching built distribution | run `bracken-build -l \u003Creadlen>` or use a prebuilt DB shipping that length |\n| Report parsing columns misaligned | `--report-minimizer-data` inserted 2 columns | parse 8-column layout when the flag is on |\n| Near-zero classification on a small DB | capped (downsampled) DB + high confidence | larger DB, or lower confidence on the capped DB |\n| Confident human + odd tail | host reads + contaminated references | host-deplete first; treat human\u002Ftail as suspect |\n| Bash example silently truncates flags | inline `# comment` after a `\\` line continuation | put comments on their own line |\n\n## References\n\n- Wood DE, Lu J, Langmead B. 2019. Improved metagenomic analysis with Kraken 2. *Genome Biol* 20:257.\n- Wood DE, Salzberg SL. 2014. Kraken: ultrafast metagenomic sequence classification using exact alignments. *Genome Biol* 15:R46.\n- Lu J, Breitwieser FP, Thielen P, Salzberg SL. 2017. Bracken: estimating species abundance in metagenomics data. *PeerJ Comput Sci* 3:e104.\n- Breitwieser FP, Baker DN, Salzberg SL. 2018. KrakenUniq: confident and fast metagenomics classification using unique k-mer counts. *Genome Biol* 19:198.\n- Lu J, Rincon N, Wood DE, Breitwieser FP, Pockrandt C, Langmead B, Salzberg SL, Steinegger M. 2022. Metagenome analysis using the Kraken software suite. *Nat Protoc* 17:2815-2839.\n- Liu Y, Ghaffari MH, Ma T, Tu Y. 2024. Impact of database choice and confidence score on the performance of taxonomic classification using Kraken2. *aBIOTECH* 5:465-475.\n- Steinegger M, Salzberg SL. 2020. Terminating contamination: large-scale search identifies more than 2,000,000 contaminated entries in GenBank. *Genome Biol* 21:115.\n- Shen W, Xiang H, Huang T, et al. 2023. KMCP: accurate metagenomic profiling of both prokaryotic and viral populations by pseudo-mapping. *Bioinformatics* 39:btac845.\n\n## Related Skills\n\n- abundance-estimation - Bracken command mechanics and read-count-to-abundance conversion\n- metaphlan-profiling - Marker-gene alternative; FP-conservative, abundance reported directly\n- metagenome-visualization - Plot and run community stats on the resulting profiles\n- contamination-controls - Host depletion, blanks, and decontam before classification\n- genome-assembly\u002Fmetagenome-assembly - Assembly\u002FMAG recovery; this category is read-based\n- read-qc\u002Fcontamination-screening - Host\u002Fvector read screening before classification\n- workflows\u002Fmetagenomics-pipeline - End-to-end shotgun profiling\n",{"name":5,"source":24,"license":15,"tool_type":25,"description":7,"imported_at":26,"source_path":27,"primary_tool":28,"source_repository":29},"https:\u002F\u002Fgithub.com\u002FGPTomics\u002FbioSkills","cli","2026-09-20","metagenomics\u002Fkraken-classification\u002FSKILL.md","Kraken2","GPTomics\u002FbioSkills","main","2d1750717747097b602acf30bd09a7cbd4b4c6ea","awesome_skills\u002Fbiology\u002Fbio-metagenomics-kraken","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous","2026-11-09 11:45:36",{"source":8,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-metagenomics-kraken",{"tool":42,"command":43},"bunx","bunx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-metagenomics-kraken",{"tool":45,"command":46},"pnpm","pnpm dlx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-metagenomics-kraken","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-metagenomics-kraken\u002FSKILL.md",true,[50,56],{"path":51,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":54,"sourceHtmlUrl":55},"examples\u002Fkraken2_classify.sh","SCRIPT","脚本",2266,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-metagenomics-kraken\u002Fexamples\u002Fkraken2_classify.sh",{"path":57,"resourceType":58,"resourceTypeDesc":59,"sizeBytes":60,"sourceHtmlUrl":61},"usage-guide.md","REFERENCE","参考文档",5182,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-metagenomics-kraken\u002Fusage-guide.md",[63,71,78,85,92,99],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":70},"01M7FFFZPC2025JQQHPHDX154J","dei-assessment","Assess diversity, equity, and inclusion with metrics. TRIGGERS - Use when user needs help with dei-assessment related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fdei-assessment\u002FSKILL.md",[],[],"2026-11-16 10:05:34",{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":70},"01M7FFFWN8H4WA7A6Y398QKB6J","dei-action-plan","Create DEI action plans with goals and initiatives. TRIGGERS - Use when user needs help with dei-action-plan related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fdei-action-plan\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":70},"01M7FFFSHTM0QZRVZ2NRJTJ0PY","culture-fit-assessment","Design culture add assessment processes. TRIGGERS - Use when user needs help with culture-fit-assessment related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fculture-fit-assessment\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":70},"01M7FFFMA12RKEQA38KHJSXXPS","cowork-to-code-bridge","Use an already-installed, independently verified cowork-to-code bridge to run narrowly approved actions on the user's own macOS, Linux, or WSL2 machine through a local file queue.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcowork-to-code-bridge\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":70},"01M7FFFH1F6M8YRGW5V487GH1K","counter-offer-response","Draft counter-offer responses for retention. TRIGGERS - Use when user needs help with counter-offer-response related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcounter-offer-response\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":70},"01M7FFFDGEHV8Y7J9N40HZXW52","continuous-feedback-system","Design continuous feedback systems. TRIGGERS - Use when user needs help with continuous-feedback-system related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcontinuous-feedback-system\u002FSKILL.md",[],[]]