Skip to content

Savagebd/comparative-bacterial-genomics-pipeline

Repository files navigation

Comparative Bacterial Genomics Pipeline

This repository contains reusable template files for comparative bacterial genomics using multiple assembled bacterial genome FASTA files.

The pipeline provides a structured workflow for comparing genome quality, annotation content, nucleotide similarity, pangenome composition, and core genome phylogeny across related bacterial genomes.

Active Workflow

  1. Input FASTA validation
  2. SAMPLE_GROUP safety validation
  3. QUAST assembly/genome quality comparison
  4. QUAST comparative summary table
  5. Bakta genome annotation for each genome
  6. Bakta annotation summary table
  7. FastANI genome similarity comparison
  8. FastANI pairwise summary and ANI matrix
  9. Panaroo pangenome analysis
  10. Panaroo core/accessory/unique gene summary
  11. Core genome phylogeny with FastTree
  12. Final comparative genomics report

Template Files

run_pipeline.sh
config.example.env
environment.yml
README.md
PIPELINE_EXPLANATION.md
.gitignore
scripts/01_summarize_quast_results.py
scripts/02_summarize_bakta_annotations.py
scripts/03_summarize_fastani_results.py
scripts/04_summarize_panaroo_results.py
scripts/05_generate_final_comparative_report.py

The template folder should not contain numbered workflow folders. Those folders are created inside each project when the pipeline is run.

Step 1: Create a New Project Folder

mkdir -p ~/Bioinformatics/09_Projects/Your_Project_Name
cd ~/Bioinformatics/09_Projects/Your_Project_Name

Step 2: Create Only the Input Folder

mkdir -p 01_Genomes_FASTA

Only 01_Genomes_FASTA is created manually because the input FASTA files must be placed there before the pipeline is run.

The pipeline automatically creates the remaining generated output folders.

Step 3: Place the FASTA Files

Place at least 2 assembled bacterial genome FASTA files inside:

01_Genomes_FASTA/

Accepted extensions:

.fna
.fa
.fasta

Example:

01_Genomes_FASTA/
S_aureus_JP080_complete_genome.fasta
S_aureus_KAM440_complete_genome.fasta
S_aureus_MRSA252_complete_genome.fasta

Step 4: Copy Reusable Template Files

cp ~/Bioinformatics/00_Pipeline_Templates/comparative_bacterial_genomics_pipeline/run_pipeline.sh .
cp ~/Bioinformatics/00_Pipeline_Templates/comparative_bacterial_genomics_pipeline/config.example.env ./config.env
cp ~/Bioinformatics/00_Pipeline_Templates/comparative_bacterial_genomics_pipeline/environment.yml .

cp -r ~/Bioinformatics/00_Pipeline_Templates/comparative_bacterial_genomics_pipeline/scripts .

Step 5: Edit config.env

nano config.env

Edit these values:

PROJECT_DIR
SAMPLE_GROUP
GENOMES_DIR
THREADS
BAKTA_DB

Example:

PROJECT_DIR="$HOME/Bioinformatics/09_Projects/Your_Project_Name"
SAMPLE_GROUP="example_comparison"
GENOMES_DIR="${PROJECT_DIR}/01_Genomes_FASTA"
THREADS="4"
BAKTA_DB="$HOME/Bioinformatics/06_Tools/bakta_db/db-light"

GENOMES_DIR must point to the project-local FASTA folder inside 01_Genomes_FASTA/.

SAMPLE_GROUP may only contain letters, numbers, underscores, and hyphens.

Step 6: Activate Conda

conda activate ComparativeGenomics

Step 7: Run the Pipeline

./run_pipeline.sh

Output Folders Created Automatically

run_pipeline.sh automatically creates generated output folders. Some generated analysis folders are replaced during reruns:

02_QUAST_Comparison
03_Bakta_Annotations
04_ANI_Comparison
05_Pangenome_Analysis
06_Phylogeny
07_Comparative_Summary
08_Final_Report
09_Notes

The script protects 01_Genomes_FASTA and does not delete or modify the original input FASTA files.

Final Project Folder Structure

