<p>If you've got a fast solid state drive with &gt;200G of space, then kraken2 + bracken works really well on both long and short reads (e.g. Nanopore, Illumina). It's also specifically designed for metagenomic analysis, unlike other general aligners like STAR, bwa, bowtie2, etc., so you get tree-based classification which can deal with partial / incomplete matches.</p>
<p>First, use <a href="https://github.com/DerrickWood/kraken2/wiki" rel="nofollow noreferrer">kraken2</a> to map reads to taxa in memory-mapped mode (to reduce system memory consumption):</p>
<p>$ kraken2 --threads 10 --db /mnt/ultra_fast/kraken/metagenome --quick --memory-mapping reads/*.fastq.gz --report kraken2.report.txt &gt; kraken2.out.txt</p>
<p>Then, use <a href="https://ccb.jhu.edu/software/bracken/index.shtml" rel="nofollow noreferrer">bracken</a> to adjust the counts based on mapping / library probabilities:</p>
<p>$ ~/install/bracken/bracken -d /mnt/ultra_fast/kraken/metagenome -i kraken2.report.txt -o bracken.report.txt</p>
<p>I use <a href="https://hub.docker.com/r/florianbw/pavian" rel="nofollow noreferrer">pavian</a> to look at the results, because it creates quite understandable Sankey plots:</p>
<p><a href="https://i.sstatic.net/N3fxT.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/N3fxT.png" alt="Sankey plot showing metagenomic sequencing results. The three most abundant organisms are Escherichia coli, Shigella flexneri, and Salmonella enterica" /></a></p>
<p>But inspecting the <code>_bracken_species.txt</code> file is a pretty good text-based way to do it. If there's substantial amounts of a particular bacteria in the sample, it should come out in the results:</p>
<pre><code>100.00  232939  0       R       1       root
99.99   232912  0       R1      131567    cellular organisms
68.52   159618  0       D       2           Bacteria
67.67   157635  0       P       1224          Proteobacteria
67.47   157152  0       C       1236            Gammaproteobacteria
61.82   144001  0       O       91347             Enterobacterales
61.79   143941  0       F       543                 Enterobacteriaceae
32.28   75183   0       G       561                   Escherichia
32.26   75147   75147   S       562                     Escherichia coli
0.02    35      35      S       1499973                 Escherichia marmotae
0.00    1       1       S       564                     Escherichia fergusonii
</code></pre>
<p>kraken2/bracken indexes can be downloaded from here (the build process takes <em>ages</em>; it makes more sense to use the pre-built indexes):</p>
<p><a href="https://benlangmead.github.io/aws-indexes/k2" rel="nofollow noreferrer">https://benlangmead.github.io/aws-indexes/k2</a></p>
<p>As far as I'm aware, kraken2 can't do strain-level assignment with the most commonly-used databases (although that may depend on what information that is stored in the database). For strain-level assignment, it seems like MetaMaps may work:</p>
<p><a href="https://doi.org/10.1038/s41467-019-10934-2" rel="nofollow noreferrer">https://doi.org/10.1038/s41467-019-10934-2</a></p>

CC BY-SA 4.0
2023-02-10T17:35:49.917Z
Very nice, not possible to classify at strain resolution I guess?
Chris_Rands
CC BY-SA 4.0
2023-02-10T19:46:09.613Z
Not as far as I'm aware; you could try [metamaps](https://doi.org/10.1038/s41467-019-10934-2), but I have no experience with that.
gringer
CC BY-SA 4.0
2023-02-11T13:39:32.637Z
If you have bracken data from multiple samples and you’d like to compare them with relative abundance stacked bar plots, I made a shiny app for that: https://github.com/acvill/bracken_plot
acvill
CC BY-SA 4.0
2023-02-11T13:45:57.710Z
Also, I believe taxonomic level `S1` represents sub-species (strain) classification. Here are some [example bracken output files representing different taxonomic levels](https://github.com/acvill/bracken_plot/tree/main/example_data_bracken), including`S1`.
acvill
CC BY-SA 4.0
2023-02-13T02:26:17.240Z
Cool question and answer ... thanks. Also thanks to @acvil
M__
CC BY-SA 4.0
2023-02-10T11:41:16.477Z
2023-02-13T00:31:24.760Z
2023-02-13T00:31:24.760Z
gringer
<p><em>[this question is based on a question that was asked on <a href="https://www.reddit.com/r/bioinformatics/comments/10y0bd4/fastest_way_to_check_e_coli_contamination_levels/" rel="nofollow noreferrer">Reddit</a>]</em></p>
<p>I have sequenced some [mostly cell-free] DNA from a sputum sample on a nanopore sequencing machine, and would like to know what is in it (i.e. the proportion of different bacteria). The run produced 2 million reads with an average read length of about 200bp.</p>
<p>What's the best way to go about doing a metagenomic classification of sequenced reads?</p>

<sequence-analysis><nanopore><metagenome><illumina>
How do I measure the proportion of different bacteria in a sample from a high-throughput sequencer?
# How do I measure the proportion of different bacteria in a sample from a high-throughput sequencer?

(Asked by: username_0 on 2023-02-10)

*[this question is based on a question that was asked on [Reddit](https://www.reddit.com/r/bioinformatics/comments/10y0bd4/fastest_way_to_check_e_coli_contamination_levels/)]*

I have sequenced some [mostly cell-free] DNA from a sputum sample on a nanopore sequencing machine, and would like to know what is in it (i.e. the proportion of different bacteria). The run produced 2 million reads with an average read length of about 200bp.

What's the best way to go about doing a metagenomic classification of sequenced reads?

**Tags:** sequence-analysis, nanopore, metagenome, illumina

---

## 1 answers

### Answer by username_0 on 2023-02-10. Score: 4

If you've got a fast solid state drive with >200G of space, then kraken2 + bracken works really well on both long and short reads (e.g. Nanopore, Illumina). It's also specifically designed for metagenomic analysis, unlike other general aligners like STAR, bwa, bowtie2, etc., so you get tree-based classification which can deal with partial / incomplete matches.
First, use kraken2 to map reads to taxa in memory-mapped mode (to reduce system memory consumption):
$ kraken2 --threads 10 --db /mnt/ultra_fast/kraken/metagenome --quick --memory-mapping reads/*.fastq.gz --report kraken2.report.txt > kraken2.out.txt
Then, use bracken to adjust the counts based on mapping / library probabilities:
$ ~/install/bracken/bracken -d /mnt/ultra_fast/kraken/metagenome -i kraken2.report.txt -o bracken.report.txt
I use pavian to look at the results, because it creates quite understandable Sankey plots:

But inspecting the _bracken_species.txt file is a pretty good text-based way to do it. If there's substantial amounts of a particular bacteria in the sample, it should come out in the results:
100.00  232939  0       R       1       root
99.99   232912  0       R1      131567    cellular organisms
68.52   159618  0       D       2           Bacteria
67.67   157635  0       P       1224          Proteobacteria
67.47   157152  0       C       1236            Gammaproteobacteria
61.82   144001  0       O       91347             Enterobacterales
61.79   143941  0       F       543                 Enterobacteriaceae
32.28   75183   0       G       561                   Escherichia
32.26   75147   75147   S       562                     Escherichia coli
0.02    35      35      S       1499973                 Escherichia marmotae
0.00    1       1       S       564                     Escherichia fergusonii

kraken2/bracken indexes can be downloaded from here (the build process takes ages; it makes more sense to use the pre-built indexes):
https://benlangmead.github.io/aws-indexes/k2
As far as I'm aware, kraken2 can't do strain-level assignment with the most commonly-used databases (although that may depend on what information that is stored in the database). For strain-level assignment, it seems like MetaMaps may work:
https://doi.org/10.1038/s41467-019-10934-2

> **Comments:**
> **username_1**: Very nice, not possible to classify at strain resolution I guess?  
> **username_0**: Not as far as I'm aware; you could try [metamaps](https://doi.org/10.1038/s41467-019-10934-2), but I have no experience with that.  
> **username_2**: If you have bracken data from multiple samples and you’d like to compare them with relative abundance stacked bar plots, I made a shiny app for that: https://github.com/acvill/bracken_plot  
> **username_2**: Also, I believe taxonomic level `S1` represents sub-species (strain) classification. Here are some [example bracken output files representing different taxonomic levels](https://github.com/acvill/bracken_plot/tree/main/example_data_bracken), including`S1`.  
> **username_3**: Cool question and answer ... thanks. Also thanks to @acvil  

---

