Metagenomics Fundamentals

Lesson 13 of 13 · 12 min

Wrap-Up and Where to Go Next

You have gone from a raw FASTQ file to a table of who is present in a community and what those organisms can do. This lesson steps back to review that whole path and then points you toward the techniques that take a metagenomics study further. Treat it as a map for planning your own analyses rather than as new material to memorize.

From Sample To Insight

The read-based route you learned starts with quality control and adapter trimming, then strips host or contaminant reads before any profiling. Taxonomic profiling assigns reads to taxa, and from those abundances you compute alpha diversity within samples and beta diversity between them. Functional profiling maps reads to gene families and pathways so you can ask what a community does, not only who is in it.

text
FASTQ reads
  |-- fastp              quality + adapter trimming
  |-- bowtie2 / hostile  remove host reads
  |-- Kraken2 + Bracken  taxonomic profiling (who is there)
  |-- alpha / beta div   vegan, scikit-bio
  |-- HUMAnN             functional profiling -> UniRef, MetaCyc
  '-- 16S amplicon route dada2 denoise vs SILVA reference

Assembly And MAGs

bash
# 1. Assemble quality-filtered reads into contigs
metaspades.py -1 sample_R1.clean.fastq.gz -2 sample_R2.clean.fastq.gz \
  -o assembly -t 16 -m 120

# 2. Map reads back to contigs to estimate per-contig coverage
bwa-mem2 index assembly/contigs.fasta
bwa-mem2 mem -t 16 assembly/contigs.fasta \
  sample_R1.clean.fastq.gz sample_R2.clean.fastq.gz \
  | samtools sort -@ 16 -o sample.sorted.bam
samtools index sample.sorted.bam

# 3. Bin contigs into MAGs with MetaBAT2
jgi_summarize_bam_contig_depths --outputDepth depth.txt sample.sorted.bam
metabat2 -i assembly/contigs.fasta -a depth.txt -o bins/bin -t 16 -m 1500

# 4. Assess bin quality (completeness and contamination)
checkm lineage_wf -x fa -t 16 bins/ checkm_out

# 5. Assign genome taxonomy against GTDB
gtdbtk classify_wf --genome_dir bins/ --extension fa \
  --out_dir gtdbtk_out --cpus 16
Bin Id   Marker lineage       # markers   Completeness   Contamination   Strain het.
bin.1    o__Bacteroidales     421         98.21          0.87            0.00
bin.2    f__Lachnospiraceae   326         92.44          1.53            12.50
bin.3    k__Bacteria          104         61.08          3.19            40.00

# High-quality MAG rule of thumb: >90% complete, <5% contamination (bin.1, bin.2)

Advanced Directions

Read-based and MAG workflows both tend to stop at the species level, but many biological questions live below it. Strain-level tools such as inStrain and StrainPhlAn track single-nucleotide variants across samples so you can tell one strain of a species from another. Longitudinal designs then follow those strains and whole-community shifts over time, and multi-omics integration pairs your metagenome with metatranscriptomics, metaproteomics, or metabolomics to connect genetic potential with actual activity.

Reproducible Workflows

bash
# nf-core/mag runs QC, assembly, binning, CheckM and GTDB-Tk as one pinned pipeline
nextflow run nf-core/mag -r 3.0.3 -profile docker \
  --input samplesheet.csv \
  --outdir results

# Prefer to build your own? Snakemake pins the same tools and conda
# environments in a Snakefile so a collaborator can rerun the analysis exactly.
snakemake --software-deployment-method conda --cores 16 -s Snakefile

Try it yourself: Draft a one-page plan for a metagenomics study of your own using this checklist. State the question and hypothesis; choose read-based profiling or assembly plus MAGs; set sequencing depth and the number of biological replicates; add negative controls and DNA extraction blanks; pick reference databases (SILVA for rRNA, GTDB for genome taxonomy, UniRef for gene function); record structured sample metadata; estimate compute and storage; and pin every tool version behind Snakemake or nf-core/mag so the work is reproducible. To keep learning, follow the nf-core community, read the metaSPAdes, MetaBAT2, CheckM and GTDB-Tk papers, and rerun this pipeline on a public dataset from a study you admire.