Skip to main content

MOSTAR - Modular ONT-Short-read Taxonomic Assembly and Resistome-Evolution pipeline

MOSTAR-ASM Banner

Bioconda

MOSTAR is comprehensive bioinformatics pipeline for microbial analysis of whole-genome Oxford Nanopore sequencing data (ONT-reads). The pipeline constructs highly-polished genomes (using hybrid- or non-hybrid assembly), in addition to performing functional annotation, AMR profiling, ICE detection, and taxonomic classification — with built-in quality controls and an interactive HTML report.

This pipeline has been developed and tested on S. aureus, B. fragilis, as well as H. influenzae strains, but will work with any bacteria, as long as the correct genome size and ONT model are specified. The pipeline contains some of the most well known tools in bioinformatics, and is designed to be a "one-stop shop" for most bacterial analysis. Finally the pipeline provides result- and log files from every included tool.

The pipeline was built as a way of bridging the gap between long-read and short-read technology, its name is therefore inspired by the historic Stari Most (Old Bridge) of Mostar.

MOSTAR - Workflow and run-modes

MOSTAR Workflow Diagram

Key Features

ONT-only modee

  • Long-read quality trimming (Filtlong)
  • De novo assembly (Flye)
  • ONT consensus polishing (Medaka)
  • Genome rotation (circlator)
  • AMR profiling (AMRFinder+)
  • Interactive HTML report

Hybrid mode — additional steps when short reads are provided

  • Short-read quality trimming (Fastp)
  • Short-read alignment to ONT consensus (BWA-MEM)
  • Short-read polishing (Polypolish)

Optional tools

  • Taxonomic classification (Kraken2 / EMU)
  • Functional annotation (Bakta)
  • ICE detection — Integrative and Conjugative Elements (MacSyFinder / CONJScan)
  • Plasmid-borne AMR cross-referencing (geNomad + AMRFinder+)
  • Prophage detection and localisation (geNomad)
  • Integron detection (IntegronFinder)

Output files

A successful run will contain the following output, including the final polished fasta, HTML-report, as well as individual output files and logs from all the included tools.

  Output_folder
  |- amr_results
  |  |- maps/ (Contains high-res .png circular genome maps)
  |  |- AMR_Report.tsv
  |- annotation
  |- flye
  |- ice_detection
  |- annotation
  |- flye
  |- ice_detection
  |- intermediate
  |- logs
  |- medaka
  |- integron_detection
  |- taxonomy
  |- amr_summary.html
  |- MOSTAR_Final_Report.html
  |- MOSTAR_Assembly.fasta

Usage instructions & input files

# Required:
* ONT-reads
* Genome size 
* Model (leave blank if r1041_e82_400bps_sup_v5.2.0)
* Output


##### CONDA instructions ######

# Run MOSTAR in ONT-only mode, assemble genome and perform AMR analysis. 
mostar --ont ont.fq.gz --genome-size [size] --output [dir] --model [model]

# Run MOSTAR in Hybrid mode, assemble genome and perform AMR analysis.
mostar --ont ont.fq.gz --genome-size [size] --output [dir] --model [model] --r1 R1.fq --r2 R2.fq 
  
# The "Everything" Run (Taxonomy, Annotation, ICE, and Plasticity/Prophages/Integrons):
mostar --ont ont_read.fastq.gz --r1 read1.fastq.gz --r2 read2.fastq.gz \
  --genome-size X.Xm --output Output \
  --kraken2-db kraken2_db_path \
  --bakta-db db_path --ice \
  --genomad-db genomad_db_path --plasticity \
  --integrons \
  --cleanup

##### DOCKER instructions #####

# Get the latest Docker image

docker pull nermze/mostar:latest

# Run MOSTAR - (In this example, all input files and databases are in the same folder)

docker run --rm \
  -v "$(pwd)":/data \
  -v "$(pwd)/databases":/databases \
  nermze/mostar \
  --ont /data/reads.fq.gz \
  --r1 /data/R1.fq.gz \ (omit if not available)
  --r2 /data/R2.fq.gz \ (omit if not available)
  --genome-size X.Xm (g, or k) \
  --output /data/output \
  --kraken2-db /databases/kraken2_db \
  --bakta-db /databases/db-light \
  --ice \
  --genomad-db /databases/genomad_db \
  --plasticity \
  --integrons \
  --cleanup

