Skip to main content

MagCluster MagCluster Logo

Python Version License: GPL v3 Version

English | 中文说明

MagCluster is a tool for finding, annotating, and visualizing magnetosome gene clusters (MGCs) in bacterial genomes.


What's New in v1.0

  • One command: magcluster run runs everything from gene prediction to cluster visualization in a single step.
  • No Prokka needed: gene calling is handled natively by Pyrodigal (fast, no Perl or external setup).
  • 92 HMM profiles: curated protein HMMs covering 8 magnetosome families (Mam, Mms, Mad, Man, Mae, Maq, Mca, Feo), searched using PyHMMER.
  • Flexible inputs: accepts GenBank (.gbk/.gbff), nucleotide FASTA contigs (.fasta/.fna/.fa), and protein FASTA (.faa), including .gz compressed files.
  • Per-genome outputs: writes separate {genome}_mgc_genes.tsv and {genome}_magnetosome_proteins.faa files for each genome.

Installation

conda create -n magcluster-1.0 -c conda-forge -c bioconda python=3.12 pip
conda activate magcluster-1.0

2. Install MagCluster

From GitHub:

pip install git+https://github.com/RunJiaJi/magcluster.git

Or from local source:

git clone https://github.com/RunJiaJi/magcluster.git
cd MagCluster
pip install -e .

Verify the installation:

magcluster --version
magcluster run --help

Quick Start

1. Annotated GenBank file (.gbff / .gbk)

magcluster run genome.gbff -o results/

2. Unannotated FASTA contigs (.fasta / .fna / .fa)

MagCluster automatically predicts genes and uses all CPU cores by default:

magcluster run contigs.fasta -o results/ -t 8

3. Multiple genomes in a folder

magcluster run genomes_dir/ -o results/

4. Protein FASTA (.faa)

Note if your input contains protein sequences without coordinates, MagCluster will annotate magnetosome proteins and output TSV table and FASTA files without plotting the gene cluster:

magcluster run proteins.faa -o results/

5. Overwrite an existing output folder

magcluster run genome.gbff -o results/ --force

Commands & Options

magcluster run

magcluster run [OPTIONS] INPUTS...
Option Shorthand Default Description
--outdir -o magcluster_results Output directory
--force -f False Overwrite files if the output directory is not empty
--threads -t 0 Number of CPU threads (0 = use all cores)
--evalue -e 1e-5 HMM search E-value cutoff
--score -s 25.0 Minimum HMM bit score
--max-gap 5 Maximum non-magnetosome genes allowed between hits in a cluster
--threshold -th 3 Minimum number of distinct magnetosome families required to call an MGC
--flank -un 3 Number of non-magnetosome flanking genes to keep on each side
--meta / --single Auto Force metagenome mode or single-genome mode for gene prediction
--identity -i 0.3 Minimum sequence identity cutoff for Clinker alignments (0.0–1.0)
--clinker-opts None Extra arguments passed to Clinker (e.g. "-na -ufo")
--clinker-help Show available Clinker options guide and exit
--static-plot False Also generate static SVG figures
--no-plot False Skip Clinker visualization (tables only)

magcluster db

View the built-in reference database, the 10 core defining families, and all 92 HMM profiles sorted by sequence count:

magcluster db

Output Files

Running magcluster run <inputs> -o results/ produces:

results/
├── {genome}_mgc_genes.tsv              # Table of all identified magnetosome genes
├── {genome}_magnetosome_proteins.faa   # Extracted magnetosome protein sequences
├── MGC_align.html                      # Interactive gene cluster map (open in browser)
└── clusters_gbk/                       # Sliced GenBank file for each cluster
    └── {cluster_id}.gbk

1. Gene table ({genome}_mgc_genes.tsv)

