Skip to content
Mcm190Public

About

CLI and desktop GUI tool for antimicrobial resistance (AMR) gene detection using CARD BLAST

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AMRWin - Antimicrobial Resistance Gene Search for Windows/Linux

AMRWin searches nucleotide sequence files and direct sequence links for antimicrobial resistance genes using BLAST+ and the Comprehensive Antibiotic Resistance Database (CARD). The desktop app can also identify bacterial species from 16S rRNA reads and export TSV and Excel reports.

Quickstart with an NCBI genome

This walkthrough uses the RefSeq assembly GCF_000953275.1 from Clostridioides difficile strain 630Derm. Install AMRWin and complete the Set up CARD prompt on first launch. The screenshots use AMRWin v1.1.1 and CARD 4.0.2. AMRWin downloads · CARD downloads

1. Download the genome ZIP

On the Genome assembly CD630DERM page, click Download. Include genomic FASTA in the download and save the ZIP. The RefSeq accession on the page is GCF_000953275.1. NCBI assembly page · NCBI genome download guide

NCBI Datasets page showing the Download button and RefSeq accession GCF_000953275.1

2. Extract and locate the .fna file

Open ncbi_dataset.zip and extract it. Inside the extracted folder, open ncbi_dataset, then data, then GCF_000953275.1. If the ZIP also contains a GCA_000953275.1 folder, use the GCF_ folder for this walkthrough. NCBI genome package layout

ncbi_dataset/data/GCF_000953275.1/GCF_000953275.1_CD630DERM_genomic.fna

Opened ZIP archive with the RefSeq folder expanded and the genomic FNA file selected

3. Open the FASTA in AMRWin

Click … beside Sequence file or URL, select GCF_000953275.1_CD630DERM_genomic.fna, and click Open.

AMRWin file picker showing the extracted genomic FNA file ready to open

4. Run the search

Leave Search Mode on Auto-detect and keep Species DB (16S) filled in. Click Run Search + Speciation to run both comparisons on the same file.

AMRWin Files panel with the FASTA loaded, the 16S database ready, and the Run Search + Speciation button visible

5. Read the AMR hits

Open AMR Results. This run returned five CARD reference hits from one assembly sequence. Select a row to see the ARO accession, drug class, identity, and coverage. Use Export TSV or Export Excel to save a copy. How AMRWin uses CARD · CARD database

AMR Results tab showing five CARD matches and the details for a selected hit

6. Read the 16S match

Open Speciation. This run ranked Clostridioides difficile first, with 100.0% alignment identity and 99.8% 16S reference coverage. The tab shows candidates from the BLAST comparison with the bundled NCBI 16S rRNA database. Click Export Speciation TSV to save the ranked results. NCBI 16S BLAST database

Speciation tab showing Clostridioides difficile ranked first with 100.0% identity and 99.8% 16S reference coverage

Download

Get the Windows EXE or Linux AppImage from the latest release. Both are x86-64 and include BLAST+ and the NCBI 16S database.

  • Windows — Open AMRSearch_portable.exe in a writable folder. It extracts the app alongside itself and launches it.
  • Linux — Run chmod +x AMRWin-x86_64.AppImage and then ./AMRWin-x86_64.AppImage. On systems without FUSE, use ./AMRWin-x86_64.AppImage --appimage-extract-and-run. Reports default to ~/.local/share/amrwin/reports, or $XDG_DATA_HOME/amrwin/reports if set.

On first launch, the main window opens and shows Initial Setup. Choose Set up CARD 4.0.2 to download the data from McMaster. The dialog tracks the download and database build. When it says Ready, click OK to start searching. You can also run setup later from the Files panel.

AMRWin checks McMaster's latest CARD release at startup. The Files panel compares it with the selected database and offers a Check CARD version button to refresh the comparison. Local files can be searched offline after setup. Help → About AMRWin shows the selected CARD version and the bundled NCBI 16S build date. CARD terms of use

Open a sequence file or link

Browse for a file or paste a direct HTTP or HTTPS sequence link or an NCBI Nucleotide FASTA-view link into Sequence file or URL, then select Run Search + Speciation. The scanner detects the format from the sequence data, including links and files without a recognised extension. AMRWin reads the link once and removes its temporary query files after the scan.

You can also launch the scanner with a file or link as its first argument to fill in the input when it opens. For example, run ./AMRWin-x86_64.AppImage "reads.fastq.gz" on Linux or & .\AMRSearch.exe "reads.fastq.gz" in PowerShell after extracting the Windows package.

Input Common extensions
FASTA assemblies, amplicons and reads .fasta, .fa, .fna, .ffn, .fsa, .fas, .fnt, .mfa
FASTQ reads, including wrapped records .fastq, .fq, .fastqsanger, .sanger, .fastq-sanger, .fastq-illumina, .fastq-solexa
Sanger trace and base calls .ab1, .abi, .abif, .phd, .phd.1
Standard Flowgram Format .sff
GenBank and EMBL flat files .gb, .gbk, .gbff, .genbank, .embl, .emb
GFA 1 and 2 assembly graphs with embedded sequences .gfa, .gfa1, .gfa2
SAM records with primary read sequences .sam