Installation

The installation supports both Conda and Docker. If however installing manually, the included YML will create a separate conda environment with all the required dependencies. The only manual step is downloading and configuring databases. For some manual installaltions, geNomad may become a dependency issue. If you encounter installation hang-ups, remove geNomad from the YML and install it separatly.

Install using Bioconda

# To install MOSTAR in the current env
conda install bioconda::mostar

# Create a dedicated environment (recommended)
conda create -n mostar_env python=3.11 biopython=1.84
conda activate mostar_env
conda install bioconda::mostar

# Run the program
mostar --help

Docker - The easiest way to run MOSTAR without managing a Conda environment.

# Pull the latest image
docker pull nermze/mostar:latest

# Basic usage — ONT-only mode
docker run --rm \
  -v /path/to/your/data:/data \
  -v /path/to/databases:/databases \
  nermze/mostar \
  --ont /data/reads.fq.gz \
  --genome-size X.X(m, g or k) \
  --model (default:r1041_e82_400bps_sup_v5.2.0)
  --output /data/output \

#Hybrid mode — ONT + Illumina
docker run --rm \
  -v /path/to/your/data:/data \
  -v /path/to/databases:/databases \
  nermze/mostar \
  --ont /data/reads.fq.gz \
  --r1 /data/R1.fq.gz \
  --r2 /data/R2.fq.gz \
  --genome-size X.X(m, g or k) \
  --model (default:r1041_e82_400bps_sup_v5.2.0) \
  --output /data/output

# Full run — all modules enabled + Hybrid mode
docker run --rm \
  -v /path/to/your/data:/data \
  -v /path/to/databases:/databases \
  nermze/mostar \
  --ont /data/reads.fq.gz \
  --r1 /data/R1.fq.gz \
  --r2 /data/R2.fq.gz \
  --genome-size X.X(m, g or k) \
  --model (default:r1041_e82_400bps_sup_v5.2.0) \
  --output /data/output \
  --kraken2-db /databases/kraken2_db \
  --bakta-db /databases/bakta_db \
  --ice \
  --genomad-db /databases/genomad_db \
  --plasticity \
  --integrons \
  --cleanup
  
#Notes
- `-v /path/to/your/data:/data` mounts your local data folder into the container — all input files and output results go here
- `-v /path/to/databases:/databases` mounts your database folder — required for Kraken2, Bakta, and geNomad
- `--rm` removes the container after the run completes
- Output files are written to the mounted `/data` folder and accessible locally after the run

Manual install

# Download the repository
git clone https://github.com/nermze/mostar.git

# Change to MOSTAR dir
cd mostar

# Create mostar_env using supplied YML
conda env create -f environment.yml -v
conda activate mostar_env

# Install MOSTAR
python -m pip install .

# Test the install
mostar --help

# If you encounter installation problems, first remove geNomad from the YML, then do
conda env create -f environment.yml -v
conda install -c conda-forge -c bioconda genomad 

# Use micromamba to install (much faster)
conda install micromamba 
micromamba env create -f environment.yml -v
micromamba activate mostar_env
python -m pip install .

Setup and download Databases (Important to get full functionality and features)

# Remember to run these commands post install in the appropriate env
# Activate env (if not activated)
# Note when running Docker, CONJScan and NCBI-Amrfinder+ database are installed automatically. 

conda activate mostar_env 
  
# Download AMRFinder+ database: 
amrfinder -u

# Download and install CONJScan (required for MacSyFinder)
msf_data install CONJScan

# Download bakta database (Specify light or full)
bakta_db download --output <output-path> --type [light|full]

# Download Kraken2 database
# To download the small pre-built db (any Kraken2 compatible DB will also work)
mkdir -p ~/kraken2_db && cd ~/kraken2_db
wget https://genome-idx.s3.amazonaws.com/kraken/k2_pluspf_08gb_20240904.tar.gz
tar -xvzf k2_pluspf_08gb_20240904.tar.gz

# Download geNomad database in current directory (or specify path), approx 1.5Gb 
genomad download-database .

Command-Line Arguments

Required Tool/Name Description
--ont ONT Reads Nanopore long-reads (.fastq.gz)
--genome-size Genome Size Estimated size (e.g., 2.1m, 500k)
--output Output Directory name for output files
--model Model Default: r1041_e82_400bps_sup_v5.2.0)
Options
--r1/--r2 Illumina Forward & Reverse short-reads (.fastq.gz)
--organism AMRFinder+ Organism (e.g., Escherichia, Staphylococcus)
--meta Flye Enable Meta-Genome mode, omit --genome-size [Default: disabled]
Annotation
--bakta-db Bakta Path to Bakta database
--bakta-ref Bakta Annotation reference sequence (.gff)
--complete Bakta Enable if sequence is complete (circular) [Default: disabled]
Mobile element Detection
--ice MacSyFinder Use with --bakta-db [Default: disabled]
--plasticity geNomad Plasticity and prophage tracker [Default: disabled]
--integrons IntegronFinder Detect integrons [Default: disabled]
Classification
--kraken2-db Kraken2 Requires path to pre-built Kraken2 database"
--confidence Kraken2 Kraken2 confidence threshold [Default: 0.1
Other
--cleanup Cleanup Delete intermediate files
--threads Threads Select number of threads
--help/-h Help Show help menu

Interactive HTML-report

Species ID and QC-metrics for assembly

MOSTAR generates comprehensive, standalone HTML report designed for both quick clinical overview, as well as deep genomic exploration. The report offers dynamic metrics based on run type, including assembly statistics, total genome size, N50 and number of contigs. If taxonomy has been enabled, the identified species will be passed on to AMTFinder+ for organism-specific point-mutation detection.

QC-Metrics

Mobile Resistome & Genomic Plasticity

By integrating geNomad, MOSTAR goes beyond simple gene detection by evaluating the context of antimicrobial resistance. The pipeline actively also flags AMR genes located on extrachromosomal plasmids. Because plasmid-borne resistance can rapidly transfer horizontally between different bacteria, these elements are highlighted as elevated clinical risks, providing critical epidemiological context.

Mobile resistome and Plasticity

Prophage Tracker

Bacteriophages act as major drivers of bacterial evolution and can frequently carry accessory genes that enhance pathogenicity. The table reports the exact location, length, and a confidence score for each viral region, categorizing them as intact or incomplete to help you identify active mobilization threats.

Prophage Tracker

Integrons

Integrons are powerful genetic elements capable of capturing and expressing mobile gene cassettes (often AMR genes) via site-specific recombination.

Integron Profile

Genome visualization

The report will also draw interactive genome maps, with visualization of AMR-gene locations, direction, detected ICE, integrons, and GC-content.

Circular Genome Visualization

Integrative Conjugative Elements (ICE)

If any ICE's are detected by MacSyFinder CONJScan, the pipeline will also extract genomic coordinates from the annotation file provided by Bakta to visualize them on the map. Notice how AMR genes are located on the ICE-element. ICE's are self-transmissible mobile elements involved in the spread of antibiotic resistance.

Circular Genome Visualization

AMR+ Summary Table

Finaly the report willl also feature a detailed AMR table derived by NCBI AMRFinder+. Plasmid-borne genes will be color-coded distinct red.

AMR summary table

Software information

Software summary table

Packages & Dependencies (installed by yml)

1. Fastp
2. Flye
3. Medaka
4. BWA 
5. AMRFinder+
6. Bakta
7. Polypolish
8. Filtlong
9. Samtools
10. Minimap2
11. Kraken2
13. MacSyFinder 
14. geNomad
15. Python3 

Troubleshooting, known issues & tips

If the pipeline stops mid-way, or gets stuck on a specific tool

The issue can usually be quickly identified by reviewing the tool-specific log-files in the output-folder. For example if the pipeline fails during the annotation step, navigate to output > logs > bakta.log.

Medaka Model Selection

If --model is not specified, MOSTAR defaults to r1041_e82_400bps_sup_v5.2.0, which corresponds to R10.4.1 flowcells basecalled with the Super Accuracy model at 400 bps. This default is appropriate for most modern ONT runs but must be changed if your data was generated on a different flowcell or basecalling configuration — using the wrong model is one of the most common causes of poor polishing outcomes. To list all models available in your Medaka installation, run: medaka tools list_models

ICE Detection Requires Functional Annotation

The --ice module depends on protein sequences produced by Bakta to query the MacSyFinder CONJScan database. If --bakta-db is not provided, Bakta annotation is skipped and no .faa file will be produced, causing ICE detection to be silently bypassed. Always pair --ice with --bakta-db to ensure this module runs. If you see the warning No protein file found — skipping ICE detection, this is the cause.

Taxonomic Classification and AMRFinder+ Point Mutation Models

When --kraken2-db is provided, MOSTAR uses the top-confidence Kraken2 hit to identify the organism and passes it to AMRFinder+ as the --organism flag, enabling species-specific point mutation screening in addition to gene-based resistance detection. Point mutation models are only available for a subset of clinically relevant organisms. If your organism is not supported, AMRFinder+ will still run in gene-detection mode without point mutations. To see all supported organisms, run: amrfinder --list_organisms

If you know your organism and want to override automatic detection for AMRFinder+, or if you are running without a Kraken2 database, use: --organism

Uneven Coverage and Metagenome-like Assemblies

If your assembly is fragmented, missing expected genomic features, or producing an unusually high contig count, your sample may have uneven read depth — common in direct clinical extractions, environmental samples, mixed cultures, or plasmid-enriched preps. Re-run with the --meta flag to enable Flye's uneven-coverage assembly mode, which does not assume uniform depth across the genome: mostar --ont reads.fq.gz --genome-size 5m --output outdir --meta Note that --meta mode disables some of Flye's coverage-based error correction, so it should only be used when standard assembly fails or produces poor results.

Low Polypolish Coverage in Hybrid Mode

If the hybrid polishing step reports mean read depth: 0.0x across all contigs, your Illumina reads are likely incomplete, truncated, or mismatched to the assembly. Verify your R1/R2 files are complete and correctly paired before re-running. MOSTAR validates that these files exist and are non-empty at startup, but cannot detect partially downloaded or corrupted files. Check read counts with: echo $(( $(wc -l < R1.fastq) / 4 )) reads A genome of ~5 Mb requires approximately 500,000 paired reads at 100 bp for 10× Polypolish coverage.

Output Directory Conflicts

If the specified --output directory already exists from a previous run, MOSTAR will write into it and overwrite existing files without warning. If you want to preserve a previous result, rename the output directory before re-running or specify a new output path.

Assembly Statistics Show Identical Medaka and Final Values

In hybrid mode, if the Medaka and Final assembly statistics are identical, Polypolish ran but made no changes. This is expected when short-read coverage is very low (typically below 5×) and does not indicate an error. Check logs/polypolish.log to confirm — the mean read depth per contig will be reported there.

Maintainer and author

GitHub

Developed and maintained by Nermin Zecic (@nermze). For questions, bugs, or feature requests, please open an Issue.

Metadata

Release files for mostar 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mostar 1.0.5
File Size Uploaded Provenance Actions
mostar-1.0.5.tar.gz 40.4 kB With provenance Details for mostar-1.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mostar 1.0.5
File Interpreter ABI Platform Actions
mostar-1.0.5-py3-none-any.whl Python 3 none any Details for mostar-1.0.5-py3-none-any.whl

Total release size: 74.9 kB

Release files / mostar-1.0.5.tar.gz

Download URL mostar-1.0.5.tar.gz
Size 40.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1177b73f1b47d365d301ee96afa7fb6a7ce36948b22d3148a7a15986a4870333
BLAKE2b-256 checksum
How to use checksums
ae5a299e4fa6b607f4f36bad6ad72d4c19afb0be007331f6c36a834f920e2815
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

Release files / mostar-1.0.5-py3-none-any.whl

Download URL mostar-1.0.5-py3-none-any.whl
Size 34.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e5338c0b6e312fc903a78624920ca63951316d4a41b66abd20b39ec67b62f60
BLAKE2b-256 checksum
How to use checksums
b86565ac8f2cffd38f1f916def54d5fb4858a7e447f0a6d6548d2d3f77f5c427
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

Security for mostar 1.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mostar-1.0.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page