01_Genomes_FASTA
02_QUAST_Comparison
03_Bakta_Annotations
04_ANI_Comparison
05_Pangenome_Analysis
06_Phylogeny
07_Comparative_Summary
08_Final_Report
09_Notes

run_pipeline.sh
config.env
environment.yml

scripts/01_summarize_quast_results.py
scripts/02_summarize_bakta_annotations.py
scripts/03_summarize_fastani_results.py
scripts/04_summarize_panaroo_results.py
scripts/05_generate_final_comparative_report.py

run_pipeline.sh uses the existing project-local FASTA files directly.

It does not copy input data from a central raw data folder.

Important Outputs

QUAST assembly/genome quality comparison:

02_QUAST_Comparison/report.html
02_QUAST_Comparison/report.txt
02_QUAST_Comparison/report.tsv
07_Comparative_Summary/quast_comparative_summary.tsv
07_Comparative_Summary/quast_comparative_summary_readable.txt

Bakta genome annotation:

03_Bakta_Annotations/
07_Comparative_Summary/bakta_annotation_summary.tsv
07_Comparative_Summary/bakta_annotation_summary_readable.txt

FastANI genome similarity comparison:

04_ANI_Comparison/fastani_pairwise_output.tsv
07_Comparative_Summary/fastani_pairwise_summary.tsv
07_Comparative_Summary/fastani_matrix.tsv
07_Comparative_Summary/fastani_summary_readable.txt

Panaroo pangenome analysis:

05_Pangenome_Analysis/gene_presence_absence.csv
05_Pangenome_Analysis/core_gene_alignment.aln
05_Pangenome_Analysis/core_gene_alignment_filtered.aln
07_Comparative_Summary/panaroo_pangenome_summary.tsv
07_Comparative_Summary/panaroo_gene_category_counts.tsv
07_Comparative_Summary/panaroo_pangenome_summary_readable.txt

Core genome phylogeny:

06_Phylogeny/core_gene_tree.newick

Final report:

08_Final_Report/comparative_genomics_final_report.txt

Environment Recreation

The required Conda environment can be recreated with:

conda env create -f environment.yml
conda activate ComparativeGenomics

If using an existing environment, make sure these tools are installed:

python
quast
bakta
fastani
panaroo
mafft
fasttree

environment.yml is only for recreating the environment.

The pipeline does not create or modify Conda environments automatically.

Example Test Dataset

This pipeline was tested using three assembled Staphylococcus aureus genomes:

S_aureus_JP080_complete_genome.fasta
S_aureus_KAM440_complete_genome.fasta
S_aureus_MRSA252_complete_genome.fasta

Example FastANI result:

Minimum non-self ANI: 97.5915%
Maximum non-self ANI: 98.3638%
Average non-self ANI: 97.8751%

Example Panaroo result:

Total gene clusters: 3075
Core gene clusters: 2244
Accessory gene clusters: 245
Unique gene clusters: 586

Interpretation Notes

FastANI values around or above 95% are commonly used as support for same-species bacterial genome classification.

Core gene clusters are shared by all compared genomes.

Accessory gene clusters are present in some but not all genomes.

Unique gene clusters are found in only one genome and may represent strain-specific genes, mobile genetic elements, annotation differences, or assembly-related variation.

The core genome tree is generated in Newick format and can be opened in tree visualization tools such as iTOL, FigTree, or MEGA.

Safety Notes

The pipeline does not delete or modify files inside:

01_Genomes_FASTA/

Generated output folders may be replaced during reruns.

Always check config.env carefully before running the pipeline.

Limitations

This is a reusable educational workflow and does not replace production-grade workflow management or full biological interpretation.

The final report provides a structured computational summary, but deeper biological interpretation may require:

manual gene-level review
AMR gene screening
virulence factor screening
functional annotation review
tree visualization
additional taxonomic validation

Author

Created by Raihanul Islam (Savagebd) as part of a bioinformatics learning and portfolio development project.

This repository is shared publicly for transparency, portfolio development, and learning purposes.

Direct copying and submitting this project as someone else's original coursework is not permitted.

About

Reusable comparative bacterial genomics pipeline for assembled bacterial genome FASTA files using QUAST, Bakta, FastANI, Panaroo, and FastTree.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages