๐Ÿงฌ QIIME 2

QIIME 2 Master Learning Lab

Interactive End-to-End Microbiome Amplicon & Shotgun Workflow

๐Ÿ” โŒ˜K
๐ŸŽ›๏ธ Master Study Parameter Hub
๐ŸŽฏ Quick Hypervariable Region & Marker Selector:
Auto-configures Primers, Amplicon Lengths, DADA2 Truncations & Classifiers
๐Ÿงฌ Target Biology & Hypervariable Region
๐Ÿ–ฅ๏ธ Platform & Data Format
โœ‚๏ธ DADA2 QC & Truncations
๐Ÿ“Š Study Design & Statistics
๐Ÿ’ก Changes propagate in real-time across all 15+ tool and command cards.

๐Ÿงฎ Interactive DADA2 Truncation & Overlap Calculator

๐Ÿงฎ DADA2 Overlap: Functions, Process & Need โœ•
๐ŸŽฏ Why This Calculator Is Critical

The #1 most common error in 16S paired-end pipelines is losing 70% to 100% of sequencing reads during DADA2 merging. This occurs when users truncate reads too aggressively at the 3' end, leaving less than the required 12-20 bp overlap between forward and reverse reads.

When reads cannot merge, DADA2 silently discards them, resulting in empty or near-empty feature tables!

โš™๏ธ Mathematical Formula & Parameters
  • Target Amplicon Length: Total biological base pairs between primers (e.g. 253 bp for V4 515F-806R, ~460 bp for V3-V4).
  • Forward / Reverse Read Length: The sequencing run cycle length (e.g. 250 bp on MiSeq 2x250).
  • Truncation Formula:
    Effective Overlap = (trunc-len-f - trim-left-f) + (trunc-len-r - trim-left-r) - amplicon_len
  • Safety Rule: Ensure Effective Overlap is ≥ 20 bp. If < 12 bp, DADA2 cannot merge reads.
๐Ÿ”„ The QIIME 2 Workflow Process
  1. Step 1: Inspect your demux-summary.qzv quality score boxplots to find where median quality drops below Q30.
  2. Step 2: Test your candidate truncation values in this calculator to confirm positive overlap ≥ 20 bp.
  3. Step 3: Input those exact values into Section 5 (qiime dada2 denoise-paired) via --p-trunc-len-f and --p-trunc-len-r.
Ensure your forward and reverse reads will successfully merge after quality truncation before running DADA2. (A minimum of 20bp overlap is strongly recommended).
Presets:

๐Ÿ“Š Rarefaction Depth Advisor

๐Ÿ“Š Rarefaction: Functions, Process & Need โœ•
๐ŸŽฏ Why Rarefaction Is Needed

Microbial diversity metrics (richness, Shannon, UniFrac) are highly sensitive to sequencing library size. A sample sequenced to 50,000 reads will artificially appear to contain far more rare species than one with 3,000 reads simply due to sequencing effort.

Rarefaction standardizes all samples by subsampling reads without replacement to an even depth (--p-sampling-depth). Any samples with fewer reads than this cutoff are completely dropped from analysis.

โš™๏ธ Finding The Optimal Trade-off
  • Too Low Depth: Retains 100% of samples, but fails to capture rare community members, reducing taxonomic and phylogenetic resolution.
  • Too High Depth: Maximizes diversity resolution, but discards valuable biological samples that had lower library yield.
  • Recommended Target: Pick a depth where alpha rarefaction curves (alpha-rarefaction.qzv) have plateaued, while losing ≤ 10% of samples.
๐Ÿ”„ The QIIME 2 Workflow Process
  1. Step 1: Run qiime feature-table summarize and inspect table.qzv at view.qiime2.org to get sample depth percentiles.
  2. Step 2: Enter your minimum and median depths here to evaluate the trade-off.
  3. Step 3: Pass this recommended value to Section 10: qiime diversity core-metrics-phylogenetic --p-sampling-depth <value>.
Enter your sample read depth statistics (from qiime feature-table summarize) to get a recommended sampling depth for diversity analysis.

๐Ÿ“ฆ Interactive FASTQ Manifest Generator

๐Ÿ“ฆ FASTQ Manifest: Functions, Process & Need โœ•
๐ŸŽฏ Why You Need a Manifest in QIIME 2

High-throughput sequencing datasets consist of dozens or hundreds of raw .fastq.gz files. QIIME 2 does not ingest loose folders of files via ambiguous wildcards. Instead, it enforces reproducibility by requiring an authoritative Manifest TSV file that explicitly links each sample identifier to its exact file paths on disk.

Why Hand-Crafting Fails: Manually editing manifest files in spreadsheet tools (like Excel) is the single most common cause of early pipeline crashes. Excel frequently converts tabs into spaces, injects invisible Windows carriage-return characters (\r\n), or truncates sample IDs. This tool outputs a strictly compliant, Unix-encoded (LF) tab-separated manifest.

โš™๏ธ Functions & Inputs Explained
  • Layout Type: Switches between Paired-End (generates 3 columns: sample-id, forward-absolute-filepath, reverse-absolute-filepath under format PairedEndFastqManifestPhred33V2) and Single-End (generates 2 columns for SingleEndFastqManifestPhred33V2).
  • Base Directory Absolute Path: The exact folder on your server or machine where your FASTQs live (e.g. $PWD/raw_fastq or /home/user/project/fastqs). QIIME 2 strictly demands absolute paths so that analysis scripts remain reproducible from any working directory.
  • Filename Extension: File extension pattern (e.g. .fastq.gz or .fq.gz). The generator automatically builds forward (_R1) and reverse (_R2) file names.
  • Sample IDs Textarea: Paste your sample IDs here (one per line, comma-separated, or space-separated). The generator instantly extracts and formats them.
  • Generate Manifest: Compiles and displays the formatted tab-delimited text in the live preview box.
  • Load Example: Injects a standard reference 3-sample mock dataset so you can immediately see the expected structure.
  • โฌ‡ Download manifest.tsv: Exports a clean, UTF-8 tab-separated file with Unix line endings ready for terminal input.
  • Manifest Output Preview: Real-time display showing the exact tab-separated text that will be fed into QIIME 2.
๐Ÿ”„ The QIIME 2 Workflow Process
  1. Step 1 (Generate & Save): Use this generator to export manifest.tsv directly into your study workspace.
  2. Step 2 (Import Command): In terminal, pass the manifest to qiime tools import:
    qiime tools import \
      --type 'SampleData[PairedEndSequencesWithQuality]' \
      --input-path manifest.tsv \
      --output-path demux-paired.qza \
      --input-format PairedEndFastqManifestPhred33V2
  3. Step 3 (Artifact Generation): QIIME 2 reads the manifest, verifies file existence and Phred score integrity, bundles all reads into a single compressed demux-paired.qza artifact, and initializes the immutable cryptographic provenance graph.
Generate a standard QIIME 2 manifest file (PairedEndFastqManifestPhred33V2 or SingleEndFastqManifestPhred33V2) in seconds.
๐Ÿ“ Auto-Detect from Local FASTQ Files:
Select your FASTQ files from disk to automatically extract Sample IDs, detect paired vs single reads, and detect file naming patterns!
โ–ถ Alternative: Generate Manifest Directly in Linux Terminal (1-Line Bash Script)

If your FASTQ files are stored on a remote HPC cluster, cloud instance, or Linux workstation, you don't even need to type them into a web form! Navigate to your FASTQ folder in terminal and execute this 1-line bash script:

# Run inside your FASTQ directory:
echo -e "sample-id\tforward-absolute-filepath\treverse-absolute-filepath" > manifest.tsv
for f in *_R1*.fastq.gz; do
  s="${f%%_R1*}"
  r="${f/_R1/_R2}"
  echo -e "${s}\t${PWD}/${f}\t${PWD}/${r}" >> manifest.tsv
