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.
- Input FASTA validation
- SAMPLE_GROUP safety validation
- QUAST assembly/genome quality comparison
- QUAST comparative summary table
- Bakta genome annotation for each genome
- Bakta annotation summary table
- FastANI genome similarity comparison
- FastANI pairwise summary and ANI matrix
- Panaroo pangenome analysis
- Panaroo core/accessory/unique gene summary
- Core genome phylogeny with FastTree
- Final comparative genomics report
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.
mkdir -p ~/Bioinformatics/09_Projects/Your_Project_Name
cd ~/Bioinformatics/09_Projects/Your_Project_Namemkdir -p 01_Genomes_FASTAOnly 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.
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
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 .nano config.envEdit 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.
conda activate ComparativeGenomics./run_pipeline.shrun_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.
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.
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
The required Conda environment can be recreated with:
conda env create -f environment.yml
conda activate ComparativeGenomicsIf 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.
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
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.
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.
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
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.