Skip to article frontmatterSkip to article content

How to bin MAGs

Bokulich Lab

Step 1 — Index contigs with index-contigs

Build a Bowtie2 index for each sample’s contigs using the assembly plugin. This index enables read mapping in the next step and is required by both binners.

With parsl parallelization
Without parallelization
mosh assembly index-contigs \
    --i-contigs cache:contigs \
    --p-threads 8 \
    --p-seed 100 \
    --o-index cache:contigs_index \
    --parallel-config parallel.config.toml \
    --verbose

Step 2 — Map reads to contigs with map-reads

Map the original reads back to the assembled contigs. Both binners use the resulting alignment maps to estimate contig coverage across samples, which is a key signal for grouping contigs into bins.

With parsl parallelization
Without parallelization
mosh assembly map-reads \
    --i-index cache:contigs_index \
    --i-reads cache:reads \
    --p-threads 8 \
    --p-seed 100 \
    --o-alignment-maps cache:reads_to_contigs_aln \
    --parallel-config parallel.config.toml \
    --verbose

Step 3 — Bin contigs into MAGs

Two binners are available in the mag plugin. Both take the same contigs and alignment maps as input; choose one based on your environment and expected sample type.

MetaBAT 2
SemiBin2

bin-contigs-metabat uses tetranucleotide frequency together with coverage information to group contigs. It is fast, well-established, and explicitly outputs the contigs that could not be assigned to any bin (unbinned-contigs), which is used later in the BUSCO visualization.

mosh mag bin-contigs-metabat \
    --i-contigs cache:contigs \
    --i-alignment-maps cache:reads_to_contigs_aln \
    --p-num-threads 4 \
    --p-seed 100 \
    --o-mags cache:mags \
    --o-contig-map cache:contig_map \
    --o-unbinned-contigs cache:unbinned_contigs \
    --verbose

MetaBAT 2 vs SemiBin2 — when to use which

AspectMetaBAT 2SemiBin2
AlgorithmTetranucleotide frequency + coverageDeep learning + coverage
SpeedFastSlower (especially without GPU)
Environment-specific modelsNoYes — improves accuracy for known environments
Unbinned contigs outputYesNo
Best forAny dataset; good defaultSamples from well-characterized environments

Step 4 — Evaluate MAG quality with evaluate-busco

BUSCO assesses completeness and contamination of each MAG by checking for the presence of lineage-specific single-copy marker genes. First download the relevant BUSCO database with fetch-busco-db:

mosh mag fetch-busco-db \
    --p-lineages bacteria_odb12 \
    --o-db cache:busco_db \
    --verbose

Common lineages: bacteria_odb12, archaea_odb12, eukaryota_odb12. Use bacteria_odb12 for typical gut/soil/environmental metagenomes. Then run the evaluation:

With parsl parallelization
Without parallelization
mosh mag evaluate-busco \
    --i-mags cache:mags \
    --i-db cache:busco_db \
    --i-unbinned-contigs cache:unbinned_contigs \
    --p-lineage-dataset bacteria_odb12 \
    --p-cpu 4 \
    --o-results cache:busco_results \
    --o-visualization mags.qzv \
    --parallel-config parallel.config.toml \
    --verbose

Step 5 — Filter MAGs by quality with filter-mags

Remove low-quality bins before dereplication or downstream analyses. The MIMAG standard defines “medium quality” as ≥50% completeness and <10% contamination:

mosh mag filter-mags \
    --i-mags cache:mags \
    --m-metadata-file cache:busco_results \
    --p-where "completeness>50 AND contamination<10" \
    --p-on "mag" \
    --o-filtered-mags cache:mags_filtered \
    --verbose

Adjust thresholds based on your downstream goals. For high-confidence phylogenomic analyses you may require ≥90% completeness and <5% contamination (“high quality” by MIMAG). For broad community profiling, more permissive thresholds may be appropriate.

After dereplication, you can apply a second round of filtering on the dereplicated set with filter-derep-mags, which accepts a FeatureData[MAG] artifact instead of SampleData[MAGs].


QC checkpoint

In the BUSCO visualization (mags.qzv), inspect:

  • Completeness distribution — most MAGs from a well-assembled community should be >50% complete.

  • Contamination — bins with >10% contamination likely contain sequences from multiple organisms; consider discarding them.

  • Unbinned contig fraction (MetaBAT 2 only) — a large unbinned fraction suggests many contigs were too short or had insufficient coverage to be confidently assigned; this is normal for diverse or low-coverage samples.


Further reading