Skip to content

SudarioRoberto/Metagenomics_Pipeline_Pigs_Complex_Diets

Repository files navigation

🐷 Pig Metagenomics Pipeline

License: MIT Snakemake DOI

A comprehensive shotgun metagenomics pipeline for pig gut microbiome analysis: from raw reads to taxonomic profiles, functional annotations, and statistical analysis.


πŸ“‹ Table of Contents


Overview

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

Project Stats

πŸ“Š Samples:     30 pig gut metagenomes
🧬 Sequencing:  Paired-end Illumina (Nextera)
πŸ’Ύ Raw Data:    ~15 GB
πŸ–₯️ Platform:    MSI (Minnesota Supercomputing Institute)

Pipeline Workflow

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
Loading

πŸ“ Directory Structure

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

Installation

1. Clone Repository

git clone https://github.com/SudarioRoberto/Metagenomics_Pipeline_Pigs_Complex_Diets.git
cd Metagenomics_Pipeline_Pigs_Complex_Diets

2. Create Conda Environment

mamba env create -f envs/pig_metagenomics.yml
mamba activate pig_metagenomics

3. Download Databases

# 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 details

Pipeline Steps

Step 1: Build Host Genome Index

Build Bowtie2 index for pig genome (Sus scrofa) to remove host contamination.

sbatch scripts/02_build_index.sbatch

πŸ“– Documentation: 01_pig_genome_index.md


Step 2: Quality Control & Host Removal

Run KneadData for adapter trimming, quality filtering, and host decontamination.

sbatch scripts/03_kneaddata.sbatch

πŸ“– Documentation: 02_QC_and_Host_Removal.md


Step 3: Taxonomic Profiling

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


Step 4: Functional Profiling

Profile metabolic pathways and gene families using HUMAnN4.

sbatch scripts/06_humann4_batch.sbatch

πŸ“– Documentation: 04_Humann4.md


Step 5: Statistical Analysis

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


Step 6: Metabolic Pathway Analysis

Coming soon - Analysis of HUMAnN4 pathway and gene family outputs.

πŸ“– Documentation: 06_Metabolic_Pathways/README.md


Documentation

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

πŸ› οΈ Troubleshooting

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/bin
Kraken2 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_env

Citation

If 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}
}

Tools Used

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

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Shotgun metagenomics pipeline for pig gut microbiome: QC, host removal, taxonomic and functional profiling

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages