Metagenomic Taxonomic Classification
If you need to determine which microbes are present in a complex environmental or clinical sample using shotgun sequencing data, metagenomic taxonomic classification is the key analytical step. This guide is for bioinformatics beginners, graduate students, and bench scientists who have sequenced a metagenome and need a practical, source bounded framework to choose a classifier, run the analysis, and interpret results without overstating certainty.
At a Glance
| Concept | Key Point | Common Tool |
|---|---|---|
| Reference database | The curated collection of genomes used for comparison | NCBI RefSeq, GTDB |
| Classifier algorithm | The method for assigning reads or contigs to taxa | Kraken 2, MetaPhlAn, Centrifuge |
| Read versus contig based | Sequencing reads (short) or assembled contigs (longer) | Reads: fast but less specific, contigs: more specific but need assembly |
| Abundance profile | Relative proportion of each taxon in the sample | Bracken for Kraken output, MetaPhlAn built in |
| Evaluation metrics | Precision, recall, or F1 score on mock communities | CAMI benchmarks, custom synthetic datasets |
Core Concepts and Decision Points
Taxonomic classification assigns sequence fragments to nodes in a taxonomic tree, typically from kingdom down to species or strain. The choice of reference database is the first critical decision because classification can only identify organisms whose genomes (or markers) are present in the database. The NCBI Bookshelf provides authoritative descriptions of how reference databases are built and maintained source: NCBI Bookshelf. For comprehensive environmental samples, a database like GTDB (Genome Taxonomy Database) may offer broader coverage than NCBI RefSeq.
The algorithm determines speed and accuracy. K mer based classifiers like Kraken 2 compare exact subsequences of length k against a hash table of k mers from reference genomes. This is fast but can misassign reads that have shared k mers across distant taxa. Marker gene classifiers like MetaPhlAn use a panel of clade specific marker genes and report relative abundances based on read coverage. For a detailed comparison of algorithms, the Galaxy Training Network offers a practical tutorial that runs Kraken 2 and MetaPhlAn on the same dataset and evaluates the differences source: Galaxy Training Network.
You must decide whether to classify raw reads or assembled contigs. Reads are easier to process but provide less discriminatory power for closely related species. Contigs are longer and contain more unique information, but assembly can miss low abundance organisms. In many studies, classifying both read and contig level results and then reconciling them is a robust approach.
Practical Workflow
Implement a systematic workflow that starts with quality control and ends with a profile table. The outline below mirrors steps taught in EMBL EBI training materials on metagenomics source: EMBL EBI Training.
Download raw sequencing data from the NCBI Sequence Read Archive or your sequencer source: NCBI Sequence Read Archive. Ensure you have paired end reads and sufficient depth (typically 10 to 50 million reads for a microbial community).
Run quality control with FastQC and trim adapters with Trimmomatic or fastp. Remove low quality bases and short reads. This step prevents spurious k mer matches.
If using a read based classifier, run Kraken 2 with your chosen database. For a typical human gut or soil sample, the standard Kraken 2 database built from RefSeq is adequate. Use Bracken to estimate species abundance from the Kraken report.
If using a marker gene classifier, run MetaPhlAn 4 (which integrates the ChocoPhlAn database). This will directly output a relative abundance table.
For assembled contig classification, first assemble reads with MEGAHIT or metaSPAdes, then classify contigs with Kraken 2 or Centrifuge. Filter out contigs shorter than 1000 bp to reduce false positives.
Combine results into a single table of per sample abundances. Normalize counts by genome length and sequencing depth if comparing across samples.
Perform post classification quality checks as described below.
Bioconductor offers R packages for downstream analysis such as phyloseq and mia source: Bioconductor. These packages import abundance tables and taxonomic assignments for plotting and statistical testing.
Quality Checks
Validate your classification results with at least three checks. First, include a positive control sample (a mock community with known composition) in your sequencing run. Compare the observed profile to the expected one. Second, check for contamination from reagents or previous runs by analyzing a negative control (pure water or extraction blank). Third, examine the fraction of unclassified reads. A high proportion of unclassified reads (more than 50 percent) suggests your database lacks representation of the target community or that sequencing quality is poor.
You can also compare results from two different classifiers. For example, run both Kraken 2 and MetaPhlAn on the same sample. If they agree on abundant taxa, confidence increases. Discrepancies often arise for low abundance organisms or clades with incomplete reference genomes.
Use the NCBI Bookshelf section on metagenomic sequence analysis to understand how to interpret false positive assignments introduced by horizontal gene transfer or conserved regions source: NCBI Bookshelf. In particular, read through the discussion of the limitations of k mer based classification for regions that are conserved across domains.
Common Mistakes
A frequent error is using an outdated reference database. Databases are updated several times a year, using an old version can miss newly sequenced strains or misclassify them. Always download the latest database or use a version pinned for reproducibility.
Another mistake is assuming that classification to species level is always valid. Many classifiers report species level assignments even when the read evidence supports only genus or family. Use abundance filters (e.g., require at least 10 reads or 0.1 percent abundance) to reduce spurious species calls.
Do not ignore the impact of library preparation. In vaginal microbiota studies, as reported in J Vet Res, the choice of DNA extraction method and primer bias in 16S amplicon approaches can skew taxonomic profiles source: PubMed 42441094. For shotgun metagenomics, extraction bias is smaller but still present, especially for gram positive bacteria with tough cell walls.
Some users treat all unclassified reads as noise. In reality, they may represent viruses, novel bacteria, or host DNA. For viral metagenomes, as observed in a study of Heterosigma akashiwo virus, standard bacterial databases will not classify most reads source: PubMed 42437978. Use a dedicated viral database for such samples.
Limits of Interpretation
Metagenomic taxonomic classification is not a census. It provides a relative abundance estimate that is influenced by genome length, copy number of marker genes, and sequencing bias. For example, in wastewater studies from the Western Himalayas, researchers found differences between culture based counts and metagenomic profiles for the same sample source: PubMed 42435095. Do not treat metagenomic abundances as absolute.
Strain level resolution is limited because most classifiers rely on reference genomes that may not include all strains present. Novel strains will be classified to the closest reference species at best. Metagenome assembled genomes (MAGs) can improve resolution, but they require assembly and binning steps. A study on post wildfire soil bacteria recovered high quality MAGs using a combination of assembly and binning tools source: PubMed 42430137. Yet MAGs can still be chimeric or incomplete.
Horizontal gene transfer can cause false positives. A sequence from a bacterium might be assigned to a distantly related taxon because it contains a plasmid or transposon. Filtering by coverage breadth (e.g., requiring at least 80 percent of the genome to be covered by reads) can reduce this issue, but it requires you to map reads back to classified genomes.
Finally, taxonomic classification does not imply functional capability. Two species in the same genus may have very different metabolic pathways. For function, you need functional annotation of reads or contigs, which is a separate step.
Frequently Asked Questions
1. What reference database should I use for a soil metagenome? For soil samples, use the GTDB database or the NCBI nt database. The standard Kraken 2 database built from RefSeq may miss many uncultured soil bacteria. You can also build a custom database from genomes of soil isolates from the literature.
2. How many reads do I need for reliable species level classification? For microbial communities with even distribution, 5 million reads per sample often suffices for abundant species (above 1 percent). For rare species or for strain level resolution, aim for 20 to 50 million reads. Pilot tests with rarefaction curves can guide your depth.
3. Can I classify amplicon sequences like 16S rRNA with the same tools? Yes, but you will need a specific 16S database and should use a dedicated tool like QIIME 2 or mothur instead of Kraken 2. Kraken 2 can classify 16S reads, but its database includes bacterial genomes not just 16S genes, leading to inflated false positives.
4. Why does my classifier report many unclassified reads? Common causes include host DNA contamination (remove human reads with tools like BMTagger), low sequencing quality, novel organisms not in the database, or viral sequences. Check the base quality of unclassified reads and try a different database.
References and Further Reading
- NCBI Bookshelf: An Introduction to Metagenomics
- EMBL EBI Training: Metagenomics
- [Galaxy Training Network: Metagenomic taxonomic profiling](https://training.galaxyproject.org/training material/topics/metagenomics/)
- Bioconductor: phyloseq package
- NCBI Sequence Read Archive: submitting and retrieving data
- Metagenomic analysis of the vaginal microbiota in cows with ovarian cysts
- Wastewater associated antibiotic resistance in Western Himalayas
- Post wildfire soil bacterial MAGs and metagenome analysis
- Rapid diversification of Heterosigma akashiwo virus