done
echo "Manifest generated with $(wc -l < manifest.tsv) lines!"

This loop automatically reads your actual filenames on disk, captures your current working directory ($PWD), pairs forward and reverse reads, and writes a valid manifest.tsv instantaneously.

๐Ÿงพ Sample Metadata Builder (#q2:types Compliant)

๐Ÿงพ Sample Metadata: Functions, Process & Need โœ•
๐ŸŽฏ Why You Need Sample Metadata in QIIME 2

Sequencing data without metadata is biologically meaningless. Metadata provides the biological and experimental context for every single sample (e.g., treatment vs control, body site, host phenotype, timepoint, pH, temperature).

Where Metadata is Used: Every statistical and visual tool in QIIME 2 relies on metadata: coloring Emperor 3D PCoA ordination plots, calculating group differences with PERMANOVA (beta-group-significance), comparing alpha diversity (alpha-group-significance), and identifying differentially abundant microbes with ANCOM-BC.

The Critical #q2:types Directive: When this second header row is omitted, QIIME 2 guesses column types automatically. This often fails: a numeric timepoint column (0, 1, 2) gets parsed as a continuous regression slope rather than discrete categorical test groups, or missing values (NA) cause numeric measurements to be downgraded to strings. This builder automatically inserts #q2:types with correct categorical and numeric declarations.

โš™๏ธ Functions & Fields Explained
  • Sample ID (Mandatory): The unique identifier for each sample. Must match the exact sample-ids in your FASTQ manifest. Cannot contain whitespace or forbidden characters.
  • Treatment Group (categorical): Your primary biological experimental condition (e.g. Control, DrugA, WildType). Used for ANCOM-BC comparisons and PERMANOVA.
  • Body Site (categorical): Anatomical location or ecological habitat (e.g. gut, soil, saliva). Crucial for multi-factor stratification.
  • Subject / Host ID (categorical): Individual host or patient tag (e.g. SubjectA, Mouse_01). Essential for repeated-measures and longitudinal volatility tracking.
  • Timepoint (numeric / categorical): Sampling interval (e.g. 0, 7, 14). Handled as continuous time in volatility plots or discrete factor in PERMANOVA.
  • pH / Continuous Value (numeric): Quantitative continuous measurements used for environmental gradient analysis and Adonis linear modeling.
  • Batch / Sequencing Run: Technical confounder covariate used to block batch effects and sequencing run bias.
  • ๏ผ‹ Add Sample: Validates input fields and adds the sample row into the live memory table.
  • Load Example Dataset: Injects a complete 4-sample longitudinal trial dataset with controls and treatments.
  • โฌ‡ Download sample-metadata.tsv: Exports a 100% QIIME 2-compliant tab-separated file with the #q2:types directive included.
  • Clear All: Clears all table records to start building a new study from scratch.
๐Ÿ”„ The QIIME 2 Workflow Process
  1. Step 1 (Validate & Tabulate): Run qiime metadata tabulate --m-input-file sample-metadata.tsv --o-visualization metadata.qzv to verify your columns visually at view.qiime2.org.
  2. Step 2 (Core Diversity Integration): Supplied via --m-metadata-file sample-metadata.tsv in qiime diversity core-metrics-phylogenetic to color Emperor 3D PCoA scatter plots.
  3. Step 3 (Hypothesis Testing): Passed to PERMANOVA:
    qiime diversity beta-group-significance \
      --i-distance-matrix core-metrics-results/unweighted_unifrac_distance_matrix.qza \
      --m-metadata-file sample-metadata.tsv \
      --m-metadata-column treatment \
      --o-visualization treatment-significance.qzv
  4. Step 4 (Differential Abundance): Evaluated in ANCOM-BC via qiime composition ancombc --p-formula 'treatment + timepoint'.
Metadata provides context for every sample. QIIME 2 requires strict column rules and optional #q2:types directives (categorical vs numeric).

        

0. QIIME 2 Core Architecture & Semantic Types

Understanding artifacts, visualizations, and the semantic type system is essential before running commands.
Artifacts (.qza) vs Visualizations (.qzv)Core Concept
# Inspect any artifact with peek:
qiime tools peek table.qza

# View any .qzv locally:
qiime tools view table.qzv

# Extract full underlying data (BIOM/FASTA) from artifact:
qiime tools extract \
  --input-path table.qza \
  --output-path extracted-table/
Every .qza and .qzv is a zip file containing biological data, metadata, semantic type definitions, and a complete provenance graph.
Core Semantic Type ReferenceReference
# Common Semantic Types:
SampleData[PairedEndSequencesWithQuality]  # Paired FASTQs
FeatureTable[Frequency]                   # ASV/OTU Count Table
FeatureData[Sequence]                     # Representative ASV Sequences
FeatureData[Taxonomy]                     # Taxonomic Assignments
Phylogeny[Rooted]                         # Rooted Phylogenetic Tree
DistanceMatrix                            # Beta Diversity Matrix
PCoAResults                               # Ordination for 3D Emperor
QIIME 2's semantic type system prevents logical pipeline errors (e.g. attempting to calculate phylogenetic UniFrac on an unrooted tree or feeding non-count data to DADA2).

1. Environment Setup (Conda / Mamba)

Install Conda/Mamba and activate the official QIIME 2 Amplicon or Shotgun distribution.
Install Miniconda & MambaCLI
# Download & install Miniconda
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda3
source $HOME/miniconda3/bin/activate
conda init bash

# Install Mamba for lightning fast environment installs
conda install -n base -c conda-forge mamba -y
Mamba uses a C++ solver that resolves dependencies up to 10x faster than default Conda.
Create & Verify QIIME 2 EnvironmentCLI
# Create environment from official YAML
wget https://data.qiime2.org/distro/amplicon/qiime2-amplicon-2024.10-py310-linux-conda.yml
mamba env create -n qiime2-amplicon --file qiime2-amplicon-2024.10-py310-linux-conda.yml

# Activate environment
conda activate qiime2-amplicon

# Verify installed plugins & versions
qiime info
Always verify installation using qiime info to confirm all plugins (dada2, diversity, feature-classifier, cutadapt, etc.) are available.

2. Data Ingestion & Demultiplexing

๐Ÿ“ฅ Data Ingestion: Functions, Process & Need โœ•
๐ŸŽฏ Why Data Ingestion Is Required

QIIME 2 cannot work directly on loose FASTQ files. Raw sequencing reads must be imported into an immutable QIIME 2 Artifact (.qza) that seals the data with its semantic type, quality encoding (Phred33/64), and a cryptographic provenance tracker.

โš™๏ธ Functions & Parameters
  • --type: Declares what kind of biological data is inside (e.g. SampleData[PairedEndSequencesWithQuality]). Prevents downstream plugins from receiving incorrect data types.
  • --input-path: Points to your manifest.tsv mapping file or raw folder.
  • --input-format: Specifies the format parser (e.g. PairedEndFastqManifestPhred33V2 for modern Illumina).
  • --output-path: Destination .qza artifact file containing your compressed reads.
๐Ÿ”„ The Workflow Process
  1. Generate manifest.tsv mapping sample IDs to FASTQs.
  2. Run qiime tools import.
  3. Verify output by running qiime demux summarize to inspect quality curves.
Import raw sequencing data from FASTQs or multiplexed files into QIIME 2 artifacts.
Import FASTQs with qiime tools importImport
โš™๏ธ Customize Import Parameters: LIVE UPDATER
qiime tools import \
  --type 'SampleData[PairedEndSequencesWithQuality]' \
  --input-path manifest.tsv \
  --output-path demux-paired.qza \
  --input-format PairedEndFastqManifestPhred33V2
Interactive command generator: Select your semantic type, manifest path, and output file above to instantly configure the command for your exact sequencing run.
Import Single-End FASTQs (Manifest)Import
qiime tools import \
  --type 'SampleData[SequencesWithQuality]' \
  --input-path manifest-single.tsv \
  --output-path demux-single.qza \
  --input-format SingleEndFastqManifestPhred33V2
For single-end read sets (e.g. Ion Torrent or single-read Illumina).
โšก Side-by-Side Comparison: Single-End vs Paired-End ImportComparison
Single-End Import
qiime tools import \
  --type 'SampleData[SequencesWithQuality]' \
  --input-path manifest.tsv \
  --output-path demux.qza \
  --input-format SingleEndFastqManifestPhred33V2
Paired-End Import
qiime tools import \
  --type 'SampleData[PairedEndSequencesWithQuality]' \
  --input-path manifest.tsv \
  --output-path demux-paired.qza \
  --input-format PairedEndFastqManifestPhred33V2
Notice the semantic type difference: SampleData[SequencesWithQuality] for single-end versus SampleData[PairedEndSequencesWithQuality] for paired-end, matching the manifest format specification.
Demultiplex Earth Microbiome (EMP) Paired ReadsDemux
qiime demux emp-paired \
  --i-seqs emp-paired-end-sequences.qza \
  --m-barcodes-file sample-metadata.tsv \
  --m-barcodes-column barcode-sequence \
  --o-per-sample-sequences demux-paired.qza \
  --o-error-correction-details demux-details.qza
Demultiplexes multiplexed reads based on Golay or custom barcodes in your metadata.

3. Primer & Adapter Removal (q2-cutadapt)

โœ‚๏ธ Cutadapt: Functions, Process & Need โœ•
๐ŸŽฏ Why Primer Trimming Is Essential

PCR primers are synthetic non-biological oligonucleotides. If you leave primers in your reads, DADA2 will mistake primer synthesis errors, degenerate IUPAC wobble bases, and PCR drift for genuine biological mutations, creating thousands of artificial ASVs!

โš™๏ธ Functions & Parameters
  • --p-front-f / --p-front-r: Forward and reverse primer sequences. Use ^ (e.g. ^GTGYCAGC...) to anchor the primer strictly to the 5' beginning of the read.
  • --p-error-rate: Maximum allowable mismatch rate (0.1 = 1 mismatch per 10 bases).
  • --p-minimum-length: Drops artifactual reads that become too short after trimming.
๐Ÿ”„ The Workflow Process
  1. Input demultiplexed reads (demux-paired.qza).
  2. Cutadapt scans the 5' ends and clips matching primer sequences.
  3. Outputs clean trimmed-demux-paired.qza ready for DADA2 error modeling.
Non-biological sequences like PCR primers must be removed prior to DADA2 to avoid erroneous ASVs.
Trim Primers from Paired-End Reads (e.g. 515F / 806R)Cutadaptโฑ 5-15 min
โš™๏ธ Customize Primer Trimming Parameters: LIVE UPDATER
qiime cutadapt trim-paired \
  --i-demultiplexed-sequences demux-paired.qza \
  --p-front-f GTGYCAGCMGCCGCGGTAA \
  --p-front-r GGACTACNVGGGTWTCTAAT \
  --p-error-rate 0.1 \
  --p-minimum-length 100 \
  --o-trimmed-sequences trimmed-demux-paired.qza \
  --verbose
Specify forward (--p-front-f) and reverse (--p-front-r) primers. Use ^ (e.g. ^GTGYCAGC...) to anchor the primer strictly to the 5' start.
โ–ถ Detailed Primer & Trimming Guide

Why trim primers? PCR primers are artificial synthesized oligos. If kept, biological variance algorithms (DADA2) will treat primer synthesis errors or IUPAC degenerate wobbles as novel biological ASVs.

Anchoring (^): Prepending ^ forces matching only at the exact 5' end of the read, preventing internal false-positive trimming.

Common Primer Reference Table:

Target RegionForward Primer (5'โ†’3')Reverse Primer (5'โ†’3')Amplicon Size
16S V4 (EMP standard)515F: GTGYCAGCMGCCGCGGTAA806R: GGACTACNVGGGTWTCTAAT~253 bp
16S V3-V4341F: CCTACGGGNGGCWGCAG805R: GACTACHVGGGTATCTAATCC~460 bp
Full-Length 16S (PacBio)27F: AGRGTTYGATYMTGGCTCAG1492R: RGYTACCTTGTTACGACTT~1465 bp
Fungal ITS1 / ITS2ITS1F: CTTGGTCATTTAGAGGAAGTAAITS4: TCCTCCGCTTATTGATATGCVariable (~300-600 bp)

4. Read Quality Inspection (demux summarize)

Evaluate base quality distributions (Phred Q-scores) to pick informed DADA2 truncation lengths.
Summarize Quality & Read CountsVisualizer
qiime demux summarize \
  --i-data trimmed-demux-paired.qza \
  --o-visualization demux-summary.qzv

# View visualization in browser
qiime tools view demux-summary.qzv
Open demux-summary.qzv at view.qiime2.org to inspect Interactive Quality Plots. Look for the position where median quality drops below Q25-Q30.

5. DADA2 Denoising (Exact ASV Resolution)

๐Ÿ”ฌ DADA2: Functions, Process & Need โœ•
๐ŸŽฏ Why DADA2 Replaced 97% OTUs

Traditional OTU clustering lumped sequences into 97% similarity buckets, masking true biological strain variation. DADA2 constructs an empirical error model of Illumina sequencing chemistry to resolve exact, single-nucleotide differences, outputting true Amplicon Sequence Variants (ASVs).

โš™๏ธ Functions & Parameters
  • --p-trunc-len-f / -r: Truncates reads at the 3' position where quality drops. Must preserve ≥ 20 bp overlap for merging!
  • --p-trim-left-f / -r: Trims low-quality bases from the 5' beginning. Set to 0 if Cutadapt already removed primers.
  • --p-max-ee-f / -r: Discards reads with higher expected errors than cutoff (default 2.0).
  • --p-n-threads: Number of parallel CPU threads to accelerate compute time.
๐Ÿ”„ The Workflow Process
  1. Filters low-quality reads and learns run-specific error models.
  2. Denoises forward and reverse reads independently.
  3. Merges paired reads with minimum 12-20 bp overlap.
  4. Identifies and removes bimeras/chimeras, outputting table.qza (counts), rep-seqs.qza (FASTA), and denoising-stats.qza.
DADA2 models Illumina error rates, corrects point errors, merges paired reads, and removes chimeras to output Amplicon Sequence Variants.
DADA2 Paired-End DenoisingDADA2โฑ 10-60 min๐Ÿ’พ 4-16 GB
โš™๏ธ Customize DADA2 Denoising Parameters: LIVE UPDATER
qiime dada2 denoise-paired \
  --i-demultiplexed-seqs trimmed-demux-paired.qza \
  --p-trim-left-f 0 \
  --p-trim-left-r 0 \
  --p-trunc-len-f 240 \
  --p-trunc-len-r 200 \
  --p-n-threads 8 \
  --o-table table.qza \
  --o-representative-sequences rep-seqs.qza \
  --o-denoising-stats denoising-stats.qza
Outputs the ASV count matrix (table.qza), unique sequences (rep-seqs.qza), and denoising metrics (denoising-stats.qza).
โ–ถ Deep-Dive: Key DADA2 Parameters & Tuning

DADA2 Parameter Guidelines:

  • --p-trunc-len-f / --p-trunc-len-r: Truncates reads at the 3' end where quality drops. Must preserve sufficient overlap! Use our DADA2 Calculator to verify: (trunc-f + trunc-r) - amplicon_len ≥ 20 bp.
  • --p-trim-left-f / --p-trim-left-r: Trims low-quality bases from the 5' beginning. Set to 0 if Cutadapt has already removed primers.
  • --p-max-ee-f / --p-max-ee-r: Maximum expected errors allowed (default: 2.0). Reads exceeding this are discarded before error modeling.
  • --p-chimera-method consensus: Chimeras are judged sample-by-sample and consensus is taken across samples (recommended default).
  • --p-n-threads 0 or 8: Set to 0 to utilize all available CPU cores for significant speedups.
โšก Side-by-Side: DADA2 Paired-End vs Single-End ParametersComparison
Paired-End (denoise-paired)
qiime dada2 denoise-paired \
  --i-demultiplexed-seqs demux-paired.qza \
  --p-trim-left-f 0 \
  --p-trim-left-r 0 \
  --p-trunc-len-f 240 \
  --p-trunc-len-r 200 \
  --p-n-threads 8 \
  --o-table table.qza \
  --o-representative-sequences rep-seqs.qza \
  --o-denoising-stats stats.qza
Single-End (denoise-single)
qiime dada2 denoise-single \
  --i-demultiplexed-seqs demux-single.qza \
  --p-trim-left 0 \
  --p-trunc-len 240 \
  --p-n-threads 8 \
  --o-table table.qza \
  --o-representative-sequences rep-seqs.qza \
  --o-denoising-stats stats.qza
Notice that denoise-paired takes separate forward and reverse parameters (-f and -r) and requires overlap merging, whereas denoise-single takes singular --p-trim-left and --p-trunc-len parameters without merging.
Tabulate & Inspect Denoising StatsVisualizer
qiime metadata tabulate \
  --m-input-file denoising-stats.qza \
  --o-visualization denoising-stats.qzv

qiime tools view denoising-stats.qzv
Critical diagnostic step! Check what % of reads passed filtering, denoising, merging, and chimera removal. If merging is low (e.g. <50%), increase truncation lengths.
DADA2 Single-End & PacBio HiFi CCS Full-Length 16SLong-read
# Single-end:
qiime dada2 denoise-single \
  --i-demultiplexed-seqs demux-single.qza \
  --p-trim-left 0 \
  --p-trunc-len 240 \
  --p-n-threads 8 \
  --o-table table.qza \
  --o-representative-sequences rep-seqs.qza \
  --o-denoising-stats denoising-stats.qza

# PacBio CCS (Full-length ~1500bp 16S):
qiime dada2 denoise-ccs \
  --i-demultiplexed-seqs demux-ccs.qza \
  --p-front-f AGRGTTYGATYMTGGCTCAG \
  --p-front-r RGYTACCTTGTTACGACTT \
  --p-min-len 1000 \
  --p-max-len 1600 \
  --o-table table.qza \
  --o-representative-sequences rep-seqs.qza \
  --o-denoising-stats denoising-stats.qza
DADA2-CCS specifically models PacBio circular consensus sequencing error profiles for full-length 16S analysis.

6. Alternative QC: Deblur & VSEARCH (OTU Clustering)

Deblur is a sub-operational taxonomic unit method. VSEARCH provides classic 97% or 99% OTU clustering.
Deblur 16S DenoisingDeblur
qiime quality-filter q-score \
  --i-demux demux-single.qza \
  --o-filtered-sequences demux-filtered.qza \
  --o-filter-stats demux-filter-stats.qza

qiime deblur denoise-16S \
  --i-demultiplexed-seqs demux-filtered.qza \
  --p-trim-length 150 \
  --p-sample-stats \
  --o-representative-sequences deblur-rep-seqs.qza \
  --o-table deblur-table.qza \
  --o-stats deblur-stats.qza
Requires uniform read length (--p-trim-length). Uses static error profiles.
VSEARCH De Novo 97% OTU ClusteringVSEARCH
# 1. Dereplicate sequences
qiime vsearch dereplicate-sequences \
  --i-sequences demux-single.qza \
  --o-dereplicated-table derep-table.qza \
  --o-dereplicated-sequences derep-seqs.qza

# 2. Cluster de novo at 97% identity
qiime vsearch cluster-features-de-novo \
  --i-table derep-table.qza \
  --i-sequences derep-seqs.qza \
  --p-perc-identity 0.97 \
  --o-clustered-table table-97.qza \
  --o-clustered-sequences rep-seqs-97.qza
Classic 97% OTU clustering approach. Note: Modern microbiome literature strongly favors ASVs (DADA2).

๐Ÿ”€ Decision Guide: DADA2 vs Deblur vs VSEARCH

๐Ÿ”€ Denoising Strategy: Functions, Comparison & Need โœ•
๐ŸŽฏ The Core Denoising Dilemma

Microbiome amplicon sequencing produces millions of raw reads corrupted by PCR errors, Illumina base substitution errors, and chimeras. Choosing between DADA2 (ASVs), Deblur (ASVs), and VSEARCH (97% OTUs) determines resolution, cross-study comparability, and computational cost.

โš™๏ธ Algorithm Comparison Breakdown
  • DADA2: Infers exact amplicon sequence variants (ASVs) via a sample-specific error learning model. Joins forward and reverse reads with built-in quality-aware overlap consensus and removes bimeras. Single-nucleotide resolution.
  • Deblur: Uses a static global Illumina error profile. Extremely fast on massive datasets (e.g. 50,000+ samples) but requires all reads to be trimmed to an identical length and operates exclusively on single-end (or pre-joined) reads.
  • VSEARCH 97% OTUs: Collapses sequences differing by โ‰ค3% into operational taxonomic units (OTUs). Blurs microdiversity, hides distinct bacterial strains, but remains useful for meta-analyses integrating legacy 454/pyrosequencing datasets.
  • ITSxpress + DADA2: Required for fungal ITS because ITS variable lengths prevent quality-based truncation. Trims conserved flanking genes (18S/5.8S/28S) before non-truncated DADA2.
๐Ÿ”„ Recommended Decision Workflow
  1. For Illumina standard 16S/18S paired-end data โ†’ Always use DADA2 denoise-paired.
  2. For fungal ITS โ†’ Run ITSxpress then DADA2 with --p-trunc-len-f 0 --p-trunc-len-r 0.
  3. For PacBio HiFi / Nanopore โ†’ Use DADA2 denoise-ccs.
  4. For legacy meta-analysis โ†’ Use VSEARCH 97% OTUs.
Click your experimental parameters below to instantly calculate the recommended denoising strategy with mathematical and biological justification.
Q1 Do you have paired-end or single-end sequencing reads?
Q2 Do you require exact sequence variants (ASVs) or legacy 97% OTUs?
Q3 Sequencing Platform & Read Length Type?
Q4 Target Genetic Marker & Biological Group?
๐ŸŽฏ Computed Strategy & Action Plan
qiime dada2 denoise-paired ...

7. Feature Table & Representative Sequences

๐Ÿ“Š Feature Table: Functions, Process & Need โœ•
๐ŸŽฏ The Foundation of Downstream Analysis

The feature table (table.qza) is an $M \times N$ matrix of observation counts ($M$ samples by $N$ biological ASVs). Along with representative sequences (rep-seqs.qza), it is the direct input for taxonomy, phylogeny, alpha/beta diversity, and differential abundance.

โš™๏ธ Functions & Key Utilities
  • feature-table summarize: Generates table.qzv, showing sequencing depth percentiles, sample counts, and feature frequencies.
  • tabulate-seqs: Generates rep-seqs.qzv with direct 1-click NCBI BLAST links for every ASV.
  • filter-samples: Removes low-depth samples or selects subsets using SQL metadata queries (--p-where).
  • filter-features: Removes singletons or rare noise features.
๐Ÿ”„ The Workflow Process
  1. Inspect table.qzv to verify minimum, median, and maximum read depths.
  2. Filter out samples with inadequate reads using filter-samples.
  3. Pass the curated table forward to phylogeny and diversity pipelines.
Summarize sequencing depth per sample, tabulate ASV sequences with NCBI BLAST links, and filter unwanted data.
Summarize Table & Tabulate SequencesVisualizer
# Summarize feature table (depths, sample counts, feature frequencies)
qiime feature-table summarize \
  --i-table table.qza \
  --o-visualization table.qzv \
  --m-sample-metadata-file sample-metadata.tsv

# Tabulate representative sequences (interactive BLAST NCBI search)
qiime feature-table tabulate-seqs \
  --i-data rep-seqs.qza \
  --o-visualization rep-seqs.qzv
table.qzv reveals the minimum and median sample depths needed to choose the rarefaction threshold for diversity analysis.
Filter Samples & Features (SQL Metadata Queries)Filter
โš™๏ธ Customize Filtering Parameters & Metadata Query: LIVE UPDATER
# 1. Filter low depth samples (< 2000 reads)
qiime feature-table filter-samples \
  --i-table table.qza \
  --p-min-frequency 2000 \
  --o-filtered-table table-filtered-depth.qza

# 2. Filter samples by metadata condition (e.g. body-site = 'gut')
qiime feature-table filter-samples \
  --i-table table.qza \
  --m-metadata-file sample-metadata.tsv \
  --p-where "[body-site]='gut'" \
  --o-filtered-table table-gut.qza

# 3. Filter out singletons / rare ASVs
qiime feature-table filter-features \
  --i-table table.qza \
  --p-min-samples 2 \
  --p-min-frequency 10 \
  --o-filtered-table table-filtered-features.qza
Allows complex SQL queries in --p-where such as "[treatment]='Drug' AND [timepoint] > 0".

8. Phylogenetic Reconstruction (MAFFT & FastTree / SEPP)

Phylogenetic trees are required for UniFrac beta diversity and Faith's Phylogenetic Diversity (PD).
All-in-One: MAFFT Alignment + Masking + FastTree + Midpoint RootingPhylogenyโฑ 5-30 min
qiime phylogeny align-to-tree-mafft-fasttree \
  --i-sequences rep-seqs.qza \
  --p-n-threads 8 \
  --o-alignment aligned-rep-seqs.qza \
  --o-masked-alignment masked-aligned-rep-seqs.qza \
  --o-tree unrooted-tree.qza \
  --o-rooted-tree rooted-tree.qza
Performs multiple sequence alignment (MAFFT), filters out hypervariable unaligned positions (masking), infers a phylogenetic tree (FastTree), and roots it at the midpoint.
Fragment Insertion into Reference Tree (SEPP / Greengenes2)SEPP
qiime fragment-insertion sepp \
  --i-representative-sequences rep-seqs.qza \
  --i-reference-database sepp-refs-gg-13-8.qza \
  --p-threads 8 \
  --o-tree insertion-tree.qza \
  --o-placements insertion-placements.qza
Inserts short variable reads into a robust, pre-computed full-length reference phylogenetic tree without de novo alignment distortion.

9. Taxonomic Classification (SILVA / Greengenes2 / UNITE)

๐Ÿงฌ Taxonomy: Functions, Process & Need โœ•
๐ŸŽฏ Biological Purpose & Need

ASVs are raw nucleotide sequences (e.g. TACGGAGGAT...). Taxonomic classification uses machine-learning classifiers to assign biological identity to each ASV: Kingdom, Phylum, Class, Order, Family, Genus, and Species.

โš™๏ธ Databases & Algorithms
  • SILVA 138: Curated reference database for bacteria and archaea.
  • Greengenes2: Phylogeny-integrated database supporting consistent whole-genome and amplicon resolution.
  • UNITE: Curated reference database for fungal ITS marker genes.
  • classify-sklearn: Multinomial Naive Bayes classifier trained on 7-mer nucleotide frequencies with bootstrap confidence estimation.
๐Ÿ”„ The Workflow Process
  1. Run qiime feature-classifier classify-sklearn matching your amplicon primer region.
  2. Build interactive barplots via qiime taxa barplot.
  3. Filter out non-target sequences (e.g. mitochondrial or chloroplast DNA).
Assign biological taxonomy (Kingdom to Species) to representative sequences using trained machine-learning classifiers.
Naive Bayes Taxonomic Classification (classify-sklearn)Taxonomyโฑ 5-30 min๐Ÿ’พ 8-16 GB
โš™๏ธ Customize Taxonomic Classifier: LIVE UPDATER
# 1. Classify sequences
qiime feature-classifier classify-sklearn \
  --i-classifier silva-138-99-515-806-nb-classifier.qza \
  --i-reads rep-seqs.qza \
  --p-n-jobs 8 \
  --o-classification taxonomy.qza

# 2. Tabulate taxonomic assignments and confidence scores
qiime metadata tabulate \
  --m-input-file taxonomy.qza \
  --o-visualization taxonomy.qzv
Matches your ASVs against SILVA 138, Greengenes2, or UNITE (fungal ITS) reference databases with confidence statistics.
Generate Interactive Stacked Taxa BarplotsVisualizer
qiime taxa barplot \
  --i-table table.qza \
  --i-taxonomy taxonomy.qza \
  --m-metadata-file sample-metadata.tsv \
  --o-visualization taxa-bar-plots.qzv

qiime tools view taxa-bar-plots.qzv
Interactive visualizer allowing you to sort samples by metadata columns and switch taxonomic levels (L2 Phylum, L3 Class, L6 Genus, L7 Species).
Filter Host / Mitochondrial / Chloroplast ContaminationTaxa Filter
# Remove mitochondrial and chloroplast DNA from feature table
qiime taxa filter-table \
  --i-table table.qza \
  --i-taxonomy taxonomy.qza \
  --p-exclude mitochondria,chloroplast \
  --o-filtered-table table-no-contam.qza

# Remove corresponding sequences from rep-seqs
qiime taxa filter-seqs \
  --i-sequences rep-seqs.qza \
  --i-taxonomy taxonomy.qza \
  --p-exclude mitochondria,chloroplast \
  --o-filtered-sequences rep-seqs-no-contam.qza
Crucial quality step for 16S plant/soil/host studies where off-target host organelle DNA can skew microbial abundance.
Collapse Feature Table to Genus (Level 6)Collapse
qiime taxa collapse \
  --i-table table-no-contam.qza \
  --i-taxonomy taxonomy.qza \
  --p-level 6 \
  --o-collapsed-table table-L6-genus.qza
Collapses ASVs sharing the same taxonomic classification into genus-level counts for downstream statistical modeling.

9b. Training a Custom Naive Bayes Classifier

Pre-trained classifiers are region-specific. If your primers don't match available classifiers, train your own from SILVA, Greengenes2, or UNITE reference databases.
Extract Reference Reads (e.g. 515F/806R from SILVA 138)โฑ ~5 min
# 1. Download SILVA 138 reference sequences and taxonomy
wget https://data.qiime2.org/2024.10/common/silva-138-99-seqs.qza
wget https://data.qiime2.org/2024.10/common/silva-138-99-tax.qza

# 2. Extract reads matching your primer pair
qiime feature-classifier extract-reads \
  --i-sequences silva-138-99-seqs.qza \
  --p-f-primer GTGYCAGCMGCCGCGGTAA \
  --p-r-primer GGACTACNVGGGTWTCTAAT \
  --p-min-length 100 \
  --p-max-length 400 \
  --o-reads silva-138-99-515-806-seqs.qza
Extracts only the amplicon region between your forward and reverse primers from the full-length reference database.
โ–ถ Detailed Explanation

Why extract? The classifier performs best when trained on the exact amplicon region your primers target. Training on full-length 16S sequences leads to ~10-15% lower classification accuracy.

--p-min-length / --p-max-length: Filters out unreasonably short or long extracted amplicons that indicate primer mismatches in the reference database.

Common primer pairs:

  • 515F / 806R (V4): GTGYCAGCMGCCGCGGTAA / GGACTACNVGGGTWTCTAAT
  • 341F / 805R (V3-V4): CCTACGGGNGGCWGCAG / GACTACHVGGGTATCTAATCC
  • 27F / 1492R (Full-length 16S): AGRGTTYGATYMTGGCTCAG / RGYTACCTTGTTACGACTT
Fit Naive Bayes Classifierโฑ 15-45 min๐Ÿ’พ 8-32 GB RAM
qiime feature-classifier fit-classifier-naive-bayes \
  --i-reference-reads silva-138-99-515-806-seqs.qza \
  --i-reference-taxonomy silva-138-99-tax.qza \
  --o-classifier silva-138-99-515-806-nb-classifier.qza
Trains a scikit-learn Naive Bayes model. The resulting classifier (~300-800 MB) can be reused across all studies using the same primer pair.
โ–ถ Detailed Explanation

Training requires 15-45 minutes and 8-32 GB RAM depending on the reference database size. The trained classifier only needs to be built once per primer pair.

Databases:

  • SILVA 138 โ€” Bacteria, Archaea, Eukarya (most comprehensive)
  • Greengenes2 โ€” Bacteria, Archaea (phylogeny-based, integrates WoL2)
  • UNITE โ€” Fungi ITS taxonomy (use for ITS1/ITS2 data)

๐Ÿ”€ Decision Guide: Which Reference Database & Classifier?

๐Ÿ”€ Taxonomy Annotation: Database, Algorithm & Need โœ•
๐ŸŽฏ Why Taxonomy Strategy Dictates Study Quality

Classifying microbial representative sequences assigns biological identity (Phylum through Species) to anonymous ASVs. The accuracy of taxonomic profiles depends critically on matching your biological target to the appropriate curated reference repository and classifier algorithm.

๐Ÿ“š Curated Databases Compared
  • SILVA 138.1: The gold standard for environmental, aquatic, agricultural, and human microbiomes. Comprehensive coverage across Bacteria, Archaea, and Eukaryotes with standardized 7-rank taxonomy.
  • Greengenes2 (2022.10): Built on the Web of Life (WoL) genomic tree. Harmonizes 16S amplicons directly with shotgun metagenomic whole genomes; best for phylogenetic integration.
  • UNITE (v8/v9): The definitive international database for fungal ITS (ITS1, ITS2, and Full ITS) based on dynamic similarity threshold species hypotheses (SHs).
  • PR2 (Protist Ribosomal Reference): Specialized curated database for protistan and microeukaryotic 18S sequences.
  • BOLD / Midori: Curated cytochrome c oxidase I (COI) databases for metazoan/animal metabarcoding and environmental DNA (eDNA).
๐Ÿค– Classifier Algorithms Compared
  • Naive Bayes (classify-sklearn): High-speed k-mer frequency classifier. When trained on primer-extracted subregions (e.g. 515F-806R), achieves superior classification accuracy and fewer over-confident false assignments.
  • Consensus VSEARCH / BLAST+: Local sequence alignment. Essential for atypical environments, novel phyla, or when training custom classifiers is computationally infeasible.
Select your study parameters below to determine the ideal reference database and classification engine with biological rationale.
Q1 What is your target marker gene & biological kingdom?
Q2 What is your analytical focus and reference priority?
Q3 Amplicon Length & Classifier Training Type?
๐Ÿงฌ Recommended Database & Classifier Configuration
qiime feature-classifier classify-sklearn ...

10. Alpha Diversity & Rarefaction

๐ŸŒฟ Alpha Diversity: Functions, Process & Need โœ•
๐ŸŽฏ Within-Sample Diversity (Richness vs Evenness)

Alpha diversity summarizes the ecological complexity within individual samples. It evaluates both richness (how many distinct species exist) and evenness (how equitably individuals are distributed among species).

โš™๏ธ Key Alpha Metrics
  • Observed Features: Qualitative richness count of unique ASVs.
  • Shannon Index: Quantitative measure accounting for richness and abundance evenness.
  • Faith's PD: Phylogenetic richness measuring total branch length across the phylogenetic tree.
  • Pielou's Evenness: Quantifies uniformity of abundance across taxa.
๐Ÿ”„ The Workflow Process
  1. Run qiime diversity alpha-rarefaction to verify curves plateau.
  2. Execute qiime diversity core-metrics-phylogenetic at the chosen sampling depth.
  3. Test statistical group differences using qiime diversity alpha-group-significance (Kruskal-Wallis).
Calculate within-sample diversity and determine the optimal sampling depth for your dataset.
Generate Alpha Rarefaction Curvesโฑ 2-15 min
qiime diversity alpha-rarefaction \
  --i-table table.qza \
  --i-phylogeny rooted-tree.qza \
  --p-max-depth 4000 \
  --m-metadata-file sample-metadata.tsv \
  --o-visualization alpha-rarefaction.qzv
Crucial for determining if your sampling depth (sequencing effort) is sufficient to capture the full diversity of the samples. The curve should plateau.
Core Diversity Metrics (Alpha & Beta)โฑ 5-30 min
โš™๏ธ Customize Diversity Parameters: LIVE UPDATER
qiime diversity core-metrics-phylogenetic \
  --i-phylogeny rooted-tree.qza \
  --i-table table.qza \
  --p-sampling-depth 10000 \
  --m-metadata-file sample-metadata.tsv \
  --output-dir core-metrics-results
Generates the core alpha and beta diversity metrics simultaneously, producing multiple QZA and QZV artifacts. Need help choosing --p-sampling-depth? Use our interactive Rarefaction Depth Advisor tool above!
โ–ถ Detailed Explanation of Outputs

Alpha Diversity (Within-sample):

  • Faith's PD: Phylogenetic diversity (requires tree).
  • Observed Features: Richness (count of ASVs).
  • Shannon: Richness and evenness.
  • Evenness: Pielou's Evenness.

Beta Diversity (Between-sample):

  • Unweighted UniFrac: Presence/absence, phylogenetic.
  • Weighted UniFrac: Abundance-weighted, phylogenetic.
  • Jaccard: Presence/absence, non-phylogenetic.
  • Bray-Curtis: Abundance-weighted, non-phylogenetic.

Plus Emperor 3D plots (PCoA) for each beta metric.

11. Beta Diversity & Emperor 3D

Visualize compositional differences between samples using PCoA and Emperor.
View Emperor PCoA Plotโฑ Instant
# Emperor plots are automatically generated by core-metrics
# View them at view.qiime2.org
qiime tools view core-metrics-results/unweighted_unifrac_emperor.qzv
Interactive 3D scatter plots of your samples colored by metadata categories. Groupings indicate similar microbial community compositions.

12. Statistical Hypothesis Testing

๐Ÿ“ˆ Hypothesis Testing: Functions, Process & Need โœ•
๐ŸŽฏ Testing Microbial Community Shifts

Looking at clusters on an Emperor PCoA plot is exploratory; hypothesis testing statistically proves whether distances between metadata groups (e.g. Treatment vs Control, Healthy vs Disease) are significantly larger than within-group variation.

โš™๏ธ Key Statistical Tests
  • PERMANOVA (beta-group-significance): Non-parametric multivariate ANOVA testing whether community centroids differ in distance space.
  • PERMDISP: Tests whether within-group variance (dispersion) is equal across groups. Run alongside PERMANOVA to confirm significance is not a variance artifact!
  • Adonis: Multi-factor regression partitioning variance across multiple confounding covariates simultaneously.
๐Ÿ”„ The Workflow Process
  1. Pass a distance matrix (e.g. unweighted_unifrac_distance_matrix.qza) to PERMANOVA.
  2. Specify your experimental metadata column (--m-metadata-column treatment).
  3. Inspect pairwise pseudo-F statistics and Benjamini-Hochberg FDR q-values in .qzv.
Test for statistical significance in diversity differences between groups.
Beta Group Significance (PERMANOVA)โฑ 1-5 min
โš™๏ธ Customize Hypothesis Testing Parameters: LIVE UPDATER
qiime diversity beta-group-significance \
  --i-distance-matrix core-metrics-results/unweighted_unifrac_distance_matrix.qza \
  --m-metadata-file sample-metadata.tsv \
  --m-metadata-column treatment \
  --o-visualization unweighted-unifrac-treatment-significance.qzv \
  --p-pairwise
Tests if distances between samples within a group are significantly different from distances between groups.
โ–ถ PERMANOVA vs PERMDISP vs ANOSIM

PERMANOVA: Tests if the centroids (means) of groups are different. It is sensitive to differences in dispersion.

PERMDISP: Tests if the dispersion (variance) within groups is different. Always run this alongside PERMANOVA to ensure a significant PERMANOVA isn't just due to unequal variances.

ANOSIM: Compares ranked distances. Useful when distance values are not on a linear scale, but generally less powerful than PERMANOVA.

๐Ÿ”€ Decision Guide: Which Beta Diversity Metric?

๐Ÿ”€ Beta Diversity Selection: Matrix Mathematics & Ecology โœ•
๐ŸŽฏ The 4 Core Distance Metrics Compared
  • Unweighted UniFrac (Qualitative + Phylogenetic): Measures phylogenetic branch lengths unique to either sample. Extremely sensitive to community membership shifts and rare ancestral lineages.
  • Weighted UniFrac (Quantitative + Phylogenetic): Weights phylogenetic branch lengths by the relative abundances of taxa. Emphasizes dominant lineages and is robust against PCR noise.
  • Bray-Curtis Dissimilarity (Quantitative Non-Phylogenetic): Computes differences in read counts ($BC_{jk} = 1 - \frac{2C_{jk}}{S_j + S_k}$). Ideal for non-alignable markers (ITS, COI) or when abundance shifts dominate.
  • Jaccard Distance (Qualitative Non-Phylogenetic): Measures fraction of non-shared species ($1 - \frac{A \cap B}{A \cup B}$). Useful for presence/absence comparison without assuming phylogenetic lineage trees.
  • Aitchison / Robust Aitchison (DEICODE): Compositional distance based on centered log-ratio (CLR) transformation. Highly recommended for sparse datasets without rarefaction!
๐Ÿ”„ Recommended Decision Protocol
  1. For 16S/18S with a rooted tree โ†’ Test both Unweighted & Weighted UniFrac to contrast membership vs abundance effects.
  2. For fungal ITS โ†’ Rely on Bray-Curtis and Jaccard.
  3. Always execute qiime diversity beta-group-significance (PERMANOVA) to test statistical significance ($p < 0.05$).
Answer the questions below to calculate which beta diversity distance matrix best fits your biological hypothesis.
Q1 Do you have a valid rooted phylogenetic tree (e.g. rooted-tree.qza)?
Q2 What is the primary driver of your biological hypothesis?
๐Ÿ“Š Recommended Beta Diversity Metric & Visualization
qiime diversity beta-group-significance ...

13. Differential Abundance (ANCOM-BC / ANCOM-BC2)

๐Ÿ” Differential Abundance: Functions & Need โœ•
๐ŸŽฏ The Compositional Data Challenge

Microbiome sequencing yields compositional relative abundances rather than absolute counts. Traditional parametric tests (t-tests, ANOVA) yield false positive rates exceeding 70% because bloom of one dominant taxon mathematically forces relative percentages of all other taxa down!

ANCOM-BC corrects for sampling fraction bias using a log-linear model to infer true biological fold changes, standard errors, and FDR-corrected q-values.

โš™๏ธ Functions & Parameters
  • --p-formula: Linear model formula (e.g. treatment or genotype + timepoint) allowing adjustment for confounders.
  • --p-reference-levels: Sets the baseline reference group (e.g. treatment::Control).
  • --p-prv-cut: Prevalence filter dropping ultra-rare noise taxa.
  • da-barplot: Creates interactive effect-size waterfall barplots with confidence intervals.
๐Ÿ”„ The Workflow Process
  1. Collapse table to desired rank (e.g. Genus) or use ASV-level table.
  2. Run qiime composition ancombc with experimental formula.
  3. Generate interactive differential abundance visualization with da-barplot.
Identify specific taxa whose abundances differ significantly across metadata groups.
ANCOM-BCโฑ 2-10 min
โš™๏ธ Customize ANCOM-BC Formula & Model: LIVE UPDATER
qiime composition ancombc \
  --i-table table-no-contam.qza \
  --m-metadata-file sample-metadata.tsv \
  --p-formula 'treatment' \
  --o-differentials ancombc-differentials.qza

qiime composition da-barplot \
  --i-data ancombc-differentials.qza \
  --p-significance-threshold 0.05 \
  --o-visualization ancombc-barplot.qzv
Analysis of Compositions of Microbiomes with Bias Correction. Corrects for compositional bias.
ANCOM-BC2: Multi-Variable with Structural Zero DetectionANCOM-BC2โฑ 2-10 min
โš™๏ธ Customize ANCOM-BC2 Multi-Factor Parameters: LIVE UPDATER
qiime composition ancombc \
  --i-table table-no-contam.qza \
  --m-metadata-file sample-metadata.tsv \
  --p-formula 'group + timepoint' \
  --p-reference-levels group::Control \
  --p-prv-cut 0.10 \
  --p-lib-cut 1000 \
  --o-differentials ancombc2-differentials.qza

qiime composition da-barplot \
  --i-data ancombc2-differentials.qza \
  --p-significance-threshold 0.05 \
  --p-level-delimiter ';' \
  --o-visualization ancombc2-barplot.qzv
ANCOM-BC2 handles multi-group comparisons, structural zeros (taxa absent from entire groups), and provides improved sensitivity with the --p-prv-cut prevalence filter and --p-lib-cut library size filter.

14. ITS / 18S Fungal & Eukaryotic Microbiome Analysis

๐Ÿ„ Fungal ITS: Functions, Process & Need โœ•
๐ŸŽฏ Why ITS Pipelines Differ from 16S

Unlike 16S rRNA genes which have relatively uniform length (~253 bp in V4), fungal Internal Transcribed Spacer (ITS) regions vary biologically from 200 to 600+ bp.

Critical Pipeline Changes:
1. ITSxpress is required to trim flanking conserved ribosomal genes (18S, 5.8S, 28S).
2. DADA2 Truncation must be 0 (--p-trunc-len 0)! Truncating at a fixed base position will discard all longer fungal amplicons.
3. UNITE Database must be used for taxonomy assignment.

โš™๏ธ Functions & Parameters
  • --p-region: Target amplicon region (ITS1 or ITS2).
  • --p-taxa: Target kingdom (F for Fungi, A for All).
  • UNITE dynamic: Dynamic clustering thresholds provide species-level discrimination.
Workflows for fungal (ITS1/ITS2) and eukaryotic (18S) marker-gene analysis using QIIME 2.
Extract ITS1/ITS2 Region with q2-itsxpressโฑ 5-15 min
โš™๏ธ Customize ITSxpress Parameters: LIVE UPDATER
qiime itsxpress trim-pair-output-unmerged \
  --i-per-sample-sequences demux-paired.qza \
  --p-region ITS2 \
  --p-taxa F \
  --o-trimmed trimmed-its2.qza
ITSxpress uses Hidden Markov Models to identify and extract only the ITS1 or ITS2 region from full-length ITS amplicons, removing flanking conserved rRNA gene sequences.
โ–ถ Detailed Explanation

Why extract ITS? Unlike 16S, ITS regions vary dramatically in length (200-600+ bp). DADA2 and Deblur require uniform-length inputs, so ITSxpress must extract the variable region first.

--p-region: Choose ITS1 or ITS2 based on your primer set (ITS1f/ITS2 โ†’ ITS1; fITS7/ITS4 โ†’ ITS2).

--p-taxa: F=Fungi, A=All (includes plants, protists).

Denoise ITS with DADA2 (Variable Length)โฑ 10-30 min
# For ITS: set --p-trunc-len to 0 (no truncation) because ITS length varies
qiime dada2 denoise-paired \
  --i-demultiplexed-seqs trimmed-its2.qza \
  --p-trunc-len-f 0 \
  --p-trunc-len-r 0 \
  --p-n-threads 8 \
  --o-table table-its.qza \
  --o-representative-sequences rep-seqs-its.qza \
  --o-denoising-stats stats-its.qza
Critical: Set --p-trunc-len-f 0 and --p-trunc-len-r 0 for ITS data because ITS amplicon length varies. Quality-based truncation is handled internally by DADA2.
Classify Fungi with UNITE Databaseโฑ 5-20 min
# Download pre-trained UNITE classifier from QIIME 2 data resources
# Then classify:
qiime feature-classifier classify-sklearn \
  --i-classifier unite-ver9-dynamic-all-25.07.2023-Q2-2024.10.qza \
  --i-reads rep-seqs-its.qza \
  --o-classification taxonomy-its.qza

qiime taxa barplot \
  --i-table table-its.qza \
  --i-taxonomy taxonomy-its.qza \
  --m-metadata-file sample-metadata.tsv \
  --o-visualization taxa-barplot-its.qzv
UNITE is the curated reference database for fungal ITS taxonomy. Use the "dynamic" threshold version for best species-level resolution.
18S rRNA Eukaryotic Analysis (Protists, Micro-eukaryotes)โฑ 5-20 min
# Import and process 18S data (same pipeline as 16S)
# Use SILVA 138 18S classifier:
qiime feature-classifier classify-sklearn \
  --i-classifier silva-138-99-18S-nb-classifier.qza \
  --i-reads rep-seqs.qza \
  --o-classification taxonomy-18s.qza

# Note: For phylogeny-aware diversity on 18S,
# use de novo tree (MAFFT+FastTree) since SEPP
# reference trees are 16S-specific
18S analysis uses the same general QIIME 2 pipeline as 16S but requires a SILVA 138 classifier trained on 18S sequences and different primer pairs (e.g. Euk1391f/EukBr).

15. Longitudinal & Machine Learning

Analyze time-series data and build predictive models.
Longitudinal Volatilityโฑ 1-5 min
โš™๏ธ Customize Longitudinal Variables: LIVE UPDATER
qiime longitudinal volatility \
  --m-metadata-file sample-metadata.tsv \
  --m-metadata-file shannon.qza \
  --p-state-column time \
  --p-individual-id-column subject \
  --p-default-metric shannon \
  --o-visualization volatility.qzv
Track changes in metrics (like Shannon diversity) over time for each individual subject.

16. Shotgun Metagenomics & PICRUSt2

Predict functional profiles from 16S data.
PICRUSt2 Functional Predictionโฑ 1-3 hrs
qiime picrust2 full-pipeline \
  --i-table table.qza \
  --i-seq rep-seqs.qza \
  --output-dir picrust2_out \
  --p-threads 8 \
  --p-hsp-method pic \
  --p-max-nsti 2
Predicts KEGG orthologs and metabolic pathways from 16S marker gene sequences. Warning: Compute intensive!

17. Data Export & R/Python API

Extract data from .qza files for analysis in other tools.
Export Feature Tableโฑ Instant
qiime tools export \
  --input-path table.qza \
  --output-path exported-feature-table
  
biom convert \
  -i exported-feature-table/feature-table.biom \
  -o feature-table.tsv \
  --to-tsv
Extract the raw BIOM file and convert it to a TSV format for Excel or R.
Full Pipeline in Jupyter Notebook (Python Artifact API)Jupyter
import qiime2
from qiime2 import Artifact, Metadata
from qiime2.plugins import demux, dada2, feature_table
from qiime2.plugins import phylogeny, diversity, feature_classifier
import pandas as pd

# 1. Import data
demux_art = Artifact.import_data(
    'SampleData[PairedEndSequencesWithQuality]',
    'manifest.tsv',
    view_type='PairedEndFastqManifestPhred33V2'
)

# 2. Denoise with DADA2
table, rep_seqs, stats = dada2.methods.denoise_paired(
    demultiplexed_seqs=demux_art,
    trunc_len_f=240,
    trunc_len_r=200,
    n_threads=8
)

# 3. Build tree
alignment, masked, unrooted, rooted = phylogeny.pipelines.align_to_tree_mafft_fasttree(
    sequences=rep_seqs,
    n_threads=8
)

# 4. Core diversity
meta = Metadata.load('sample-metadata.tsv')
results = diversity.pipelines.core_metrics_phylogenetic(
    phylogeny=rooted,
    table=table,
    sampling_depth=10000,
    metadata=meta
)

# 5. Access results as DataFrames
shannon_df = results.shannon_vector.view(pd.Series)
print(shannon_df.describe())
The QIIME 2 Artifact API lets you run the entire pipeline programmatically in Python/Jupyter without the command line.

18. Troubleshooting Encyclopedia

Common QIIME 2 errors and how to resolve them.
Error / Issue Likely Cause Solution
Plugin error: MemoryError Insufficient RAM, especially during DADA2 or feature classification. Increase RAM allocation, use fewer threads, or use a smaller classifier database.
No metadata column found Typo in the column name or metadata file is not formatted correctly (e.g. not tab-separated). Check metadata with Keemei, ensure names match exactly.
All samples dropped in core-metrics --p-sampling-depth is set higher than the number of reads in your samples. Check feature-table summarize and lower the sampling depth.
Missing artifact error A required input file is missing, mistyped, or not yet created. Check file paths and filenames.

๐Ÿ“š External Resources & Key Publications

Essential links for QIIME 2 users โ€” databases, forums, and landmark papers.

Reference Databases

Community & Support

Key Publications

  • Bolyen et al. (2019) โ€” Reproducible, interactive, scalable and extensible microbiome data science using QIIME 2. Nature Biotechnology. doi:10.1038/s41587-019-0209-9
  • Callahan et al. (2016) โ€” DADA2: High-resolution sample inference from Illumina amplicon data. Nature Methods. doi:10.1038/nmeth.3869
  • Bokulich et al. (2018) โ€” Optimizing taxonomic classification of marker-gene amplicon sequences with QIIME 2's q2-feature-classifier plugin. Microbiome.
  • Lin & Peddada (2020) โ€” Analysis of compositions of microbiomes with bias correction (ANCOM-BC). Nature Communications.

20. End-to-End Cheatsheet

A complete basic pipeline from start to finish.
Basic QIIME 2 Pipeline (.sh)
#!/bin/bash
# 1. Import
qiime tools import --type 'SampleData[PairedEndSequencesWithQuality]' --input-path manifest.tsv --output-path demux.qza --input-format PairedEndFastqManifestPhred33V2

# 2. Denoise
qiime dada2 denoise-paired --i-demultiplexed-seqs demux.qza --p-trunc-len-f 240 --p-trunc-len-r 200 --o-table table.qza --o-representative-sequences rep-seqs.qza --o-denoising-stats stats-dada2.qza

# 3. Phylogeny
qiime phylogeny align-to-tree-mafft-fasttree --i-sequences rep-seqs.qza --o-alignment aligned-rep-seqs.qza --o-masked-alignment masked-aligned-rep-seqs.qza --o-tree unrooted-tree.qza --o-rooted-tree rooted-tree.qza

# 4. Taxonomy
qiime feature-classifier classify-sklearn --i-classifier silva-138-99-nb-classifier.qza --i-reads rep-seqs.qza --o-classification taxonomy.qza

# 5. Diversity
qiime diversity core-metrics-phylogenetic --i-phylogeny rooted-tree.qza --i-table table.qza --p-sampling-depth 10000 --m-metadata-file sample-metadata.tsv --output-dir core-metrics-results