Column Meaning
cluster_id Cluster ID (e.g. MSR-1_genome_MGC), or unclustered for isolated genes
genome Genome name
gene_id Locus tag or gene identifier
contig Contig or scaffold name
start, end Gene coordinates (1-based)
strand Strand (+ or -)
profile Best matching HMM profile (e.g. MamE_full, MamE_Cter, MamQ_greigite)
parent_family Family name (e.g. MamE, MamQ)
role core, accessory, or iron_context
score, evalue HMM match score and E-value

2. Protein sequences ({genome}_magnetosome_proteins.faa)

Amino acid sequences of all magnetosome proteins found in that genome, with detailed header info:

>MGMSRV2_RS11765 [MSR-1_genome] cluster=MSR-1_genome_MGC family=MamE profile=MamE_full score=1000.4 evalue=1.97e-301
MSERRPVGRTL...

3. Interactive visualization (MGC_align.html)

Open this file in your webbrowser:

  • Gene labels: Arrows show specific domain annotations like MamE_Cter, MamE_Nter, and MamQ_greigite.
  • Family colors:
    • Red: mam family
    • Yellow: mms family
    • Green: mad family
    • Blue: man family
    • Gold: feo family
    • Purple: mae family
    • Teal: maq family
    • Pink: mca family
    • Grey: Other neighboring non-magnetosome genes
  • Customizable: Drag genes, change colors, re-align, and export publication-ready SVG figures directly from the browser.

Helpful Tips

Faster Clinker plotting on large datasets

Pairwise sequence alignments between large clusters can take time. Use --clinker-opts to speed it up:

# Skip pairwise sequence alignment:
magcluster run *.gbff -o results/ --clinker-opts "-na"

# Keep the original file order instead of automatic reordering:
magcluster run *.gbff -o results/ --clinker-opts "-ufo"

# Both:
magcluster run *.gbff -o results/ --clinker-opts "-na -ufo"

To see all Clinker visualization options, run:

magcluster run --clinker-help

Core Magnetosome Families

MagCluster considers an MGC authentic if it contains at least 3 distinct magnetosome families. The 10 core defining families are:

$$\text{MamA, MamB, MamE, MamI, MamK, MamL, MamM, MamO, MamP, MamQ}$$


Citation

If you use MagCluster, please cite:

Runjia Ji, Wensi Zhang, Yongxin Pan, and Wei Lin. (2022).
MagCluster: a Tool for Identification, Annotation, and Visualization of Magnetosome Gene Clusters.
Microbiology Resource Announcements, 11:e01031-21.
https://doi.org/10.1128/mra.01031-21

Dependencies used by MagCluster:


Contact

Questions or suggestions? Feel free to reach out:

  • GitHub Issues: Open an issue
  • Email: Runjia Ji (jirunjia@gmail.com) or Wei Lin (weilin@mail.iggcas.ac.cn)

Metadata

Release files for magcluster 1.0.0

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

Source distribution (sdist)

Source distribution for magcluster 1.0.0
File Size Uploaded
magcluster-1.0.0.tar.gz 1.9 MB Details

Built distribution (wheel)

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

Total release size: 3.8 MB

Release files / magcluster-1.0.0.tar.gz

Download URL magcluster-1.0.0.tar.gz
Size 1.9 MB
Tags Source
SHA-256 checksum
How to use checksums
63e34f2c6257f5e673152a41d1246d94e9f41cbafc2129d727375031be0f7439
BLAKE2b-256 checksum
How to use checksums
128dd6fa7e2a1ca14045fb39abb53d21e1a4ddd2217dc9ea220718b7a7dabd62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / magcluster-1.0.0-py3-none-any.whl

Download URL magcluster-1.0.0-py3-none-any.whl
Size 1.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
80607b7425262376da13c3a26827be15e73e2fcb3406f6f5de1511d2f9d7635d
BLAKE2b-256 checksum
How to use checksums
6418d6afe042cee350b233d7373677503cb536aa4a97d383a2636ab990204c01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.2

2 release files

0.2.0

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.0

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

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