Inputs may be compressed with gzip or BGZF (.gz, .bgz, .bgzf), bzip2 (.bz2), or xz (.xz).

Screenshots

AMR Results - colour-coded by drug class clinical priority AMR Results tab

Speciation - bacterial species ID from 16S rRNA BLAST Speciation tab

Summary - drug class and resistance mechanism breakdown Summary tab

CLI mode - rich terminal output (amr_search.py) CLI output


Features

  • Sequence input - auto-detected local or linked nucleotide files, with compression support
  • CARD BLAST search - nucleotide BLAST against homolog and chromosomal variant resistance models
  • Colour-coded results - hits ranked by clinical priority (carbapenems, colistin, glycopeptides, fluoroquinolones, and more)
  • Speciation - optional 16S rRNA BLAST assigns a species call with identity statistics
  • Auto-detect mode - automatically switches between read mode (short reads) and assembly mode (contigs >= 10 kb) based on sequence length
  • Configurable thresholds - identity %, query coverage %, gene coverage %, e-value, and thread count
  • Export - TSV and formatted Excel workbooks with conditional formatting
  • CLI mode - amr_search.py for headless / scripted pipelines (rich terminal output)
  • Portable desktop builds - native BLAST+ and a local 16S database for Windows and Linux

How It Works

Pipeline

Sequence file or direct link
        |
        v
  Detect format and prepare FASTA
        |
        v
  Auto-detect mode
  max seq length >= 10 kb -> filter by gene coverage
  otherwise               -> filter by query coverage
        |
        v
  blastn vs CARD nucleotide database
  (homolog + chromosomal variant resistance models)
        |
        v
  Parse BLAST output
  Filter by identity / query coverage / gene coverage / e-value
  Annotate hits from ARO index
  (gene name, drug class, resistance mechanism, AMR gene family)
        |
        v
  Colour-code by drug class -> TSV + Excel export
        |
        v (optional)
  blastn vs NCBI 16S rRNA database
  Aggregate top species hits -> species call + identity stats

CARD Database

AMRWin's default setup installs CARD Broad Street 4.0.2, released in August 2026. The default database combines nucleotide reference sequences from the protein homolog and protein variant models. The ARO index adds gene names, drug classes, resistance mechanisms, and gene families. A variant-model hit reports a reference alignment. Confirming a specific resistance mutation requires mutation-aware analysis. CARD downloads

Species Identification

The desktop app compares input sequences to the NCBI 16S ribosomal RNA database. It counts each input sequence once per candidate species, even when the input contains multiple 16S copies. If closely scoring species support the same input, the app may report Ambiguous 16S match. The table and TSV report rank candidates by the number of supporting sequences, then by the best alignment bit score. The table includes identity and coverage of the 16S reference. Clear the Species DB (16S) field to run only the AMR search.

Build a Linux AppImage

These commands use Ubuntu 22.04 or newer on x86-64. The local install script downloads the current CARD and NCBI 16S datasets, builds the CARD index, and bakes both databases into a local AppImage. Run it again to refresh both datasets. Check the bundled versions under Help → About AMRWin.

sudo apt update
sudo apt install git curl ca-certificates python3 python3-venv python3-tk libgomp1 desktop-file-utils

git clone https://github.com/Mcm190/AMRwin.git
cd AMRwin
python3 -m venv .venv
.venv/bin/python packaging/build_local.py
./dist/AMRWin-x86_64.AppImage

To run the same build steps individually, use the virtual environment created above.

# Install PyInstaller and the application dependencies
.venv/bin/python -m pip install -r requirements.txt pyinstaller==6.19.0

# Fetch and stage native BLAST+, the current CARD release, and NCBI 16S
.venv/bin/python packaging/prepare_bundle.py --local

# Freeze the desktop app into dist/AMRSearch/
.venv/bin/python -m PyInstaller --noconfirm amr_search_gui.spec

# Add the launcher and package dist/AMRWin-x86_64.AppImage
bash packaging/linux/build_appimage.sh

# Run the AppImage using its built-in extraction mode if FUSE is unavailable
./dist/AMRWin-x86_64.AppImage --appimage-extract-and-run

Run from source on Linux

Use this setup for the GUI or CLI without packaging an AppImage.

sudo apt install ncbi-blast+ python3-tk
.venv/bin/python -m pip install -r requirements.txt
.venv/bin/python loaders/build_amr_db.py --out amr_db
.venv/bin/python amr_search_gui.py

Run from source or build on Windows

Install Python 3.10+ with Tcl/Tk and BLAST+ on PATH for source use. Run these commands from the repo.

