A comprehensive shotgun metagenomics pipeline for pig gut microbiome analysis: from raw reads to taxonomic profiles, functional annotations, and statistical analysis.
This pipeline processes shotgun metagenomic sequencing data from pig gut samples through quality control, taxonomic profiling, functional annotation, and comprehensive statistical analysis.
| Step | Tool | Purpose |
|---|---|---|
| 1. Quality Control | FastQC, MultiQC | Assess raw read quality |
| 2. Preprocessing | KneadData (Trimmomatic) | Trim adapters, filter low-quality reads |
| 3. Host Removal | KneadData (Bowtie2) | Remove pig genome contamination |
| 4. Taxonomic Profiling | Kraken2 + Bracken | Identify and quantify microbial species |
| 5. Functional Profiling | HUMAnN4 | Predict metabolic pathways |
| 6. Statistical Analysis | R (ALDEx2, ANCOM-BC) | Diversity and differential abundance |
π Samples: 30 pig gut metagenomes
𧬠Sequencing: Paired-end Illumina (Nextera)
πΎ Raw Data: ~15 GB
π₯οΈ Platform: MSI (Minnesota Supercomputing Institute)
graph TD
A[Raw FASTQ] --> B[FastQC]
B --> C[KneadData<br/>Trimmomatic + Host Removal]
C --> D[Clean Reads]
D --> E[Kraken2 + Bracken<br/>Taxonomic Profiling]
D --> F[HUMAnN4<br/>Functional Profiling]
E --> G[05_Statistical_Analysis<br/>Diversity & Differential Abundance]
F --> H[06_Metabolic_Pathways<br/>Pathway Analysis]
G --> I[Publication Figures]
H --> I
Metagenomics_Pipeline_Pigs_Complex_Diets/
β
βββ π README.md # This file
βββ π LICENSE # MIT License
β
βββ π docs/ # Step-by-step documentation
β βββ 01_pig_genome_index.md # Build Bowtie2 index for host removal
β βββ 02_QC_and_Host_Removal.md # KneadData preprocessing
β βββ 03_Taxonomic_Kraken2.md # Kraken2 + Bracken profiling
β βββ 04_Humann4.md # HUMAnN4 functional profiling
β
βββ π 05_Statistical_Analysis/ # R analysis scripts and reports
β βββ README.md # Analysis documentation
β βββ complex_diets.qmd # Quarto source file
β βββ complex_diets.html # Rendered HTML report
β βββ meta.csv # Sample metadata
β βββ merged_*_abundance.txt # Bracken abundance tables
β
βββ π 06_Metabolic_Pathways/ # HUMAnN4 pathway analysis (coming soon)
β βββ README.md
β
βββ π scripts/ # Pipeline scripts
β βββ 00_prepare_env.sh
β βββ 01_download_genome.sh
β βββ 02_build_index.sbatch
β βββ 03_kneaddata.sbatch
β βββ 04_kraken2_batch.sbatch
β βββ 05_bracken_batch.sbatch
β βββ 06_humann4_batch.sbatch
β
βββ π envs/ # Conda environments
β βββ pig_metagenomics.yml
β
βββ π config/ # Configuration files
βββ samples.txt
git clone https://github.com/SudarioRoberto/Metagenomics_Pipeline_Pigs_Complex_Diets.git
cd Metagenomics_Pipeline_Pigs_Complex_Dietsmamba env create -f envs/pig_metagenomics.yml
mamba activate pig_metagenomics# Pig genome for host removal
bash scripts/01_download_genome.sh
# Kraken2 standard database
# See docs/03_Taxonomic_Kraken2.md for details
# HUMAnN4 databases
# See docs/04_Humann4.md for detailsBuild Bowtie2 index for pig genome (Sus scrofa) to remove host contamination.
sbatch scripts/02_build_index.sbatchπ Documentation: 01_pig_genome_index.md
Run KneadData for adapter trimming, quality filtering, and host decontamination.
sbatch scripts/03_kneaddata.sbatchπ Documentation: 02_QC_and_Host_Removal.md
Classify reads taxonomically using Kraken2 and refine abundances with Bracken.
sbatch scripts/04_kraken2_batch.sbatch
sbatch scripts/05_bracken_batch.sbatchπ Documentation: 03_Taxonomic_Kraken2.md
Profile metabolic pathways and gene families using HUMAnN4.
sbatch scripts/06_humann4_batch.sbatchπ Documentation: 04_Humann4.md
Comprehensive statistical analysis in R including:
- Alpha diversity: Observed, Shannon, Simpson, Chao1, Pielou's evenness
- Beta diversity: PCoA with Bray-Curtis, Jaccard, Aitchison distances
- PERMANOVA: Test for treatment effects
- Differential abundance: ALDEx2 and ANCOM-BC with consensus approach
π Documentation: 05_Statistical_Analysis/README.md
π Interactive Report: View Full Analysis
Coming soon - Analysis of HUMAnN4 pathway and gene family outputs.
π Documentation: 06_Metabolic_Pathways/README.md
| Document | Description |
|---|---|
| 01_pig_genome_index.md | Download pig genome, build Bowtie2 index |
| 02_QC_and_Host_Removal.md | KneadData preprocessing workflow |
| 03_Taxonomic_Kraken2.md | Kraken2 + Bracken taxonomic profiling |
| 04_Humann4.md | HUMAnN4 functional profiling |
| 05_Statistical_Analysis/README.md | R statistical analysis guide |
Java OutOfMemoryError (Trimmomatic)
Add to your script:
export _JAVA_OPTIONS="-Xmx32g"Bowtie2 not found
Use full path to bin directory:
--bowtie2 /path/to/conda/env/binKraken2 database loading errors
Use memory mapping if RAM is limited:
kraken2 --db $DB --memory-mapping --paired ...HUMAnN4 command not found
Initialize conda properly:
source ~/.bashrc
eval "$(conda shell.bash hook)"
conda activate humann4_envIf you use this pipeline, please cite:
@software{pig_metagenomics_pipeline,
author = {Sudario, Roberto},
title = {Pig Metagenomics Pipeline},
year = {2024},
url = {https://github.com/SudarioRoberto/Metagenomics_Pipeline_Pigs_Complex_Diets}
}| Tool | Purpose | Citation |
|---|---|---|
| KneadData | Quality control and host removal | Huttenhower Lab |
| Kraken2 | Taxonomic classification | Wood et al., 2019 |
| Bracken | Abundance estimation | Lu et al., 2017 |
| HUMAnN4 | Functional profiling | Beghini et al., 2021 |
| ALDEx2 | Differential abundance | Fernandes et al., 2014 |
| ANCOM-BC | Differential abundance | Lin & Peddada, 2020 |
This project is licensed under the MIT License - see the LICENSE file for details.