powershell -ExecutionPolicy Bypass -File setup.ps1
.venv\Scripts\python.exe loaders\build_amr_db.py --out amr_db
.venv\Scripts\python.exe amr_search_gui.py

Install NSIS and run the install script with -BuildApp to fetch and bake both current databases into a local portable EXE.

powershell -ExecutionPolicy Bypass -File setup.ps1 -BuildApp
.\dist\AMRSearch_portable.exe

The GitHub Actions build produces the public Windows and Linux packages. The local build script is for building from copies of the data you download for your own use.

CLI Usage

Run amr_search.py with Python from the source checkout after installing the requirements and building the CARD database. The database argument takes the file prefix, for example amr_db for amr_db.nin. On Windows, use .venv\Scripts\python.exe in place of .venv/bin/python.

# Search the included sample
.venv/bin/python amr_search.py --input test_samples.fasta --db amr_db

# Search FASTQ reads and choose both report paths
.venv/bin/python amr_search.py --input reads.fastq.gz --db amr_db \
    --out reads.tsv --xlsx reads.xlsx --workers 4

# Search a direct URL and check CARD before the scan
.venv/bin/python amr_search.py --input "$SEQUENCE_URL" --db amr_db --check-card

# Check the database version by itself
.venv/bin/python amr_search.py --db amr_db --check-card

# Force assembly mode on a contig file and require 90% gene coverage
.venv/bin/python amr_search.py --input assembly.fasta --db amr_db \
    --assembly --min-identity 90 --min-gene-coverage 90

.venv/bin/python amr_search.py --help

By default, reports go under reports/ and the ARO index is read from <db>_aro_index.tsv. Use --index to supply its path explicitly. Read mode applies --min-coverage to query coverage. Assembly mode applies --min-gene-coverage to reference coverage and is selected automatically for inputs with any sequence at least 10 kb long.

Generate an Excel report

Use --xlsx to choose where the CLI saves the workbook. --out sets the separate TSV path. This command generates the workbook shown below from the included sample and CARD 4.0.2.

.venv/bin/python amr_search.py --input test_samples.fasta --db amr_db --xlsx reports/amrwin-report.xlsx --out reports/amrwin-report.tsv

Open reports/amrwin-report.xlsx in GridCraft or another XLSX viewer. The workbook contains AMR Hits, Drug Class Summary, Summary Stats, and Charts. The CLI writes the workbook when hits pass the selected thresholds.

AMR Hits in GridCraft

The AMR Hits worksheet in GridCraft with a colour-coded hit and coverage statistics

Charts in GridCraft

The Charts worksheet in GridCraft showing hits by drug class and resistance mechanism

Rebuild the source database

# Fetch the current CARD release from McMaster
.venv/bin/python loaders/build_amr_db.py --latest --out amr_db

# Build only the protein homolog models from the pinned CARD release
.venv/bin/python loaders/build_amr_db.py --models homolog --out amr_db

References

  1. CARD - Alcock BP, et al. CARD 2023: expanded curation, detection models and ontological representation of antibiotic resistance. Nucleic Acids Research 2023;51(D1):D690-D699. https://doi.org/10.1093/nar/gkac920

  2. BLAST+ - Camacho C, et al. BLAST+: architecture and applications. BMC Bioinformatics 2009;10:421. https://doi.org/10.1186/1471-2105-10-421

  3. NCBI 16S rRNA Database - National Center for Biotechnology Information. 16S ribosomal RNA sequences (Bacteria and Archaea). https://ftp.ncbi.nlm.nih.gov/blast/db/

  4. BioPython - Cock PJA, et al. Biopython: freely available Python tools for computational molecular biology and bioinformatics. Bioinformatics 2009;25(11):1422-1423. https://doi.org/10.1093/bioinformatics/btp163

  5. openpyxl - Gazoni E, Clark C. openpyxl - A Python library to read/write Excel files. https://openpyxl.readthedocs.io/

  6. Rich - Willison W. Rich: rich text and beautiful formatting in the terminal. https://github.com/Textualize/rich

  7. PyInstaller - PyInstaller Development Team. PyInstaller - Freeze Python applications. https://pyinstaller.org/

  8. NSIS - Nullsoft Scriptable Install System. https://nsis.sourceforge.io/

  9. NCBI Datasets assembly used in the quickstart - National Center for Biotechnology Information, National Library of Medicine. Genome assembly CD630DERM, Clostridioides difficile strain 630Derm, RefSeq accession GCF_000953275.1. NCBI Datasets assembly record

  10. Original genome publication - van Eijk E, Anvar SY, Browne HP, Leung WY, Frank J, Schmitz AM, Roberts AP, and Smits WK. Complete genome sequence of the Clostridium difficile laboratory strain 630Δerm reveals differences from strain 630, including translocation of the mobile element CTn5. BMC Genomics 16, article 31 (2015). DOI 10.1186/s12864-015-1252-7

About

CLI and desktop GUI tool for antimicrobial resistance (AMR) gene detection using CARD BLAST

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages